From b1347ec12b99a7f90e336ede50d935393c14bf9d Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 6 Mar 2017 09:29:26 +0100 Subject: [PATCH] support of highlighting and selection if shading is disabled --- src/Mod/Part/Gui/SoBrepFaceSet.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index ba10b11290..596599aa78 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -789,12 +789,11 @@ void SoBrepFaceSet::renderHighlight(SoGLRenderAction *action) SoLazyElement::setEmissive(state, &this->highlightColor); SoOverrideElement::setEmissiveColorOverride(state, this, true); -#if 0 // disables shading effect - // sendNormals will be false - SoLazyElement::setDiffuse(state, this,1, &this->highlightColor,&this->colorpacker); - SoOverrideElement::setDiffuseColorOverride(state, this, true); - SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR); -#endif + // if shading is disabled then set also the diffuse color + if (SoLazyElement::getLightModel(state) == SoLazyElement::BASE_COLOR) { + SoLazyElement::setDiffuse(state, this,1, &this->highlightColor,&this->colorpacker); + SoOverrideElement::setDiffuseColorOverride(state, this, true); + } Binding mbind = this->findMaterialBinding(state); Binding nbind = this->findNormalBinding(state); @@ -870,11 +869,11 @@ void SoBrepFaceSet::renderSelection(SoGLRenderAction *action) SoLazyElement::setEmissive(state, &this->selectionColor); SoOverrideElement::setEmissiveColorOverride(state, this, true); -#if 0 // disables shading effect - SoLazyElement::setDiffuse(state, this,1, &this->selectionColor,&this->colorpacker); - SoOverrideElement::setDiffuseColorOverride(state, this, true); - SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR); -#endif + // if shading is disabled then set also the diffuse color + if (SoLazyElement::getLightModel(state) == SoLazyElement::BASE_COLOR) { + SoLazyElement::setDiffuse(state, this,1, &this->selectionColor,&this->colorpacker); + SoOverrideElement::setDiffuseColorOverride(state, this, true); + } Binding mbind = this->findMaterialBinding(state); Binding nbind = this->findNormalBinding(state);