Core/Gui: Render primitives on top of the scene in PickGeometry

+ added some better grouping for items, which are assigned per object
  right now. For example, if we exceed 10 items per object it gets an
  additional group.

Co-authored-by: realthunder <realthunder@users.noreply.github.com>
This commit is contained in:
tetektoza
2025-06-25 11:28:25 +02:00
parent 59b234028f
commit c856c9ea01
17 changed files with 614 additions and 91 deletions

View File

@@ -44,10 +44,18 @@
# include <Inventor/elements/SoLineWidthElement.h>
# include <Inventor/errors/SoDebugError.h>
# include <Inventor/misc/SoState.h>
# include <Inventor/nodes/SoGroup.h>
# include <Inventor/actions/SoSearchAction.h>
#endif
#include <Gui/Selection/SoFCUnifiedSelection.h>
#include <Gui/Selection/Selection.h>
#include <Base/Console.h>
#include "SoBrepEdgeSet.h"
#include "SoBrepFaceSet.h"
#include "ViewProviderExt.h"
#include <Gui/Inventor/So3DAnnotation.h>
using namespace PartGui;
@@ -79,6 +87,20 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action)
SelContextPtr ctx = Gui::SoFCSelectionRoot::getRenderContext<SelContext>(this,selContext,ctx2);
if(ctx2 && ctx2->selectionIndex.empty())
return;
if (Gui::Selection()
.isPickGeometryActive() && !Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths
&& ((ctx && !ctx->hl.empty()) || viewProvider->isFaceHighlightActive())) {
// if we are using pickgeometry - add this to delayed paths with priority
// as we want to get this rendered on top of everything
viewProvider->setFaceHighlightActive(true);
Gui::SoDelayedAnnotationsElement::addDelayedPath(action->getState(),
action->getCurPath()->copy(),
200);
return;
}
if(selContext2->checkGlobal(ctx)) {
if(selContext2->isSelectAll()) {
selContext2->sl.clear();
@@ -132,9 +154,23 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action)
}
if(ctx2 && !ctx2->selectionIndex.empty())
renderSelection(action,ctx2,false);
else
else if (Gui::Selection().isPickGeometryActive()
&& ((ctx && !ctx->hl.empty()) || viewProvider->isFaceHighlightActive())
&& Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths) {
state->push();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(false);
glDisable(GL_DEPTH_TEST);
inherited::GLRender(action);
state->pop();
}
else {
inherited::GLRender(action);
}
// Workaround for #0000433
//#if !defined(FC_OS_WIN32)
if(!action->isRenderingDelayedPaths())