Gui: Change SoFCSelection from highlight to preselection terminology.

This commit is contained in:
tritao
2025-01-15 12:20:22 +00:00
parent cb9e166a20
commit 4843377790
7 changed files with 21 additions and 21 deletions

View File

@@ -79,7 +79,7 @@ SoFCSelection::SoFCSelection()
SO_NODE_ADD_FIELD(colorHighlight, (SbColor(0.8f, 0.1f, 0.1f)));
SO_NODE_ADD_FIELD(colorSelection, (SbColor(0.1f, 0.8f, 0.1f)));
SO_NODE_ADD_FIELD(style, (EMISSIVE));
SO_NODE_ADD_FIELD(highlightMode, (AUTO));
SO_NODE_ADD_FIELD(preselectionMode, (AUTO));
SO_NODE_ADD_FIELD(selectionMode, (SEL_ON));
SO_NODE_ADD_FIELD(selected, (NOTSELECTED));
SO_NODE_ADD_FIELD(documentName, (""));
@@ -92,10 +92,10 @@ SoFCSelection::SoFCSelection()
SO_NODE_DEFINE_ENUM_VALUE(Styles, BOX);
SO_NODE_SET_SF_ENUM_TYPE(style, Styles);
SO_NODE_DEFINE_ENUM_VALUE(HighlightModes, AUTO);
SO_NODE_DEFINE_ENUM_VALUE(HighlightModes, ON);
SO_NODE_DEFINE_ENUM_VALUE(HighlightModes, OFF);
SO_NODE_SET_SF_ENUM_TYPE (highlightMode, HighlightModes);
SO_NODE_DEFINE_ENUM_VALUE(PreselectionModes, AUTO);
SO_NODE_DEFINE_ENUM_VALUE(PreselectionModes, ON);
SO_NODE_DEFINE_ENUM_VALUE(PreselectionModes, OFF);
SO_NODE_SET_SF_ENUM_TYPE (preselectionMode, PreselectionModes);
SO_NODE_DEFINE_ENUM_VALUE(SelectionModes, SEL_ON);
SO_NODE_DEFINE_ENUM_VALUE(SelectionModes, SEL_OFF);
@@ -219,10 +219,10 @@ void SoFCSelection::doAction(SoAction *action)
if (action->getTypeId() == SoFCEnableHighlightAction::getClassTypeId()) {
auto preaction = static_cast<SoFCEnableHighlightAction*>(action);
if (preaction->highlight) {
this->highlightMode = SoFCSelection::AUTO;
this->preselectionMode = SoFCSelection::AUTO;
}
else {
this->highlightMode = SoFCSelection::OFF;
this->preselectionMode = SoFCSelection::OFF;
}
}
@@ -359,7 +359,7 @@ SoFCSelection::handleEvent(SoHandleEventAction * action)
}
static char buf[513];
auto mymode = static_cast<HighlightModes>(this->highlightMode.getValue());
auto mymode = static_cast<PreselectionModes>(this->preselectionMode.getValue());
const SoEvent * event = action->getEvent();
#ifdef NO_FRONTBUFFER
// mouse move events for preselection
@@ -777,7 +777,7 @@ SoFCSelection::preRender(SoGLRenderAction *action, GLint &oldDepthFunc)
////////////////////////////////////////////////////////////////////////
{
// If not performing locate highlighting, just return.
if (highlightMode.getValue() == OFF)
if (preselectionMode.getValue() == OFF)
return false;
SoState *state = action->getState();
@@ -787,7 +787,7 @@ SoFCSelection::preRender(SoGLRenderAction *action, GLint &oldDepthFunc)
// ??? never be called. We are not caching this node correctly yet....
//SoCacheElement::invalidate(state);
SbBool drawHighlighted = (highlightMode.getValue() == ON || isHighlighted(action) || selected.getValue() == SELECTED);
SbBool drawHighlighted = (preselectionMode.getValue() == ON || isHighlighted(action) || selected.getValue() == SELECTED);
if (drawHighlighted) {
// prevent diffuse & emissive color from leaking out...
@@ -930,7 +930,7 @@ SoFCSelection::readInstance ( SoInput * in, unsigned short flags )
bool
SoFCSelection::setOverride(SoGLRenderAction * action, SelContextPtr ctx)
{
auto mymode = static_cast<HighlightModes>(this->highlightMode.getValue());
auto mymode = static_cast<PreselectionModes>(this->preselectionMode.getValue());
bool preselected = ctx && ctx->isHighlighted() && (useNewSelection.getValue()||mymode == AUTO);
if (!preselected && mymode!=ON && (!ctx || !ctx->isSelected()))
return false;
@@ -1040,7 +1040,7 @@ void SoFCSelection::applySettings ()
bool enablePre = hGrp->GetBool("EnablePreselection", true);
bool enableSel = hGrp->GetBool("EnableSelection", true);
if (!enablePre) {
this->highlightMode = Gui::SoFCSelection::OFF;
this->preselectionMode = Gui::SoFCSelection::OFF;
}
else {
// Search for a user defined value with the current color as default

View File

@@ -69,7 +69,7 @@ public:
/// Load highlight settings from the configuration
void applySettings ();
enum HighlightModes {
enum PreselectionModes {
AUTO, ON, OFF
};
@@ -91,7 +91,7 @@ public:
SoSFColor colorSelection;
SoSFEnum style;
SoSFEnum selected;
SoSFEnum highlightMode;
SoSFEnum preselectionMode;
SoSFEnum selectionMode;
SoSFString documentName;

View File

@@ -63,7 +63,7 @@ Gui::SoFCSelection* ViewProviderBuilder::createSelection()
bool enablePre = hGrp->GetBool("EnablePreselection", true);
bool enableSel = hGrp->GetBool("EnableSelection", true);
if (!enablePre) {
sel->highlightMode = Gui::SoFCSelection::OFF;
sel->preselectionMode = Gui::SoFCSelection::OFF;
}
else {
// Search for a user defined value with the current color as default

View File

@@ -347,13 +347,13 @@ void ViewProviderGeometryObject::setSelectable(bool selectable)
if (selectable) {
if (selNode) {
selNode->selectionMode = SoFCSelection::SEL_ON;
selNode->highlightMode = SoFCSelection::AUTO;
selNode->preselectionMode = SoFCSelection::AUTO;
}
}
else {
if (selNode) {
selNode->selectionMode = SoFCSelection::SEL_OFF;
selNode->highlightMode = SoFCSelection::OFF;
selNode->preselectionMode = SoFCSelection::OFF;
selNode->selected = SoFCSelection::NOTSELECTED;
}
}

View File

@@ -59,7 +59,7 @@ PROPERTY_SOURCE(Gui::ViewProviderVRMLObject, Gui::ViewProviderDocumentObject)
ViewProviderVRMLObject::ViewProviderVRMLObject()
{
pcVRML = new SoFCSelection();
pcVRML->highlightMode = Gui::SoFCSelection::OFF;
pcVRML->preselectionMode = Gui::SoFCSelection::OFF;
pcVRML->selectionMode = Gui::SoFCSelection::SEL_OFF;
//pcVRML->style = Gui::SoFCSelection::BOX;
pcVRML->ref();

View File

@@ -53,13 +53,13 @@ ViewProviderRobotObject::ViewProviderRobotObject()
ADD_PROPERTY(Manipulator, (0));
pcRobotRoot = new Gui::SoFCSelection();
pcRobotRoot->highlightMode = Gui::SoFCSelection::OFF;
pcRobotRoot->preselectionMode = Gui::SoFCSelection::OFF;
// pcRobotRoot->selectionMode = Gui::SoFCSelection::SEL_OFF;
// pcRobotRoot->style = Gui::SoFCSelection::BOX;
pcRobotRoot->ref();
pcSimpleRoot = new Gui::SoFCSelection();
pcSimpleRoot->highlightMode = Gui::SoFCSelection::OFF;
pcSimpleRoot->preselectionMode = Gui::SoFCSelection::OFF;
// pcSimpleRoot->selectionMode = Gui::SoFCSelection::SEL_OFF;
pcSimpleRoot->ref();

View File

@@ -52,7 +52,7 @@ ViewProviderTrajectory::ViewProviderTrajectory()
{
pcTrajectoryRoot = new Gui::SoFCSelection();
pcTrajectoryRoot->highlightMode = Gui::SoFCSelection::OFF;
pcTrajectoryRoot->preselectionMode = Gui::SoFCSelection::OFF;
pcTrajectoryRoot->selectionMode = Gui::SoFCSelection::SEL_OFF;
// pcRobotRoot->style = Gui::SoFCSelection::BOX;
pcTrajectoryRoot->ref();