I am building a renderer plugin and I have some difficulties of how to get the background color (i) at my renderer start up and (ii) while the renderer is running. In the ChangeQueue the ApplyRenderSettingsChanges function is only called once, when starting my renderer:
void ChangeQueue::ApplyRenderSettingsChanges(const ON_3dmRenderSettings& onRenderSettings) const
{
auto that = const_cast<ChangeQueue*>(this);
if (onRenderSettings.m_bCustomImageSize)
{
that->_scene->renderSize.x = onRenderSettings.m_image_width;
that->_scene->renderSize.y = onRenderSettings.m_image_height;
that->_scene->renderRect.upper.x = onRenderSettings.m_image_width;
that->_scene->renderRect.upper.y = onRenderSettings.m_image_height;
}
switch (onRenderSettings.m_background_style)
{
case 1: that->_scene->background.type = BackgroundType::Image; break;
case 2: that->_scene->background.type = BackgroundType::Gradient; break;
case 3: that->_scene->background.type = BackgroundType::Environment; break;
default: that->_scene->background.type = BackgroundType::Solid; break;
}
that->_scene->background.color = fromRhino(onRenderSettings.m_background_color);
that->_scene->background.color2 = fromRhino(onRenderSettings.m_background_bottom_color);
}
After that, when I go to the right Panel Display→Solid color and change the color I am having the the ApplyRenderSettingsChanges called again.
What is the proper way to get the background color in these two cases? Should I try to do it in the Display Mode instead? I am not sure how, any suggestion would be more than welcome!
this gives me always white, it could be the default color before the scene is loaded (?)
Actually I just noticed that if I block my renderer and set display mode to it I get the viewport in the color of the Panel Display→Solid color, which some how makes me think that perhaps this is not the right way to read the rhino project’s background color.