Merge pull request #19420 from tritao/gui-selection-refactor

Gui: Selection code cleanups
This commit is contained in:
Chris Hennes
2025-02-10 10:56:23 -06:00
committed by GitHub
18 changed files with 227 additions and 257 deletions

View File

@@ -57,7 +57,7 @@ long NavlibInterface::GetSelectionTransform(navlib::matrix_t&) const
long NavlibInterface::GetIsSelectionEmpty(navlib::bool_t& empty) const
{
empty = !Gui::SelectionSingleton::instance().hasSelection();
empty = !Gui::Selection().hasSelection();
return 0;
}

View File

@@ -49,9 +49,13 @@ namespace Gui
{
enum class ResolveMode {
/// No resolve
NoResolve,
/// Sub-object with old style element name
OldStyleElement,
/// Sub-object with new style element name
NewStyleElement,
/// Resolve sub-object and follow link
FollowLink
};
@@ -201,9 +205,6 @@ public:
*
* @param attach: whether to attach this observer on construction
* @param resolve: sub-object resolving mode.
* 0 no resolve,
* 1 resolve sub-object with old style element name
* 2 resolve sub-object with new style element name
*/
explicit SelectionObserver(bool attach = true, ResolveMode resolve = ResolveMode::OldStyleElement);
/** Constructor
@@ -211,9 +212,6 @@ public:
* @param vp: filtering view object.
* @param attach: whether to attach this observer on construction
* @param resolve: sub-object resolving mode.
* 0 no resolve,
* 1 resolve sub-object with old style element name
* 2 resolve sub-object with new style element name
*
* Constructs an selection observer that receives only selection event of
* objects within the same document as the input view object.
@@ -426,9 +424,6 @@ public:
* empty vector is returned. If document name is "*", then all document is
* considered.
* @param resolve: sub-object resolving mode
* 0 no resolve,
* 1 resolve sub-object with old style element name
* 2 resolve sub-object with new style element name
* @param single: if set to true, then it will return an empty vector if
* there is more than one selections.
*
@@ -443,9 +438,6 @@ public:
* considered.
* @param typeId: specify the type of object to be returned.
* @param resolve: sub-object resolving mode.
* 0 no resolve,
* 1 resolve sub-object with old style element name
* 2 resolve sub-object with new style element name
* @param single: if set to true, then it will return an empty vector if
* there is more than one selection.
*
@@ -523,9 +515,6 @@ public:
* @param pDocName: optional filtering document, NULL for current active
* document
* @param resolve: sub-object resolving mode.
* 0 no resolve,
* 1 resolve sub-object with old style element name
* 2 resolve sub-object with new style element name
* @param index: optional position in the stack
*/
std::vector<Gui::SelectionObject> selStackGet(const char* pDocName=nullptr, ResolveMode resolve = ResolveMode::OldStyleElement, int index=0) const;

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);
@@ -216,19 +216,19 @@ void SoFCSelection::doAction(SoAction *action)
if(!useNewSelection.getValue()) {
if (action->getTypeId() == SoFCEnableHighlightAction::getClassTypeId()) {
auto preaction = static_cast<SoFCEnableHighlightAction*>(action);
if (preaction->highlight) {
this->highlightMode = SoFCSelection::AUTO;
if (action->getTypeId() == SoFCEnablePreselectionAction::getClassTypeId()) {
auto preaction = static_cast<SoFCEnablePreselectionAction*>(action);
if (preaction->enabled) {
this->preselectionMode = SoFCSelection::AUTO;
}
else {
this->highlightMode = SoFCSelection::OFF;
this->preselectionMode = SoFCSelection::OFF;
}
}
if (action->getTypeId() == SoFCEnableSelectionAction::getClassTypeId()) {
auto selaction = static_cast<SoFCEnableSelectionAction*>(action);
if (selaction->selection) {
if (selaction->enabled) {
this->selectionMode = SoFCSelection::SEL_ON;
}
else {
@@ -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

@@ -69,7 +69,7 @@
using namespace Gui;
SO_ACTION_SOURCE(SoFCHighlightAction)
SO_ACTION_SOURCE(SoFCPreselectionAction)
/**
* The order of the defined SO_ACTION_ADD_METHOD statements is very important. First the base
@@ -79,28 +79,28 @@ SO_ACTION_SOURCE(SoFCHighlightAction)
* This means that \c SoSwitch must be listed after \c SoGroup and \c SoFCSelection after
* \c SoSeparator because both classes inherits the others.
*/
void SoFCHighlightAction::initClass()
void SoFCPreselectionAction::initClass()
{
SO_ACTION_INIT_CLASS(SoFCHighlightAction,SoAction);
SO_ACTION_INIT_CLASS(SoFCPreselectionAction,SoAction);
SO_ENABLE(SoFCHighlightAction, SoSwitchElement);
SO_ENABLE(SoFCPreselectionAction, SoSwitchElement);
SO_ACTION_ADD_METHOD(SoNode,nullAction);
SO_ENABLE(SoFCHighlightAction, SoModelMatrixElement);
SO_ENABLE(SoFCHighlightAction, SoShapeStyleElement);
SO_ENABLE(SoFCHighlightAction, SoComplexityElement);
SO_ENABLE(SoFCHighlightAction, SoComplexityTypeElement);
SO_ENABLE(SoFCHighlightAction, SoCoordinateElement);
SO_ENABLE(SoFCHighlightAction, SoFontNameElement);
SO_ENABLE(SoFCHighlightAction, SoFontSizeElement);
SO_ENABLE(SoFCHighlightAction, SoProfileCoordinateElement);
SO_ENABLE(SoFCHighlightAction, SoProfileElement);
SO_ENABLE(SoFCHighlightAction, SoSwitchElement);
SO_ENABLE(SoFCHighlightAction, SoUnitsElement);
SO_ENABLE(SoFCHighlightAction, SoViewVolumeElement);
SO_ENABLE(SoFCHighlightAction, SoViewingMatrixElement);
SO_ENABLE(SoFCHighlightAction, SoViewportRegionElement);
SO_ENABLE(SoFCPreselectionAction, SoModelMatrixElement);
SO_ENABLE(SoFCPreselectionAction, SoShapeStyleElement);
SO_ENABLE(SoFCPreselectionAction, SoComplexityElement);
SO_ENABLE(SoFCPreselectionAction, SoComplexityTypeElement);
SO_ENABLE(SoFCPreselectionAction, SoCoordinateElement);
SO_ENABLE(SoFCPreselectionAction, SoFontNameElement);
SO_ENABLE(SoFCPreselectionAction, SoFontSizeElement);
SO_ENABLE(SoFCPreselectionAction, SoProfileCoordinateElement);
SO_ENABLE(SoFCPreselectionAction, SoProfileElement);
SO_ENABLE(SoFCPreselectionAction, SoSwitchElement);
SO_ENABLE(SoFCPreselectionAction, SoUnitsElement);
SO_ENABLE(SoFCPreselectionAction, SoViewVolumeElement);
SO_ENABLE(SoFCPreselectionAction, SoViewingMatrixElement);
SO_ENABLE(SoFCPreselectionAction, SoViewportRegionElement);
@@ -125,28 +125,28 @@ void SoFCHighlightAction::initClass()
SO_ACTION_ADD_METHOD(SoPointSet,callDoAction);
}
void SoFCHighlightAction::finish()
void SoFCPreselectionAction::finish()
{
atexit_cleanup();
}
SoFCHighlightAction::SoFCHighlightAction (const SelectionChanges &SelCh)
SoFCPreselectionAction::SoFCPreselectionAction (const SelectionChanges &SelCh)
:SelChange(SelCh)
{
SO_ACTION_CONSTRUCTOR(SoFCHighlightAction);
SO_ACTION_CONSTRUCTOR(SoFCPreselectionAction);
}
SoFCHighlightAction::~SoFCHighlightAction() = default;
SoFCPreselectionAction::~SoFCPreselectionAction() = default;
void SoFCHighlightAction::beginTraversal(SoNode *node)
void SoFCPreselectionAction::beginTraversal(SoNode *node)
{
traverse(node);
}
void SoFCHighlightAction::callDoAction(SoAction *action,SoNode *node)
void SoFCPreselectionAction::callDoAction(SoAction *action,SoNode *node)
{
node->doAction(action);
}
@@ -296,7 +296,7 @@ void SoFCEnableSelectionAction::finish()
SoFCEnableSelectionAction::SoFCEnableSelectionAction (const SbBool& sel)
: selection(sel)
: enabled(sel)
{
SO_ACTION_CONSTRUCTOR(SoFCEnableSelectionAction);
}
@@ -317,7 +317,7 @@ void SoFCEnableSelectionAction::callDoAction(SoAction *action,SoNode *node)
// ---------------------------------------------------------------
SO_ACTION_SOURCE(SoFCEnableHighlightAction)
SO_ACTION_SOURCE(SoFCEnablePreselectionAction)
/**
* The order of the defined SO_ACTION_ADD_METHOD statements is very important. First the base
@@ -327,28 +327,28 @@ SO_ACTION_SOURCE(SoFCEnableHighlightAction)
* This means that \c SoSwitch must be listed after \c SoGroup and \c SoFCSelection after
* \c SoSeparator because both classes inherits the others.
*/
void SoFCEnableHighlightAction::initClass()
void SoFCEnablePreselectionAction::initClass()
{
SO_ACTION_INIT_CLASS(SoFCEnableHighlightAction,SoAction);
SO_ACTION_INIT_CLASS(SoFCEnablePreselectionAction,SoAction);
SO_ENABLE(SoFCEnableHighlightAction, SoSwitchElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoSwitchElement);
SO_ACTION_ADD_METHOD(SoNode,nullAction);
SO_ENABLE(SoFCEnableHighlightAction, SoModelMatrixElement);
SO_ENABLE(SoFCEnableHighlightAction, SoShapeStyleElement);
SO_ENABLE(SoFCEnableHighlightAction, SoComplexityElement);
SO_ENABLE(SoFCEnableHighlightAction, SoComplexityTypeElement);
SO_ENABLE(SoFCEnableHighlightAction, SoCoordinateElement);
SO_ENABLE(SoFCEnableHighlightAction, SoFontNameElement);
SO_ENABLE(SoFCEnableHighlightAction, SoFontSizeElement);
SO_ENABLE(SoFCEnableHighlightAction, SoProfileCoordinateElement);
SO_ENABLE(SoFCEnableHighlightAction, SoProfileElement);
SO_ENABLE(SoFCEnableHighlightAction, SoSwitchElement);
SO_ENABLE(SoFCEnableHighlightAction, SoUnitsElement);
SO_ENABLE(SoFCEnableHighlightAction, SoViewVolumeElement);
SO_ENABLE(SoFCEnableHighlightAction, SoViewingMatrixElement);
SO_ENABLE(SoFCEnableHighlightAction, SoViewportRegionElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoModelMatrixElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoShapeStyleElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoComplexityElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoComplexityTypeElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoCoordinateElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoFontNameElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoFontSizeElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoProfileCoordinateElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoProfileElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoSwitchElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoUnitsElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoViewVolumeElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoViewingMatrixElement);
SO_ENABLE(SoFCEnablePreselectionAction, SoViewportRegionElement);
@@ -369,28 +369,28 @@ void SoFCEnableHighlightAction::initClass()
SO_ACTION_ADD_METHOD(SoFCSelection,callDoAction);
}
void SoFCEnableHighlightAction::finish()
void SoFCEnablePreselectionAction::finish()
{
atexit_cleanup();
}
SoFCEnableHighlightAction::SoFCEnableHighlightAction (const SbBool& sel)
: highlight(sel)
SoFCEnablePreselectionAction::SoFCEnablePreselectionAction (const SbBool& sel)
: enabled(sel)
{
SO_ACTION_CONSTRUCTOR(SoFCEnableHighlightAction);
SO_ACTION_CONSTRUCTOR(SoFCEnablePreselectionAction);
}
SoFCEnableHighlightAction::~SoFCEnableHighlightAction() = default;
SoFCEnablePreselectionAction::~SoFCEnablePreselectionAction() = default;
void SoFCEnableHighlightAction::beginTraversal(SoNode *node)
void SoFCEnablePreselectionAction::beginTraversal(SoNode *node)
{
traverse(node);
}
void SoFCEnableHighlightAction::callDoAction(SoAction *action,SoNode *node)
void SoFCEnablePreselectionAction::callDoAction(SoAction *action,SoNode *node)
{
node->doAction(action);
}

View File

@@ -38,17 +38,17 @@ namespace Gui {
class SelectionChanges;
/**
* The SoFCHighlightAction class is used to inform an SoFCSelection node
* whether an object gets highlighted.
* The SoFCPreselectionAction class is used to inform an SoFCSelection node
* whether an object gets preselected.
* @author Jürgen Riegel
*/
class GuiExport SoFCHighlightAction : public SoAction
class GuiExport SoFCPreselectionAction : public SoAction
{
SO_ACTION_HEADER(SoFCHighlightAction);
SO_ACTION_HEADER(SoFCPreselectionAction);
public:
SoFCHighlightAction (const SelectionChanges &SelCh);
~SoFCHighlightAction() override;
SoFCPreselectionAction (const SelectionChanges &SelCh);
~SoFCPreselectionAction() override;
static void initClass();
static void finish();
@@ -100,7 +100,7 @@ public:
SoFCEnableSelectionAction (const SbBool& sel);
~SoFCEnableSelectionAction() override;
SbBool selection;
SbBool enabled;
static void initClass();
static void finish();
@@ -113,19 +113,19 @@ private:
};
/**
* The SoFCEnableHighlightAction class is used to inform an SoFCSelection node
* The SoFCEnablePreselectionAction class is used to inform an SoFCSelection node
* whether preselection is enabled or disabled.
* @author Werner Mayer
*/
class GuiExport SoFCEnableHighlightAction : public SoAction
class GuiExport SoFCEnablePreselectionAction : public SoAction
{
SO_ACTION_HEADER(SoFCEnableHighlightAction);
SO_ACTION_HEADER(SoFCEnablePreselectionAction);
public:
SoFCEnableHighlightAction (const SbBool& sel);
~SoFCEnableHighlightAction() override;
SoFCEnablePreselectionAction (const SbBool& sel);
~SoFCEnablePreselectionAction() override;
SbBool highlight;
SbBool enabled;
static void initClass();
static void finish();
@@ -164,7 +164,7 @@ private:
/**
* The SoFCHighlightColorAction class is used to inform an SoFCSelection node
* which preselection color is used.
* which highlight color is used.
* @author Werner Mayer
*/
class GuiExport SoFCHighlightColorAction : public SoAction

View File

@@ -100,7 +100,7 @@ void printPreselectionInfo(const char* documentName,
double precision);
}
SoFullPath * Gui::SoFCUnifiedSelection::currenthighlight = nullptr;
SoFullPath * Gui::SoFCUnifiedSelection::currentHighlightPath = nullptr;
// *************************************************************************
@@ -113,17 +113,17 @@ SoFCUnifiedSelection::SoFCUnifiedSelection()
{
SO_NODE_CONSTRUCTOR(SoFCUnifiedSelection);
SO_NODE_ADD_FIELD(colorHighlight, (SbColor(1.0f, 0.6f, 0.0f)));
SO_NODE_ADD_FIELD(colorSelection, (SbColor(0.1f, 0.8f, 0.1f)));
SO_NODE_ADD_FIELD(highlightMode, (AUTO));
SO_NODE_ADD_FIELD(selectionMode, (ON));
SO_NODE_ADD_FIELD(selectionRole, (true));
SO_NODE_ADD_FIELD(useNewSelection, (true));
SO_NODE_ADD_FIELD(colorHighlight, (SbColor(1.0f, 0.6f, 0.0f)));
SO_NODE_ADD_FIELD(colorSelection, (SbColor(0.1f, 0.8f, 0.1f)));
SO_NODE_ADD_FIELD(preselectionMode, (AUTO));
SO_NODE_ADD_FIELD(selectionMode, (ON));
SO_NODE_ADD_FIELD(selectionEnabled, (true));
SO_NODE_ADD_FIELD(useNewSelection, (true));
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);
// Documentation of SoFullPath:
// Since the SoFullPath is derived from SoPath and contains no private data, you can cast SoPath instances to the SoFullPath type.
@@ -144,9 +144,9 @@ SoFCUnifiedSelection::~SoFCUnifiedSelection()
{
// If we're being deleted and we're the current highlight,
// NULL out that variable
if (currenthighlight) {
currenthighlight->unref();
currenthighlight = nullptr;
if (currentHighlightPath) {
currentHighlightPath->unref();
currentHighlightPath = nullptr;
}
if (detailPath) {
detailPath->unref();
@@ -167,17 +167,16 @@ void SoFCUnifiedSelection::finish()
}
bool SoFCUnifiedSelection::hasHighlight() {
return currenthighlight != nullptr;
return currentHighlightPath != nullptr;
}
void SoFCUnifiedSelection::applySettings()
{
float transparency;
ParameterGrp::handle hGrp = Gui::WindowParameter::getDefaultParameter()->GetGroup("View");
bool enablePre = hGrp->GetBool("EnablePreselection", true);
bool enableSel = hGrp->GetBool("EnableSelection", true);
if (!enablePre) {
this->highlightMode = SoFCUnifiedSelection::OFF;
bool enablePreselection = hGrp->GetBool("EnablePreselection", true);
if (!enablePreselection) {
this->preselectionMode = SoFCUnifiedSelection::OFF;
}
else {
// Search for a user defined value with the current color as default
@@ -188,7 +187,8 @@ void SoFCUnifiedSelection::applySettings()
this->colorHighlight.setValue(highlightColor);
}
if (!enableSel) {
bool enableSelection = hGrp->GetBool("EnableSelection", true);
if (!enableSelection) {
this->selectionMode = SoFCUnifiedSelection::OFF;
}
else {
@@ -312,19 +312,19 @@ SoFCUnifiedSelection::getPickedList(SoHandleEventAction* action, bool singlePick
void SoFCUnifiedSelection::doAction(SoAction *action)
{
if (action->getTypeId() == SoFCEnableHighlightAction::getClassTypeId()) {
auto preaction = static_cast<SoFCEnableHighlightAction*>(action);
if (preaction->highlight) {
this->highlightMode = SoFCUnifiedSelection::AUTO;
if (action->getTypeId() == SoFCEnablePreselectionAction::getClassTypeId()) {
auto enablePreselectionAction = static_cast<SoFCEnablePreselectionAction*>(action);
if (enablePreselectionAction->enabled) {
this->preselectionMode = SoFCUnifiedSelection::AUTO;
}
else {
this->highlightMode = SoFCUnifiedSelection::OFF;
this->preselectionMode = SoFCUnifiedSelection::OFF;
}
}
if (action->getTypeId() == SoFCEnableSelectionAction::getClassTypeId()) {
auto selaction = static_cast<SoFCEnableSelectionAction*>(action);
if (selaction->selection) {
auto enableSelectionAction = static_cast<SoFCEnableSelectionAction*>(action);
if (enableSelectionAction->enabled) {
this->selectionMode = SoFCUnifiedSelection::ON;
}
else {
@@ -333,52 +333,52 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
}
if (action->getTypeId() == SoFCSelectionColorAction::getClassTypeId()) {
auto colaction = static_cast<SoFCSelectionColorAction*>(action);
this->colorSelection = colaction->selectionColor;
auto selectionColorAction = static_cast<SoFCSelectionColorAction*>(action);
this->colorSelection = selectionColorAction->selectionColor;
}
if (action->getTypeId() == SoFCHighlightColorAction::getClassTypeId()) {
auto colaction = static_cast<SoFCHighlightColorAction*>(action);
this->colorHighlight = colaction->highlightColor;
auto highlightColorAction = static_cast<SoFCHighlightColorAction*>(action);
this->colorHighlight = highlightColorAction->highlightColor;
}
if (action->getTypeId() == SoFCHighlightAction::getClassTypeId()) {
auto hilaction = static_cast<SoFCHighlightAction*>(action);
// Do not clear currently highlighted object when setting new pre-selection
if (!setPreSelection && hilaction->SelChange.Type == SelectionChanges::RmvPreselect) {
if (currenthighlight) {
SoHighlightElementAction hlAction;
hlAction.apply(currenthighlight);
currenthighlight->unref();
currenthighlight = nullptr;
if (action->getTypeId() == SoFCPreselectionAction::getClassTypeId()) {
auto preselectAction = static_cast<SoFCPreselectionAction*>(action);
// Do not clear currently preselected object when setting new pre-selection
if (!setPreSelection && preselectAction->SelChange.Type == SelectionChanges::RmvPreselect) {
if (currentHighlightPath) {
SoHighlightElementAction highlightAction;
highlightAction.apply(currentHighlightPath);
currentHighlightPath->unref();
currentHighlightPath = nullptr;
}
}
else if (highlightMode.getValue() != OFF
&& hilaction->SelChange.Type == SelectionChanges::SetPreselect) {
if (currenthighlight) {
SoHighlightElementAction hlAction;
hlAction.apply(currenthighlight);
currenthighlight->unref();
currenthighlight = nullptr;
else if (preselectionMode.getValue() != OFF
&& preselectAction->SelChange.Type == SelectionChanges::SetPreselect) {
if (currentHighlightPath) {
SoHighlightElementAction highlightAction;
highlightAction.apply(currentHighlightPath);
currentHighlightPath->unref();
currentHighlightPath = nullptr;
}
App::Document* doc = App::GetApplication().getDocument(hilaction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(hilaction->SelChange.pObjectName);
App::Document* doc = App::GetApplication().getDocument(preselectAction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(preselectAction->SelChange.pObjectName);
ViewProvider*vp = Application::Instance->getViewProvider(obj);
SoDetail* detail = vp->getDetail(hilaction->SelChange.pSubName);
SoDetail* detail = vp->getDetail(preselectAction->SelChange.pSubName);
SoHighlightElementAction hlAction;
hlAction.setHighlighted(true);
hlAction.setColor(this->colorHighlight.getValue());
hlAction.setElement(detail);
hlAction.apply(vp->getRoot());
SoHighlightElementAction highlightAction;
highlightAction.setHighlighted(true);
highlightAction.setColor(this->colorHighlight.getValue());
highlightAction.setElement(detail);
highlightAction.apply(vp->getRoot());
delete detail;
SoSearchAction sa;
sa.setNode(vp->getRoot());
sa.apply(vp->getRoot());
currenthighlight = static_cast<SoFullPath*>(sa.getPath()->copy());
currenthighlight->ref();
currentHighlightPath = static_cast<SoFullPath*>(sa.getPath()->copy());
currentHighlightPath->ref();
}
if (useNewSelection.getValue())
@@ -386,30 +386,30 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
}
if (action->getTypeId() == SoFCSelectionAction::getClassTypeId()) {
auto selaction = static_cast<SoFCSelectionAction*>(action);
auto selectionAction = static_cast<SoFCSelectionAction*>(action);
if(selectionMode.getValue() == ON
&& (selaction->SelChange.Type == SelectionChanges::AddSelection
|| selaction->SelChange.Type == SelectionChanges::RmvSelection))
&& (selectionAction->SelChange.Type == SelectionChanges::AddSelection
|| selectionAction->SelChange.Type == SelectionChanges::RmvSelection))
{
// selection changes inside the 3d view are handled in handleEvent()
App::Document* doc = App::GetApplication().getDocument(selaction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(selaction->SelChange.pObjectName);
App::Document* doc = App::GetApplication().getDocument(selectionAction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(selectionAction->SelChange.pObjectName);
ViewProvider*vp = Application::Instance->getViewProvider(obj);
if (vp && (useNewSelection.getValue()||vp->useNewSelectionModel()) && vp->isSelectable()) {
SoDetail *detail = nullptr;
detailPath->truncate(0);
auto subName = selaction->SelChange.pSubName;
auto subName = selectionAction->SelChange.pSubName;
App::ElementNamePair elementName;;
App::GeoFeature::resolveElement(obj, subName, elementName);
if (Data::isMappedElement(subName)
&& !elementName.oldName.empty()) { // If we have a shortened element name
subName = elementName.oldName.c_str(); // use it.
}
if(!selaction->SelChange.pSubName || !selaction->SelChange.pSubName[0] ||
if(!selectionAction->SelChange.pSubName || !selectionAction->SelChange.pSubName[0] ||
vp->getDetailPath(subName,detailPath,true,detail))
{
SoSelectionElementAction::Type type = SoSelectionElementAction::None;
if (selaction->SelChange.Type == SelectionChanges::AddSelection) {
if (selectionAction->SelChange.Type == SelectionChanges::AddSelection) {
if (detail)
type = SoSelectionElementAction::Append;
else
@@ -434,13 +434,13 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
delete detail;
}
}
else if (selaction->SelChange.Type == SelectionChanges::ClrSelection) {
else if (selectionAction->SelChange.Type == SelectionChanges::ClrSelection) {
SoSelectionElementAction selectionAction(SoSelectionElementAction::None);
for(int i=0;i<this->getNumChildren();++i)
selectionAction.apply(this->getChild(i));
}
else if(selectionMode.getValue() == ON
&& selaction->SelChange.Type == SelectionChanges::SetSelection) {
&& selectionAction->SelChange.Type == SelectionChanges::SetSelection) {
std::vector<ViewProvider*> vps;
if (this->pcDocument)
vps = this->pcDocument->getViewProvidersOfType(ViewProviderDocumentObject::getClassTypeId());
@@ -459,22 +459,22 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
}
}
}
else if (selaction->SelChange.Type == SelectionChanges::SetPreselectSignal) {
else if (selectionAction->SelChange.Type == SelectionChanges::SetPreselectSignal) {
// selection changes inside the 3d view are handled in handleEvent()
App::Document* doc = App::GetApplication().getDocument(selaction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(selaction->SelChange.pObjectName);
App::Document* doc = App::GetApplication().getDocument(selectionAction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(selectionAction->SelChange.pObjectName);
ViewProvider*vp = Application::Instance->getViewProvider(obj);
if (vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId()) &&
(useNewSelection.getValue()||vp->useNewSelectionModel()) && vp->isSelectable())
{
detailPath->truncate(0);
SoDetail *det = nullptr;
if(vp->getDetailPath(selaction->SelChange.pSubName,detailPath,true,det)) {
setHighlight(detailPath,det,static_cast<ViewProviderDocumentObject*>(vp),
selaction->SelChange.pSubName,
selaction->SelChange.x,
selaction->SelChange.y,
selaction->SelChange.z);
if(vp->getDetailPath(selectionAction->SelChange.pSubName,detailPath,true,det)) {
setPreselect(detailPath,det,static_cast<ViewProviderDocumentObject*>(vp),
selectionAction->SelChange.pSubName,
selectionAction->SelChange.x,
selectionAction->SelChange.y,
selectionAction->SelChange.z);
}
delete det;
}
@@ -487,15 +487,16 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
inherited::doAction( action );
}
bool SoFCUnifiedSelection::setHighlight(const PickedInfo &info) {
bool SoFCUnifiedSelection::setPreselect(const PickedInfo &info) {
if(!info.pp)
return setHighlight(nullptr,nullptr,nullptr,nullptr,0.0,0.0,0.0);
return setPreselect(nullptr,nullptr,nullptr,nullptr,0.0,0.0,0.0);
const auto &pt = info.pp->getPoint();
return setHighlight(static_cast<SoFullPath*>(info.pp->getPath()),
return setPreselect(static_cast<SoFullPath*>(info.pp->getPath()),
info.pp->getDetail(), info.vpd, info.element.c_str(), pt[0],pt[1],pt[2]);
}
bool SoFCUnifiedSelection::setHighlight(SoFullPath *path, const SoDetail *det,
bool SoFCUnifiedSelection::setPreselect(SoFullPath *path, const SoDetail *det,
ViewProviderDocumentObject *vpd, const char *element, float x, float y, float z)
{
Base::FlagToggler<SbBool> flag(setPreSelection);
@@ -513,32 +514,32 @@ bool SoFCUnifiedSelection::setHighlight(SoFullPath *path, const SoDetail *det,
int ret = Gui::Selection().setPreselect(docname,objname,element,x,y,z);
if(ret<0 && currenthighlight)
if(ret<0 && currentHighlightPath)
return true;
if(ret) {
if (currenthighlight) {
if (currentHighlightPath) {
SoHighlightElementAction action;
action.setHighlighted(false);
action.apply(currenthighlight);
currenthighlight->unref();
currenthighlight = nullptr;
action.apply(currentHighlightPath);
currentHighlightPath->unref();
currentHighlightPath = nullptr;
}
currenthighlight = static_cast<SoFullPath*>(path->copy());
currenthighlight->ref();
currentHighlightPath = static_cast<SoFullPath*>(path->copy());
currentHighlightPath->ref();
highlighted = true;
}
}
if(currenthighlight) {
if(currentHighlightPath) {
SoHighlightElementAction action;
action.setHighlighted(highlighted);
action.setColor(this->colorHighlight.getValue());
action.setElement(det);
action.apply(currenthighlight);
action.apply(currentHighlightPath);
if(!highlighted) {
currenthighlight->unref();
currenthighlight = nullptr;
currentHighlightPath->unref();
currentHighlightPath = nullptr;
Selection().rmvPreselect();
}
this->touch();
@@ -597,7 +598,7 @@ bool SoFCUnifiedSelection::setSelection(const std::vector<PickedInfo> &infos, bo
auto pPath = static_cast<SoFullPath *>(pp->getPath());
const auto &pt = pp->getPoint();
SoSelectionElementAction::Type type = SoSelectionElementAction::None;
auto mymode = static_cast<HighlightModes>(this->highlightMode.getValue());
auto preselectionMode = static_cast<SelectionModes>(this->preselectionMode.getValue());
static char buf[513];
auto subName = info.element;
std::string objectName = objname;
@@ -618,7 +619,7 @@ bool SoFCUnifiedSelection::setSelection(const std::vector<PickedInfo> &infos, bo
return false;
}
if (ok && mymode == OFF) {
if (ok && preselectionMode == OFF) {
snprintf(buf, 512, "Selected: %s.%s.%s (%g, %g, %g)",
docname, objname, info.element.c_str(), fabs(pt[0]) > 1e-7 ? pt[0] : 0.0,
fabs(pt[1]) > 1e-7 ? pt[1] : 0.0, fabs(pt[2]) > 1e-7 ? pt[2] : 0.0);
@@ -701,7 +702,7 @@ bool SoFCUnifiedSelection::setSelection(const std::vector<PickedInfo> &infos, bo
if (ok)
type = hasNext ? SoSelectionElementAction::All : SoSelectionElementAction::Append;
if (mymode == OFF) {
if (preselectionMode == OFF) {
snprintf(buf, 512, "Selected: %s.%s.%s (%g, %g, %g)",
docname, objectName.c_str(), subName.c_str(), fabs(pt[0]) > 1e-7 ? pt[0] : 0.0,
fabs(pt[1]) > 1e-7 ? pt[1] : 0.0, fabs(pt[2]) > 1e-7 ? pt[2] : 0.0);
@@ -729,38 +730,29 @@ void
SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action)
{
// If off then don't handle this event
if (!selectionRole.getValue()) {
if (!selectionEnabled.getValue()) {
inherited::handleEvent(action);
return;
}
auto mymode = static_cast<HighlightModes>(this->highlightMode.getValue());
auto preselectionMode = static_cast<SelectionModes>(this->preselectionMode.getValue());
const SoEvent * event = action->getEvent();
// If we don't need to pick for locate highlighting,
// then just behave as separator and return.
// NOTE: we still have to pick for ON even though we don't have
// to re-render, because the app needs to be notified as the mouse
// goes over locate highlight nodes.
//if (highlightMode.getValue() == OFF) {
// inherited::handleEvent( action );
// return;
//}
//
// If this is a mouseMotion event, then check for locate highlighting
// If this is a mouseMotion event, then check for preselected entities.
//
if (event->isOfType(SoLocation2Event::getClassTypeId())) {
bool isMouseMotionEvent = event->isOfType(SoLocation2Event::getClassTypeId());
if (isMouseMotionEvent) {
// NOTE: If preselection is off then we do not check for a picked point because otherwise this search may slow
// down extremely the system on really big data sets. In this case we just check for a picked point if the data
// set has been selected.
if (mymode == AUTO || mymode == ON) {
if (preselectionMode == AUTO || preselectionMode == ON) {
// check to see if the mouse is over our geometry...
auto infos = this->getPickedList(action,true);
if(!infos.empty())
setHighlight(infos[0]);
setPreselect(infos[0]);
else {
setHighlight(PickedInfo());
setPreselect(PickedInfo());
if (this->preSelection > 0) {
this->preSelection = 0;
// touch() makes sure to call GLRenderBelowPath so that the cursor can be updated
@@ -1652,9 +1644,9 @@ bool SoFCSelectionRoot::doActionPrivate(Stack &stack, SoAction *action) {
}
if(action->isOfType(SoHighlightElementAction::getClassTypeId())) {
auto hlAction = static_cast<SoHighlightElementAction*>(action);
if(hlAction->isHighlighted()) {
if(hlAction->getElement()) {
auto highlightAction = static_cast<SoHighlightElementAction*>(action);
if(highlightAction->isHighlighted()) {
if(highlightAction->getElement()) {
auto ctx = getActionContext(action,this,SelContextPtr(),false);
if(ctx && ctx->hlAll) {
ctx->hlAll = false;
@@ -1664,7 +1656,7 @@ bool SoFCSelectionRoot::doActionPrivate(Stack &stack, SoAction *action) {
auto ctx = getActionContext(action,this,SelContextPtr());
assert(ctx);
ctx->hlAll = true;
ctx->hlColor = hlAction->getColor();
ctx->hlColor = highlightAction->getColor();
touch();
return false;
}

View File

@@ -50,7 +50,7 @@ class ViewProviderDocumentObject;
/** Unified Selection node
* This is the new selection node for the 3D Viewer which will
* gradually remove all the low level selection nodes in the view
* provider. The handling of the highlighting and the selection will
* provider. The handling of the preselection and the selection will
* be unified here.
* \author Jürgen Riegel
*/
@@ -65,7 +65,7 @@ public:
SoFCUnifiedSelection();
void applySettings();
enum HighlightModes {
enum SelectionModes {
AUTO, ON, OFF
};
@@ -74,18 +74,15 @@ public:
SoSFColor colorHighlight;
SoSFColor colorSelection;
SoSFEnum highlightMode;
SoSFEnum preselectionMode;
SoSFEnum selectionMode;
SoSFBool selectionRole;
SoSFBool selectionEnabled;
SoSFBool useNewSelection;
void doAction(SoAction *action) override;
//virtual void GLRender(SoGLRenderAction * action);
void handleEvent(SoHandleEventAction * action) override;
void GLRenderBelowPath(SoGLRenderAction * action) override;
//virtual void GLRenderInPath(SoGLRenderAction * action);
//static void turnOffCurrentHighlight(SoGLRenderAction * action);
static bool hasHighlight();
@@ -93,14 +90,8 @@ public:
protected:
~SoFCUnifiedSelection() override;
//virtual void redrawHighlighted(SoAction * act, SbBool flag);
//virtual SbBool readInstance(SoInput * in, unsigned short flags);
private:
//static void turnoffcurrent(SoAction * action);
//void setOverride(SoGLRenderAction * action);
//SbBool isHighlighted(SoAction *action);
//SbBool preRender(SoGLRenderAction *act, GLint &oldDepthFunc);
static int getPriority(const SoPickedPoint* p);
struct PickedInfo {
@@ -109,8 +100,8 @@ private:
std::string element;
};
bool setHighlight(const PickedInfo &);
bool setHighlight(SoFullPath *path, const SoDetail *det,
bool setPreselect(const PickedInfo &);
bool setPreselect(SoFullPath *path, const SoDetail *det,
ViewProviderDocumentObject *vpd, const char *element, float x, float y, float z);
bool setSelection(const std::vector<PickedInfo> &, bool ctrlDown=false);
@@ -118,7 +109,7 @@ private:
Gui::Document *pcDocument{nullptr};
static SoFullPath * currenthighlight;
static SoFullPath * currentHighlightPath;
SoFullPath * detailPath;
SbBool setPreSelection;

View File

@@ -107,13 +107,13 @@ void Gui::SoFCDB::init()
SoFCBoundingBox ::initClass();
SoFCSelection ::initClass();
SoFCUnifiedSelection ::initClass();
SoFCHighlightAction ::initClass();
SoFCPreselectionAction ::initClass();
SoFCSelectionAction ::initClass();
SoFCDocumentAction ::initClass();
SoGLWidgetNode ::initClass();
SoGLVBOActivatedElement ::initClass();
SoFCEnableSelectionAction ::initClass();
SoFCEnableHighlightAction ::initClass();
SoFCEnablePreselectionAction ::initClass();
SoFCSelectionColorAction ::initClass();
SoFCHighlightColorAction ::initClass();
SoFCDocumentObjectAction ::initClass();
@@ -226,12 +226,12 @@ void Gui::SoFCDB::finish()
SoFCBackgroundGradient ::finish();
SoFCBoundingBox ::finish();
SoFCSelection ::finish();
SoFCHighlightAction ::finish();
SoFCPreselectionAction ::finish();
SoFCSelectionAction ::finish();
SoFCDocumentAction ::finish();
SoFCDocumentObjectAction ::finish();
SoFCEnableSelectionAction ::finish();
SoFCEnableHighlightAction ::finish();
SoFCEnablePreselectionAction ::finish();
SoFCSelectionColorAction ::finish();
SoUpdateVBOAction ::finish();
SoFCHighlightColorAction ::finish();

View File

@@ -792,11 +792,11 @@ void View3DInventorViewer::onSelectionChanged(const SelectionChanges & reason)
{
//Hint: do not create a tmp. instance of SelectionChanges
SelectionChanges selChanges(SelectionChanges::RmvPreselect);
SoFCHighlightAction cAct(selChanges);
cAct.apply(pcViewProviderRoot);
SoFCPreselectionAction preselectionAction(selChanges);
preselectionAction.apply(pcViewProviderRoot);
} else {
SoFCSelectionAction cAct(Reason);
cAct.apply(pcViewProviderRoot);
SoFCSelectionAction selectionAction(Reason);
selectionAction.apply(pcViewProviderRoot);
}
}
/// @endcond
@@ -1801,14 +1801,12 @@ const std::vector<SbVec2s>& View3DInventorViewer::getPolygon(SelectionRole* role
void View3DInventorViewer::setSelectionEnabled(bool enable)
{
SoNode* root = getSceneGraph();
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(enable); // NOLINT
this->selectionRoot->selectionEnabled.setValue(enable); // NOLINT
}
bool View3DInventorViewer::isSelectionEnabled() const
{
SoNode* root = getSceneGraph();
return static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.getValue(); // NOLINT
return this->selectionRoot->selectionEnabled.getValue(); // NOLINT
}
SbVec2f View3DInventorViewer::screenCoordsOfPath(SoPath* path) const

View File

@@ -185,7 +185,7 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
}
else if (strcmp(Reason,"EnablePreselection") == 0) {
const ParameterGrp& rclGrp = ((ParameterGrp&)rCaller);
SoFCEnableHighlightAction cAct(rclGrp.GetBool("EnablePreselection", true));
SoFCEnablePreselectionAction cAct(rclGrp.GetBool("EnablePreselection", true));
for (auto _viewer : _viewers) {
cAct.apply(_viewer->getSceneGraph());
}

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();

View File

@@ -913,8 +913,8 @@ void execComplexSection(Gui::Command* cmd)
std::vector<App::DocumentObject*> xShapes;
App::DocumentObject* profileObject(nullptr);
std::vector<std::string> profileSubs;
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement;//mystery
bool single = false; //mystery
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement;
bool single = false;
auto selection = cmd->getSelection().getSelectionEx(
nullptr, App::DocumentObject::getClassTypeId(), resolve, single);
for (auto& sel : selection) {
@@ -1069,8 +1069,8 @@ void CmdTechDrawProjectionGroup::activated(int iMsg)
std::vector<App::DocumentObject*> xShapes;
App::DocumentObject* partObj = nullptr;
std::string faceName;
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement;//mystery
bool single = false; //mystery
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement;
bool single = false;
auto selection = getSelection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(),
resolve, single);
for (auto& sel : selection) {
@@ -1970,8 +1970,8 @@ void getSelectedShapes(Gui::Command* cmd,
App::DocumentObject* faceObj,
std::string& faceName)
{
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement;//mystery
bool single = false; //mystery
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement;
bool single = false;
auto selection = cmd->getSelection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(),
resolve, single);
for (auto& sel : selection) {

View File

@@ -137,8 +137,8 @@ void CommandHelpers::getSelectedShapes(Gui::Command* cmd,
App::DocumentObject* faceObj,
std::string& faceName)
{
Gui::ResolveMode resolve = Gui::ResolveMode::OldStyleElement;//mystery
bool single = false; //mystery
auto resolve = Gui::ResolveMode::OldStyleElement;
bool single = false;
auto selection = cmd->getSelection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(),
resolve, single);
for (auto& sel : selection) {