Gui: SoFrameLabel text color from base color support

This adds support for obtaining text color from the state of the graph
(base color) to SoFrameLabel nodes.
This commit is contained in:
Kacper Donat
2025-02-23 15:04:34 +01:00
parent 0a0c5f828e
commit 076ab800ff
2 changed files with 11 additions and 0 deletions

View File

@@ -381,6 +381,7 @@ SoFrameLabel::SoFrameLabel()
SO_NODE_ADD_FIELD(frame, (true));
SO_NODE_ADD_FIELD(border, (true));
SO_NODE_ADD_FIELD(backgroundUseBaseColor, (false));
SO_NODE_ADD_FIELD(textUseBaseColor, (false));
//SO_NODE_ADD_FIELD(image, (SbVec2s(0,0), 0, NULL));
}
@@ -508,6 +509,15 @@ void SoFrameLabel::GLRender(SoGLRenderAction *action)
}
}
if (textUseBaseColor.getValue()) {
SoState* state = action->getState();
const SbColor& diffuse = SoLazyElement::getDiffuse(state, 0);
if (diffuse != this->textColor.getValue()) {
this->textColor.setValue(diffuse);
}
}
inherited::GLRender(action);
}

View File

@@ -120,6 +120,7 @@ public:
SoSFBool frame;
SoSFBool border;
SoSFBool backgroundUseBaseColor;
SoSFBool textUseBaseColor;
//SoSFImage image;
QPixmap iconPixmap;