diff --git a/src/Gui/PreferencePages/DlgSettings3DView.ui b/src/Gui/PreferencePages/DlgSettings3DView.ui
index 6ea088f2d2..0fe9aed47a 100644
--- a/src/Gui/PreferencePages/DlgSettings3DView.ui
+++ b/src/Gui/PreferencePages/DlgSettings3DView.ui
@@ -7,7 +7,7 @@
0
0
499
- 600
+ 708
@@ -137,25 +137,25 @@ in the corner in % of height/width of the viewport
-
- AxisXColor
-
-
- View
-
-
+
204
51
51
+
+ AxisXColor
+
+
+ View
+
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -177,25 +177,25 @@ in the corner in % of height/width of the viewport
-
- AxisYColor
-
-
- View
-
-
+
51
204
51
+
+ AxisYColor
+
+
+ View
+
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -217,19 +217,19 @@ in the corner in % of height/width of the viewport
-
- AxisZColor
-
-
- View
-
-
+
51
51
204
+
+ AxisZColor
+
+
+ View
+
@@ -324,75 +324,20 @@ report this setting as enabled when seeking support.
-
-
-
-
-
-
- 120
- 0
-
-
-
- Method of multisample anti-aliasing
-
-
-
- -
-
-
-
-
+
-
+
- Marker size
+ Render cache
- -
-
+
-
+
- Anti-aliasing
+ Eye to eye distance for stereo modes
- -
-
-
-
-
-
- Transparent objects
-
-
-
- -
-
-
-
- 120
- 0
-
-
-
- Render types of transparent objects
-
-
- TransparentObjectRenderType
-
-
- View
-
-
-
-
- One pass
-
-
- -
-
- Backface pass
-
-
-
-
-
@@ -430,22 +375,8 @@ but slower response to any scene changes.
- -
-
-
- Render cache
-
-
-
- -
-
-
- Eye to eye distance for stereo modes
-
-
-
- -
-
+
-
+
120
@@ -453,11 +384,18 @@ but slower response to any scene changes.
- Size of vertices in the Sketcher, TechDraw and other workbenches
+ Method of multisample anti-aliasing
- -
+
-
+
+
+ Anti-aliasing
+
+
+
+ -
@@ -493,6 +431,117 @@ bounding box size of the 3D object that is currently displayed.
+ -
+
+
+
+ 120
+ 0
+
+
+
+ Render types of transparent objects
+
+
+ TransparentObjectRenderType
+
+
+ View
+
+
-
+
+ One pass
+
+
+ -
+
+ Backface pass
+
+
+
+
+ -
+
+
+
+
+
+ Transparent objects
+
+
+
+ -
+
+
+
+
+
+ Marker size
+
+
+
+ -
+
+
+
+ 120
+ 0
+
+
+
+ Size of vertices in the Sketcher, TechDraw and other workbenches
+
+
+
+ -
+
+
+
+
+
+ Datum size
+
+
+
+ -
+
+
+
+ 120
+ 0
+
+
+
+ Eye-to-eye distance used for stereo projections.
+The specified value is a factor that will be multiplied with the
+bounding box size of the 3D object that is currently displayed.
+
+
+ %
+
+
+ 0
+
+
+ 0.000000000000000
+
+
+ 400.000000000000000
+
+
+ 5.000000000000000
+
+
+ 100.000000000000000
+
+
+ DatumScale
+
+
+ View
+
+
+
diff --git a/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp b/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp
index cd4d069ef5..38051f4b81 100644
--- a/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp
+++ b/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp
@@ -69,6 +69,7 @@ void DlgSettings3DViewImp::saveSettings()
ui->CheckBox_use_SW_OpenGL->onSave();
ui->CheckBox_useVBO->onSave();
ui->FloatSpinBox_EyeDistance->onSave();
+ ui->FloatSpinBox_DatumScale->onSave();
ui->axisLetterColor->onSave();
ui->radioPerspective->onSave();
ui->radioOrthographic->onSave();
@@ -86,6 +87,7 @@ void DlgSettings3DViewImp::loadSettings()
ui->CheckBox_use_SW_OpenGL->onRestore();
ui->CheckBox_useVBO->onRestore();
ui->FloatSpinBox_EyeDistance->onRestore();
+ ui->FloatSpinBox_DatumScale->onRestore();
ui->axisLetterColor->onRestore();
ui->radioPerspective->onRestore();
ui->radioOrthographic->onRestore();
diff --git a/src/Gui/ViewParams.h b/src/Gui/ViewParams.h
index 04ef455b1e..faf266e932 100644
--- a/src/Gui/ViewParams.h
+++ b/src/Gui/ViewParams.h
@@ -70,7 +70,10 @@ public:
FC_VIEW_PARAM(NeutralColor,unsigned long,Unsigned,0xB3B38000) \
FC_VIEW_PARAM(PlacementIndicatorScale,double,Float,40.0) \
FC_VIEW_PARAM(DraggerScale,double,Float,0.03) \
-
+ FC_VIEW_PARAM(DatumScale,double,Float,100.0) \
+ FC_VIEW_PARAM(DatumPlaneSize,double,Float,62.0) \
+ FC_VIEW_PARAM(DatumLineSize,double,Float,70.0) \
+ FC_VIEW_PARAM(DatumTemporaryScaleFactor,double,Float,2.0) \
#undef FC_VIEW_PARAM
#define FC_VIEW_PARAM(_name,_ctype,_type,_def) \
diff --git a/src/Gui/ViewProviderLine.cpp b/src/Gui/ViewProviderLine.cpp
index 33fc82721b..82111780a0 100644
--- a/src/Gui/ViewProviderLine.cpp
+++ b/src/Gui/ViewProviderLine.cpp
@@ -32,6 +32,7 @@
# include
#endif
+#include
#include
#include
#include
@@ -39,6 +40,8 @@
#include "ViewProviderLine.h"
#include "ViewProviderCoordinateSystem.h"
+#include
+
using namespace Gui;
@@ -49,7 +52,14 @@ ViewProviderLine::ViewProviderLine()
{
sPixmap = "Std_Axis";
- pLabel = new SoText2();
+ pLabel = new SoFrameLabel();
+ pLabel->textColor.setValue(1.0, 1.0, 1.0);
+ pLabel->horAlignment = SoImage::CENTER;
+ pLabel->vertAlignment = SoImage::HALF;
+ pLabel->border = false;
+ pLabel->frame = false;
+ pLabel->textUseBaseColor = true;
+ pLabel->size = 8; // NOLINT
}
ViewProviderLine::~ViewProviderLine() = default;
@@ -58,6 +68,39 @@ void ViewProviderLine::attach(App::DocumentObject *obj)
{
ViewProviderDatum::attach(obj);
+ // indexes used to create the edges
+ static const int32_t lines[4] = { 0, 1, -1 };
+
+ SoSeparator *sep = getDatumRoot();
+
+ pCoords = new SoCoordinate3();
+ sep->addChild(pCoords);
+
+ auto pLines = new SoIndexedLineSet();
+ pLines->coordIndex.setNum(3);
+ pLines->coordIndex.setValues(0, 3, lines);
+ sep->addChild(pLines);
+
+ pLabelTranslation = new SoTranslation();
+ sep->addChild(pLabelTranslation);
+
+ auto ps = new SoPickStyle();
+ ps->style.setValue(SoPickStyle::SHAPE_ON_TOP);
+ sep->addChild(ps);
+
+ sep->addChild(pLabel);
+
+ handlers.addDelayedHandler(
+ ViewParams::instance()->getHandle(),
+ {"DatumLineSize", "DatumScale"},
+ [this](const ParameterGrp::handle&) { updateLineSize(); }
+ );
+
+ updateLineSize();
+}
+
+void ViewProviderLine::updateLineSize()
+{
// Setup label text and line colors
const char* name = pcObject->getNameInDocument();
@@ -82,11 +125,13 @@ void ViewProviderLine::attach(App::DocumentObject *obj)
noRole = true;
}
- static const float size = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetFloat("DatumLineSize", 70.0);
+ const auto params = ViewParams::instance();
+ const float size = params->getDatumLineSize() * Base::fromPercent(params->getDatumScale());
auto line = getObject();
Base::Vector3d dir = line->getBaseDirection();
SbVec3f verts[2];
+
if (noRole) {
verts[0] = Base::convertTo(dir * 2 * size);
verts[1] = SbVec3f(0, 0, 0);
@@ -96,28 +141,8 @@ void ViewProviderLine::attach(App::DocumentObject *obj)
verts[1] = Base::convertTo(dir * 0.2 * size);
}
- // indexes used to create the edges
- static const int32_t lines[4] = { 0, 1, -1 };
+ pCoords->point.setNum(2);
+ pCoords->point.setValues(0, 2, verts);
- SoSeparator *sep = getDatumRoot();
-
- auto pCoords = new SoCoordinate3 ();
- pCoords->point.setNum (2);
- pCoords->point.setValues ( 0, 2, verts );
- sep->addChild ( pCoords );
-
- auto pLines = new SoIndexedLineSet ();
- pLines->coordIndex.setNum(3);
- pLines->coordIndex.setValues(0, 3, lines);
- sep->addChild ( pLines );
-
- auto textTranslation = new SoTranslation ();
- textTranslation->translation.setValue(Base::convertTo(dir * 1.1 * size));
- sep->addChild ( textTranslation );
-
- auto ps = new SoPickStyle();
- ps->style.setValue(SoPickStyle::SHAPE_ON_TOP);
- sep->addChild(ps);
-
- sep->addChild (pLabel);
+ pLabelTranslation->translation.setValue(Base::convertTo(dir * 1.2 * size));
}
diff --git a/src/Gui/ViewProviderLine.h b/src/Gui/ViewProviderLine.h
index 614299c304..658abc6479 100644
--- a/src/Gui/ViewProviderLine.h
+++ b/src/Gui/ViewProviderLine.h
@@ -27,22 +27,38 @@
#include "ViewProviderDatum.h"
-class SoText2;
+#include "ParamHandler.h"
+
+class SoCoordinate3;
+class SoTranslation;
+
+namespace Gui
+{
+class SoFrameLabel;
+}
namespace Gui
{
class GuiExport ViewProviderLine : public ViewProviderDatum {
PROPERTY_HEADER_WITH_OVERRIDE(Gui::ViewProviderLine);
+
public:
/// Constructor
ViewProviderLine();
~ViewProviderLine() override;
- void attach ( App::DocumentObject * ) override;
+ void attach(App::DocumentObject*) override;
+
+private:
+ void updateLineSize();
protected:
- CoinPtr pLabel;
+ CoinPtr pLabel;
+ CoinPtr pCoords;
+ CoinPtr pLabelTranslation;
+
+ ParamHandlers handlers;
};
} //namespace Gui
diff --git a/src/Gui/ViewProviderPlane.cpp b/src/Gui/ViewProviderPlane.cpp
index cfae77f73c..9b68a79c59 100644
--- a/src/Gui/ViewProviderPlane.cpp
+++ b/src/Gui/ViewProviderPlane.cpp
@@ -43,13 +43,19 @@
#include "ViewProviderPlane.h"
#include "ViewProviderCoordinateSystem.h"
+#include
+#include
+#include
+#include
+#include
+
using namespace Gui;
PROPERTY_SOURCE(Gui::ViewProviderPlane, Gui::ViewProviderDatum)
-ViewProviderPlane::ViewProviderPlane()
+ViewProviderPlane::ViewProviderPlane() : SelectionObserver(true)
{
sPixmap = "Std_Plane";
lineThickness = 1.0;
@@ -72,37 +78,23 @@ void ViewProviderPlane::attach(App::DocumentObject * obj) {
// and faceSeparator...
//ShapeAppearance.setTransparency(0.8);
auto material = new SoMaterial();
- material->transparency.setValue(0.95f);
+ material->transparency.setValue(0.85f);
+
if (!role.empty()) {
ShapeAppearance.setDiffuseColor(getColor(role));
- SbColor color;
- float alpha = 0.0f;
- color.setPackedValue(getColor(role), alpha);
- material->ambientColor.setValue(color);
- material->diffuseColor.setValue(color);
}
- static const float size = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetFloat("DatumPlaneSize", 40.0);
- static const float startSize = 0.25 * size; //NOLINT
+ SbColor color = ShapeAppearance.getDiffuseColor().asValue();
+ material->ambientColor.setValue(color);
+ material->diffuseColor.setValue(color);
- SbVec3f verts[4];
- if (role.empty()) {
- verts[0] = SbVec3f(size, size, 0);
- verts[1] = SbVec3f(size, -size, 0);
- verts[2] = SbVec3f(-size, -size, 0);
- verts[3] = SbVec3f(-size, size, 0);
- }
- else {
- verts[0] = SbVec3f(size, size, 0);
- verts[1] = SbVec3f(size, startSize, 0);
- verts[2] = SbVec3f(startSize, startSize, 0);
- verts[3] = SbVec3f(startSize, size, 0);
- }
+ auto ps = new SoPickStyle();
+ ps->style.setValue(SoPickStyle::SHAPE_ON_TOP);
- auto pCoords = new SoCoordinate3();
- pCoords->point.setNum(4);
- pCoords->point.setValues(0, 4, verts);
+ pCoords = new SoCoordinate3();
sep->addChild(pCoords);
+ sep->addChild(material);
+ sep->addChild(ps);
auto lineSeparator = new SoSeparator();
auto pLines = new SoIndexedLineSet();
@@ -110,9 +102,6 @@ void ViewProviderPlane::attach(App::DocumentObject * obj) {
pLines->coordIndex.setNum(6);
pLines->coordIndex.setValues(0, 6, lines);
- auto ps = new SoPickStyle();
- ps->style.setValue(SoPickStyle::SHAPE_ON_TOP);
- lineSeparator->addChild(ps);
lineSeparator->addChild(pLines);
sep->addChild(lineSeparator);
@@ -120,8 +109,6 @@ void ViewProviderPlane::attach(App::DocumentObject * obj) {
auto faceSeparator = new SoSeparator();
sep->addChild(faceSeparator);
- faceSeparator->addChild(material);
-
// disable backface culling and render with two-sided lighting
auto shapeHints = new SoShapeHints();
shapeHints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
@@ -130,21 +117,42 @@ void ViewProviderPlane::attach(App::DocumentObject * obj) {
auto faceSet = new SoFaceSet();
auto vertexProperty = new SoVertexProperty();
- vertexProperty->vertex.setValues(0, 4, verts);
+ vertexProperty->vertex.connectFrom(&pCoords->point);
faceSet->vertexProperty.setValue(vertexProperty);
faceSeparator->addChild(faceSet);
- auto textTranslation = new SoTranslation();
- SbVec3f centeringVec = size * SbVec3f(0.36F, 0.49F, 0.0F); // NOLINT
- textTranslation->translation.setValue(centeringVec);
- sep->addChild(textTranslation);
+ pTextTranslation = new SoTranslation();
+ sep->addChild(pTextTranslation);
pLabel->string.setValue(getLabelText(role).c_str());
-
+ pLabel->justification = SoAsciiText::RIGHT;
labelSwitch = new SoSwitch();
setLabelVisibility(false);
+
+ auto font = new SoFontStyle();
+ font->size = 10.0;
+ font->style = SoFontStyle::BOLD;
+ font->family = SoFontStyle::SANS;
+
+ auto labelMaterial = static_cast(material->copy());
+ labelMaterial->transparency = 0.0;
+
+ labelSwitch->addChild(font);
+ labelSwitch->addChild(labelMaterial);
+ labelSwitch->addChild(pTextTranslation);
labelSwitch->addChild(pLabel);
+
+ updatePlaneSize();
+
sep->addChild(labelSwitch);
+
+ handlers.addDelayedHandler(
+ ViewParams::instance()->getHandle(),
+ {"DatumLineSize", "DatumScale"},
+ [this](ParameterGrp::handle) { updatePlaneSize(); }
+ );
+
+ updatePlaneSize();
}
void ViewProviderPlane::setLabelVisibility(bool val)
@@ -152,6 +160,42 @@ void ViewProviderPlane::setLabelVisibility(bool val)
labelSwitch->whichChild = val ? SO_SWITCH_ALL : SO_SWITCH_NONE;
}
+void ViewProviderPlane::onSelectionChanged(const SelectionChanges&)
+{
+ isSelected = Gui::Selection().isSelected(getObject());
+ isHovered = Gui::Selection().getPreselection().Object.getSubObject() == getObject() || Gui::Selection().getPreselection().Object.getObject() == getObject();
+
+ updatePlaneSize();
+}
+
+void ViewProviderPlane::updatePlaneSize()
+{
+ const auto params = ViewParams::instance();
+
+ const float size = params->getDatumPlaneSize() * Base::fromPercent(params->getDatumScale());
+ const float offset = 8.0F;
+
+ SbVec3f verts[4];
+
+ bool isSelectedOrHovered = isSelected || isHovered;
+
+ if (!getRole().empty() && !isSelectedOrHovered) {
+ verts[0] = SbVec3f(size, size, 0);
+ verts[1] = SbVec3f(size, offset, 0);
+ verts[2] = SbVec3f(offset, offset, 0);
+ verts[3] = SbVec3f(offset, size, 0);
+ } else {
+ verts[0] = SbVec3f(size, size, 0);
+ verts[1] = SbVec3f(size, -size, 0);
+ verts[2] = SbVec3f(-size, -size, 0);
+ verts[3] = SbVec3f(-size, size, 0);
+ }
+
+ pTextTranslation->translation.setValue(verts[0] / 2 - SbVec3f(2, 6, 0)); // NOLINT
+ pCoords->point.setNum(4);
+ pCoords->point.setValues(0, 4, verts);
+}
+
unsigned long ViewProviderPlane::getColor(const std::string& role) const
{
auto planesRoles = App::LocalCoordinateSystem::PlaneRoles;
@@ -169,18 +213,17 @@ unsigned long ViewProviderPlane::getColor(const std::string& role) const
std::string ViewProviderPlane::getLabelText(const std::string& role) const
{
- std::string text;
auto planesRoles = App::LocalCoordinateSystem::PlaneRoles;
if (role == planesRoles[0]) {
- text = "XY";
+ return "XY";
}
else if (role == planesRoles[1]) {
- text = "XZ";
+ return "XZ";
}
else if (role == planesRoles[2]) {
- text = "YZ";
+ return "YZ";
}
- return text;
+ return getObject()->getNameInDocument();
}
std::string ViewProviderPlane::getRole() const
diff --git a/src/Gui/ViewProviderPlane.h b/src/Gui/ViewProviderPlane.h
index 7246a9fe91..abfb600989 100644
--- a/src/Gui/ViewProviderPlane.h
+++ b/src/Gui/ViewProviderPlane.h
@@ -27,13 +27,19 @@
#include "ViewProviderDatum.h"
+#include "Selection/Selection.h"
+#include "ParamHandler.h"
+
+
class SoSwitch;
+class SoTranslation;
class SoAsciiText;
+class SoCoordinate3;
namespace Gui
{
-class GuiExport ViewProviderPlane : public ViewProviderDatum
+class GuiExport ViewProviderPlane : public ViewProviderDatum, public SelectionObserver
{
PROPERTY_HEADER_WITH_OVERRIDE(Gui::ViewProviderPlane);
public:
@@ -48,9 +54,20 @@ public:
std::string getLabelText(const std::string& role) const;
void setLabelVisibility(bool val);
+ void onSelectionChanged(const SelectionChanges&) override;
+
private:
+ void updatePlaneSize();
+
+ bool isHovered { false };
+ bool isSelected { false };
+
CoinPtr labelSwitch;
CoinPtr pLabel;
+ CoinPtr pCoords;
+ CoinPtr pTextTranslation;
+
+ ParamHandlers handlers;
};
} //namespace Gui
diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp
index 6dbcd53947..39f45185da 100644
--- a/src/Mod/Part/Gui/TaskAttacher.cpp
+++ b/src/Mod/Part/Gui/TaskAttacher.cpp
@@ -51,10 +51,13 @@
#include
#include "TaskAttacher.h"
-
+#include "ViewProviderDatum.h"
#include "ViewProvider2DObject.h"
+
#include "ui_TaskAttacher.h"
+#include
+
using namespace PartGui;
using namespace Gui;
@@ -218,6 +221,21 @@ TaskAttacher::TaskAttacher(Gui::ViewProviderDocumentObject* ViewProvider, QWidge
ui->attachmentOffsetPitch->bind(App::ObjectIdentifier::parse(ViewProvider->getObject(), std::string("AttachmentOffset.Rotation.Pitch")));
ui->attachmentOffsetRoll->bind(App::ObjectIdentifier::parse(ViewProvider->getObject(), std::string("AttachmentOffset.Rotation.Roll")));
+
+ auto document = ViewProvider->getObject()->getDocument();
+ for (auto planeDocumentObject : document->getObjectsOfType(App::Plane::getClassTypeId())) {
+ auto planeViewProvider = Application::Instance->getViewProvider(planeDocumentObject);
+
+ if (!planeViewProvider) {
+ continue;
+ }
+
+ modifiedPlaneViewProviders.push_back(planeViewProvider);
+
+ planeViewProvider->setTemporaryScale(ViewParams::instance()->getDatumTemporaryScaleFactor());
+ planeViewProvider->setLabelVisibility(true);
+ };
+
visibilityAutomation(true);
updateAttachmentOffsetUI();
updateReferencesUI();
@@ -231,9 +249,9 @@ TaskAttacher::TaskAttacher(Gui::ViewProviderDocumentObject* ViewProvider, QWidge
auto bnd1 = std::bind(&TaskAttacher::objectDeleted, this, sp::_1);
auto bnd2 = std::bind(&TaskAttacher::documentDeleted, this, sp::_1);
//NOLINTEND
- Gui::Document* document = Gui::Application::Instance->getDocument(ViewProvider->getObject()->getDocument());
- connectDelObject = document->signalDeletedObject.connect(bnd1);
- connectDelDocument = document->signalDeleteDocument.connect(bnd2);
+ Gui::Document* guiDocument = Gui::Application::Instance->getDocument(ViewProvider->getObject()->getDocument());
+ connectDelObject = guiDocument->signalDeletedObject.connect(bnd1);
+ connectDelDocument = guiDocument->signalDeleteDocument.connect(bnd2);
handleInitialSelection();
}
@@ -248,6 +266,11 @@ TaskAttacher::~TaskAttacher()
connectDelObject.disconnect();
connectDelDocument.disconnect();
+
+ for (auto planeViewProvider : modifiedPlaneViewProviders) {
+ planeViewProvider->resetTemporarySize();
+ planeViewProvider->setLabelVisibility(false);
+ }
}
void TaskAttacher::objectDeleted(const Gui::ViewProviderDocumentObject& view)
diff --git a/src/Mod/Part/Gui/TaskAttacher.h b/src/Mod/Part/Gui/TaskAttacher.h
index 92d9c909dc..9d06fcf93a 100644
--- a/src/Mod/Part/Gui/TaskAttacher.h
+++ b/src/Mod/Part/Gui/TaskAttacher.h
@@ -42,6 +42,7 @@ class Property;
}
namespace Gui {
+class ViewProviderPlane;
class ViewProvider;
}
@@ -158,6 +159,8 @@ private:
Connection connectDelObject;
Connection connectDelDocument;
+ std::vector modifiedPlaneViewProviders;
+
App::PropertyOverrideContext overrides;
};
diff --git a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp
index 9b4c9cb87a..d1ff066072 100644
--- a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp
+++ b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp
@@ -55,6 +55,8 @@
#include
#include
#include
+#include
+#include
#include
using namespace PartDesignGui;
@@ -502,6 +504,7 @@ public:
SketchRequestSelection(Gui::Document* guidocument, PartDesign::Body* activeBody)
: guidocument(guidocument)
, activeBody(activeBody)
+ , planeFinder(guidocument->getDocument(), activeBody)
{
}
@@ -567,7 +570,7 @@ private:
Gui::Application::Instance->getViewProvider(origin));
if (vpo) {
vpo->setTemporaryVisibility(Gui::DatumElement::Planes | Gui::DatumElement::Axes);
- vpo->setTemporaryScale(3.0); // NOLINT
+ vpo->setTemporaryScale(Gui::ViewParams::instance()->getDatumTemporaryScaleFactor());
vpo->setPlaneLabelVisibility(true);
}
}
@@ -584,14 +587,14 @@ private:
PartDesign::Body* partDesignBody = activeBody;
auto onAccept = [partDesignBody, sketch]() {
- SketchRequestSelection::resetOriginVisibility(partDesignBody);
+ resetOriginVisibility(partDesignBody);
Gui::Selection().clearSelection();
PartDesignGui::setEdit(sketch, partDesignBody);
};
auto onReject = [partDesignBody]() {
- SketchRequestSelection::resetOriginVisibility(partDesignBody);
+ resetOriginVisibility(partDesignBody);
};
Gui::Selection().clearSelection();
@@ -616,7 +619,7 @@ private:
void findAndSelectPlane()
{
App::Document* appdocument = guidocument->getDocument();
- PlaneFinder planeFinder{appdocument, activeBody};
+
planeFinder.findBasePlanes();
planeFinder.findDatumPlanes();
planeFinder.findShapeBinderPlanes();
@@ -625,14 +628,35 @@ private:
std::vector status = planeFinder.getStatus();
unsigned validPlaneCount = planeFinder.countValidPlanes();
+ for (auto& plane : planes) {
+ auto* planeViewProvider = Gui::Application::Instance->getViewProvider(plane);
+
+ // skip updating planes from coordinate systems
+ if (!planeViewProvider->getRole().empty()) {
+ continue;
+ }
+
+ planeViewProvider->setLabelVisibility(true);
+ planeViewProvider->setTemporaryScale(Gui::ViewParams::instance()->getDatumTemporaryScaleFactor());
+ }
+
//
// Lambda definitions
//
App::Document* documentOfBody = appdocument;
PartDesign::Body* partDesignBody = activeBody;
+ auto restorePlaneVisibility = [planes]() {
+ for (auto& plane : planes) {
+ auto* planeViewProvider = Gui::Application::Instance->getViewProvider(plane);
+ planeViewProvider->resetTemporarySize();
+ planeViewProvider->setLabelVisibility(false);
+ }
+ };
+
// Determines if user made a valid selection in dialog
- auto acceptFunction = [](const std::vector& features) -> bool {
+ auto acceptFunction = [restorePlaneVisibility](const std::vector& features) -> bool {
+ restorePlaneVisibility();
return !features.empty();
};
@@ -643,7 +667,8 @@ private:
// Called by dialog for "Cancel", or "OK" if accepter returns false
std::string docname = documentOfBody->getName();
- auto rejectFunction = [docname]() {
+ auto rejectFunction = [docname, restorePlaneVisibility]() {
+ restorePlaneVisibility();
Gui::Document* document = Gui::Application::Instance->getDocument(docname.c_str());
if (document)
document->abortCommand();
@@ -729,6 +754,8 @@ private:
private:
Gui::Document* guidocument;
PartDesign::Body* activeBody;
+
+ PlaneFinder planeFinder;
};
}
diff --git a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp
index fdd75d8536..945f4cf563 100644
--- a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp
+++ b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp
@@ -54,6 +54,8 @@
#include "TaskFeaturePick.h"
#include "Utils.h"
+#include
+
using namespace PartDesignGui;
using namespace Attacher;
@@ -159,7 +161,7 @@ TaskFeaturePick::TaskFeaturePick(std::vector& objects,
Gui::Application::Instance->getViewProvider(origin));
if (vpo) {
vpo->setTemporaryVisibility(originVisStatus[origin]);
- vpo->setTemporaryScale(4.0); // NOLINT
+ vpo->setTemporaryScale(Gui::ViewParams::instance()->getDatumTemporaryScaleFactor());
vpo->setPlaneLabelVisibility(true);
origins.push_back(vpo);
}