From 6711e53d1681e86d9ea88783fa9353a8b84c13ce Mon Sep 17 00:00:00 2001 From: Rexbas Date: Sat, 2 Dec 2023 13:43:15 +0100 Subject: [PATCH] Part: Use materialIndex.setValuesPointer() only if the new values are different --- src/Mod/Part/Gui/SoBrepFaceSet.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index 5555c3163cdfc..443548cc0a909 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -643,9 +643,6 @@ void SoBrepFaceSet::GLRender(SoGLRenderAction *action) } if(pushed) { - SbBool notify = enableNotify(FALSE); - materialIndex.setNum(0); - if(notify) enableNotify(notify); state->pop(); }else if(action->isRenderingDelayedPaths()) { renderSelection(action,ctx); @@ -836,9 +833,11 @@ bool SoBrepFaceSet::overrideMaterialBinding(SoGLRenderAction *action, SelContext } } - SbBool notify = enableNotify(FALSE); - materialIndex.setValuesPointer(matIndex.size(),&matIndex[0]); - if(notify) enableNotify(notify); + if (materialIndex.getNum() != matIndex.size() || materialIndex.getValues(0) != &matIndex[0]) { + SbBool notify = enableNotify(FALSE); + materialIndex.setValuesPointer(matIndex.size(), &matIndex[0]); + if (notify) enableNotify(notify); + } SoMaterialBindingElement::set(state, this, SoMaterialBindingElement::PER_PART_INDEXED); SoLazyElement::setPacked(state, this, packedColors.size(), &packedColors[0], hasTransparency);