Tests: Correct testcases after scene graph reordering in Clarify Select

This commit is contained in:
tetektoza
2025-09-05 02:28:59 +02:00
parent 44a4825edf
commit 527f18adcd
5 changed files with 27 additions and 21 deletions

View File

@@ -77,7 +77,7 @@ class ExportImportTest(unittest.TestCase):
sa.apply(feature.ViewObject.RootNode)
paths = sa.getPaths()
bind = paths.get(2).getTail()
bind = paths.get(1).getTail()
self.assertEqual(bind.value.getValue(), bind.PER_PART)
sa = coin.SoSearchAction()
@@ -87,5 +87,5 @@ class ExportImportTest(unittest.TestCase):
sa.apply(feature.ViewObject.RootNode)
paths = sa.getPaths()
mat = paths.get(2).getTail()
mat = paths.get(1).getTail()
self.assertEqual(mat.diffuseColor.getNum(), 6)

View File

@@ -90,7 +90,7 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action)
bool hasContextHighlight = ctx && !ctx->hl.empty();
bool hasFaceHighlight = viewProvider->isFaceHighlightActive();
bool hasFaceHighlight = viewProvider && viewProvider->isFaceHighlightActive();
bool hasAnyHighlight = hasContextHighlight || hasFaceHighlight;
if (Gui::Selection().isClarifySelectionActive()
@@ -98,7 +98,9 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action)
&& hasAnyHighlight) {
// if we are using clarifyselection - add this to delayed paths with priority
// as we want to get this rendered on top of everything
viewProvider->setFaceHighlightActive(true);
if (viewProvider) {
viewProvider->setFaceHighlightActive(true);
}
Gui::SoDelayedAnnotationsElement::addDelayedPath(action->getState(),
action->getCurPath()->copy(),
200);
@@ -159,8 +161,7 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action)
if(ctx2 && !ctx2->selectionIndex.empty())
renderSelection(action,ctx2,false);
else if (Gui::Selection().isClarifySelectionActive()
&& ((ctx && !ctx->hl.empty()) || viewProvider->isFaceHighlightActive())
&& Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths) {
&& !Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths && hasAnyHighlight) {
state->push();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View File

@@ -532,10 +532,11 @@ void SoBrepFaceSet::GLRender(SoGLRenderAction *action)
auto state = action->getState();
selCounter.checkRenderCache(state);
bool hasContextHighlight = ctx && ctx->isHighlighted() && !ctx->isHighlightAll()
&& ctx->highlightIndex >= 0 && ctx->highlightIndex < partIndex.getNum();
// for the tool add this node to delayed paths as we want to render it on top of the scene
if (Gui::Selection().isClarifySelectionActive() && ctx && ctx->isHighlighted()
&& !ctx->isHighlightAll() && ctx->highlightIndex >= 0
&& ctx->highlightIndex < partIndex.getNum()) {
if (Gui::Selection().isClarifySelectionActive() && hasContextHighlight) {
if (!Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths) {
if (viewProvider) {

View File

@@ -83,13 +83,17 @@ void SoBrepPointSet::GLRender(SoGLRenderAction *action)
return;
if(selContext2->checkGlobal(ctx))
ctx = selContext2;
bool hasContextHighlight =
ctx && ctx->isHighlighted() && !ctx->isHighlightAll() && ctx->highlightIndex >= 0;
// for clarifyselection, add this node to delayed path if it is highlighted and render it on
// top of everything else (highest priority)
if (Gui::Selection().isClarifySelectionActive() && ctx && ctx->isHighlighted()
&& !ctx->isHighlightAll() && ctx->highlightIndex >= 0
if (Gui::Selection().isClarifySelectionActive() && hasContextHighlight
&& !Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths) {
viewProvider->setFaceHighlightActive(true);
if (viewProvider) {
viewProvider->setFaceHighlightActive(true);
}
Gui::SoDelayedAnnotationsElement::addDelayedPath(action->getState(),
action->getCurPath()->copy(),
300);

View File

@@ -49,7 +49,7 @@ class ColorPerFaceTest(unittest.TestCase):
sa.apply(box.ViewObject.RootNode)
paths = sa.getPaths()
mat = paths.get(2).getTail()
mat = paths.get(1).getTail()
self.assertEqual(mat.diffuseColor.getNum(), 6)
def testBoxAndLink(self):
@@ -83,7 +83,7 @@ class ColorPerFaceTest(unittest.TestCase):
sa.apply(box.ViewObject.RootNode)
paths = sa.getPaths()
mat = paths.get(2).getTail()
mat = paths.get(1).getTail()
self.assertEqual(mat.diffuseColor.getNum(), 6)
def testTransparency(self):
@@ -110,7 +110,7 @@ class ColorPerFaceTest(unittest.TestCase):
sa.apply(box.ViewObject.RootNode)
paths = sa.getPaths()
bind = paths.get(2).getTail()
bind = paths.get(1).getTail()
self.assertEqual(bind.value.getValue(), bind.PER_PART)
sa = coin.SoSearchAction()
@@ -120,7 +120,7 @@ class ColorPerFaceTest(unittest.TestCase):
sa.apply(box.ViewObject.RootNode)
paths = sa.getPaths()
mat = paths.get(2).getTail()
mat = paths.get(1).getTail()
self.assertEqual(mat.diffuseColor.getNum(), 6)
def testMultiFuse(self):
@@ -146,7 +146,7 @@ class ColorPerFaceTest(unittest.TestCase):
sa.apply(fuse.ViewObject.RootNode)
paths = sa.getPaths()
bind = paths.get(2).getTail()
bind = paths.get(1).getTail()
self.assertEqual(bind.value.getValue(), bind.PER_PART)
sa = coin.SoSearchAction()
@@ -156,7 +156,7 @@ class ColorPerFaceTest(unittest.TestCase):
sa.apply(fuse.ViewObject.RootNode)
paths = sa.getPaths()
mat = paths.get(2).getTail()
mat = paths.get(1).getTail()
self.assertEqual(mat.diffuseColor.getNum(), 11)
self.assertEqual(len(fuse.Shape.Faces), 11)
@@ -195,7 +195,7 @@ class ColorPerFaceTest(unittest.TestCase):
sa.apply(fuse.ViewObject.RootNode)
paths = sa.getPaths()
bind = paths.get(2).getTail()
bind = paths.get(1).getTail()
self.assertEqual(bind.value.getValue(), bind.PER_PART)
sa = coin.SoSearchAction()
@@ -205,5 +205,5 @@ class ColorPerFaceTest(unittest.TestCase):
sa.apply(fuse.ViewObject.RootNode)
paths = sa.getPaths()
mat = paths.get(2).getTail()
mat = paths.get(1).getTail()
self.assertEqual(mat.diffuseColor.getNum(), 11)