Part/Gui: Rename Pick Geometry tool to Clarify Selection
Co-authored-by: realthunder <realthunder@users.noreply.github.com>
This commit is contained in:
@@ -3957,25 +3957,25 @@ bool StdCmdAlignToSelection::isActive()
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_PickGeometry
|
||||
// Std_ClarifySelection
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(StdCmdPickGeometry)
|
||||
DEF_STD_CMD_A(StdCmdClarifySelection)
|
||||
|
||||
StdCmdPickGeometry::StdCmdPickGeometry()
|
||||
: Command("Std_PickGeometry")
|
||||
StdCmdClarifySelection::StdCmdClarifySelection()
|
||||
: Command("Std_ClarifySelection")
|
||||
{
|
||||
sGroup = "View";
|
||||
sMenuText = QT_TR_NOOP("Pick geometry");
|
||||
sToolTipText = QT_TR_NOOP("Pick hidden geometries under the mouse cursor in 3D view.\n"
|
||||
"This command is supposed to be activated by keyboard shortcut.");
|
||||
sWhatsThis = "Std_PickGeometry";
|
||||
sMenuText = QT_TR_NOOP("Clarify Selection");
|
||||
sToolTipText = QT_TR_NOOP("Displays a context menu at the mouse cursor to select overlapping "
|
||||
"or obstructed geometry in the 3D view.\n");
|
||||
sWhatsThis = "Std_ClarifySelection";
|
||||
sStatusTip = sToolTipText;
|
||||
sAccel = "G, G";
|
||||
eType = NoTransaction | AlterSelection;
|
||||
}
|
||||
|
||||
void StdCmdPickGeometry::activated(int iMsg)
|
||||
void StdCmdClarifySelection::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
@@ -4066,7 +4066,7 @@ void StdCmdPickGeometry::activated(int iMsg)
|
||||
contextMenu.doPick(selections);
|
||||
}
|
||||
|
||||
bool StdCmdPickGeometry::isActive()
|
||||
bool StdCmdClarifySelection::isActive()
|
||||
{
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
return view != nullptr;
|
||||
@@ -4104,7 +4104,7 @@ void CreateViewStdCommands()
|
||||
rcCmdMgr.addCommand(new StdRecallWorkingView());
|
||||
rcCmdMgr.addCommand(new StdCmdViewGroup());
|
||||
rcCmdMgr.addCommand(new StdCmdAlignToSelection());
|
||||
rcCmdMgr.addCommand(new StdCmdPickGeometry());
|
||||
rcCmdMgr.addCommand(new StdCmdClarifySelection());
|
||||
|
||||
rcCmdMgr.addCommand(new StdCmdViewExample1());
|
||||
rcCmdMgr.addCommand(new StdCmdViewExample2());
|
||||
|
||||
@@ -1974,7 +1974,7 @@ void NavigationStyle::openPopupMenu(const SbVec2s& position)
|
||||
item->setChecked(true);
|
||||
}
|
||||
|
||||
// Add Pick Geometry option if there are objects under cursor
|
||||
// Add Clarify Selection option if there are objects under cursor
|
||||
bool separator = false;
|
||||
auto posAction = !contextMenu->actions().empty() ? contextMenu->actions().front() : nullptr;
|
||||
|
||||
@@ -1990,12 +1990,12 @@ void NavigationStyle::openPopupMenu(const SbVec2s& position)
|
||||
|
||||
if (pplist.getLength() > 0) {
|
||||
separator = true;
|
||||
auto cmd = Application::Instance->commandManager().getCommandByName("Std_PickGeometry");
|
||||
auto cmd = Application::Instance->commandManager().getCommandByName("Std_ClarifySelection");
|
||||
if (cmd) {
|
||||
pickAction = new QAction(cmd->getAction()->text(), contextMenu);
|
||||
pickAction->setShortcut(cmd->getAction()->shortcut());
|
||||
} else {
|
||||
pickAction = new QAction(QObject::tr("Pick geometry"), contextMenu);
|
||||
pickAction = new QAction(QObject::tr("Clarify Selection"), contextMenu);
|
||||
}
|
||||
if (posAction) {
|
||||
contextMenu->insertAction(posAction, pickAction);
|
||||
@@ -2026,8 +2026,8 @@ void NavigationStyle::openPopupMenu(const SbVec2s& position)
|
||||
}
|
||||
|
||||
if (pickAction && used == pickAction) {
|
||||
// Execute the Pick Geometry command at this position
|
||||
auto cmd = Application::Instance->commandManager().getCommandByName("Std_PickGeometry");
|
||||
// Execute the Clarify Selection command at this position
|
||||
auto cmd = Application::Instance->commandManager().getCommandByName("Std_ClarifySelection");
|
||||
if (cmd && cmd->isActive()) {
|
||||
cmd->invoke(0);
|
||||
}
|
||||
|
||||
@@ -2605,12 +2605,12 @@ PyObject *SelectionSingleton::sGetSelectionFromStack(PyObject * /*self*/, PyObje
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
bool SelectionSingleton::pickGeometryActive = false;
|
||||
bool SelectionSingleton::clarifySelectionActive = false;
|
||||
|
||||
bool SelectionSingleton::isPickGeometryActive() {
|
||||
return pickGeometryActive;
|
||||
bool SelectionSingleton::isClarifySelectionActive() {
|
||||
return clarifySelectionActive;
|
||||
}
|
||||
|
||||
void SelectionSingleton::setPickGeometryActive(bool active) {
|
||||
pickGeometryActive = active;
|
||||
void SelectionSingleton::setClarifySelectionActive(bool active) {
|
||||
clarifySelectionActive = active;
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ private:
|
||||
class GuiExport SelectionSingleton : public Base::Subject<const SelectionChanges&>
|
||||
{
|
||||
public:
|
||||
static bool pickGeometryActive;
|
||||
static bool clarifySelectionActive;
|
||||
|
||||
struct SelObj {
|
||||
const char* DocName;
|
||||
@@ -411,8 +411,8 @@ public:
|
||||
*/
|
||||
void setVisible(VisibleState visible);
|
||||
|
||||
static bool isPickGeometryActive();
|
||||
static void setPickGeometryActive(bool active);
|
||||
static bool isClarifySelectionActive();
|
||||
static void setClarifySelectionActive(bool active);
|
||||
|
||||
/// signal on new object
|
||||
boost::signals2::signal<void (const SelectionChanges& msg)> signalSelectionChanged;
|
||||
|
||||
@@ -731,7 +731,7 @@ struct SubMenuInfo {
|
||||
PickData SelectionMenu::doPick(const std::vector<PickData> &sels)
|
||||
{
|
||||
clear();
|
||||
Gui::Selection().setPickGeometryActive(true);
|
||||
Gui::Selection().setClarifySelectionActive(true);
|
||||
|
||||
std::vector<PickData> selsCopy = sels;
|
||||
currentSelections = &selsCopy;
|
||||
@@ -822,8 +822,8 @@ void SelectionMenu::buildMenuStructure(std::map<std::string, SubMenuInfo> &menus
|
||||
|
||||
PickData SelectionMenu::onPicked(QAction *picked, const std::vector<PickData> &sels)
|
||||
{
|
||||
// Clear the PickGeometry active flag when menu is done
|
||||
Gui::Selection().setPickGeometryActive(false);
|
||||
// Clear the ClarifySelection active flag when menu is done
|
||||
Gui::Selection().setClarifySelectionActive(false);
|
||||
|
||||
Gui::Selection().rmvPreselect();
|
||||
if (!picked)
|
||||
|
||||
@@ -237,15 +237,15 @@ public:
|
||||
longPressTimer->setInterval(1000); // after 1s of LMB press on viewport it gets toggled
|
||||
connect(longPressTimer, &QTimer::timeout, [this]() {
|
||||
if (currentViewer) {
|
||||
triggerPickGeometry();
|
||||
triggerClarifySelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
~ViewerEventFilter() override = default;
|
||||
|
||||
private:
|
||||
void triggerPickGeometry() {
|
||||
Gui::Command::runCommand(Gui::Command::Gui, "Gui.runCommand('Std_PickGeometry')");
|
||||
void triggerClarifySelection() {
|
||||
Gui::Command::runCommand(Gui::Command::Gui, "Gui.runCommand('Std_ClarifySelection')");
|
||||
}
|
||||
|
||||
QTimer* longPressTimer;
|
||||
@@ -2520,7 +2520,7 @@ void View3DInventorViewer::renderScene()
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// process delayed paths with priority support
|
||||
if (Gui::Selection().isPickGeometryActive()) {
|
||||
if (Gui::Selection().isClarifySelectionActive()) {
|
||||
Gui::SoDelayedAnnotationsElement::processDelayedPathsWithPriority(state, glra);
|
||||
} else {
|
||||
// standard processing for normal delayed annotations
|
||||
|
||||
@@ -738,7 +738,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
<< "Std_ProjectUtil"
|
||||
<< "Std_DlgParameter"
|
||||
<< "Std_DlgCustomize"
|
||||
<< "Std_PickGeometry";
|
||||
<< "Std_ClarifySelection";
|
||||
|
||||
// Macro
|
||||
auto macro = new MenuItem( menuBar );
|
||||
|
||||
@@ -90,9 +90,9 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action)
|
||||
|
||||
|
||||
if (Gui::Selection()
|
||||
.isPickGeometryActive() && !Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths
|
||||
.isClarifySelectionActive() && !Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths
|
||||
&& ((ctx && !ctx->hl.empty()) || viewProvider->isFaceHighlightActive())) {
|
||||
// if we are using pickgeometry - add this to delayed paths with priority
|
||||
// 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);
|
||||
Gui::SoDelayedAnnotationsElement::addDelayedPath(action->getState(),
|
||||
@@ -154,7 +154,7 @@ void SoBrepEdgeSet::GLRender(SoGLRenderAction *action)
|
||||
}
|
||||
if(ctx2 && !ctx2->selectionIndex.empty())
|
||||
renderSelection(action,ctx2,false);
|
||||
else if (Gui::Selection().isPickGeometryActive()
|
||||
else if (Gui::Selection().isClarifySelectionActive()
|
||||
&& ((ctx && !ctx->hl.empty()) || viewProvider->isFaceHighlightActive())
|
||||
&& Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths) {
|
||||
state->push();
|
||||
|
||||
@@ -533,7 +533,7 @@ void SoBrepFaceSet::GLRender(SoGLRenderAction *action)
|
||||
selCounter.checkRenderCache(state);
|
||||
|
||||
// for the tool add this node to delayed paths as we want to render it on top of the scene
|
||||
if (Gui::Selection().isPickGeometryActive() && ctx && ctx->isHighlighted()
|
||||
if (Gui::Selection().isClarifySelectionActive() && ctx && ctx->isHighlighted()
|
||||
&& !ctx->isHighlightAll() && ctx->highlightIndex >= 0
|
||||
&& ctx->highlightIndex < partIndex.getNum()) {
|
||||
|
||||
|
||||
@@ -84,9 +84,9 @@ void SoBrepPointSet::GLRender(SoGLRenderAction *action)
|
||||
if(selContext2->checkGlobal(ctx))
|
||||
ctx = selContext2;
|
||||
|
||||
// for pickgeometry, add this node to delayed path if it is highlighted and render it on
|
||||
// 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().isPickGeometryActive() && ctx && ctx->isHighlighted()
|
||||
if (Gui::Selection().isClarifySelectionActive() && ctx && ctx->isHighlighted()
|
||||
&& !ctx->isHighlightAll() && ctx->highlightIndex >= 0
|
||||
&& !Gui::SoDelayedAnnotationsElement::isProcessingDelayedPaths) {
|
||||
viewProvider->setFaceHighlightActive(true);
|
||||
|
||||
Reference in New Issue
Block a user