Assembly: attach selection observer only if in edit mode.

This commit is contained in:
PaddleStroke
2024-03-14 17:07:28 +01:00
committed by Yorik van Havre
parent 4a88f6c62f
commit 9b2cee5cbe

View File

@@ -85,7 +85,7 @@ void printPlacement(Base::Placement plc, const char* name)
PROPERTY_SOURCE(AssemblyGui::ViewProviderAssembly, Gui::ViewProviderPart)
ViewProviderAssembly::ViewProviderAssembly()
: SelectionObserver(true)
: SelectionObserver(false)
, dragMode(DragMode::None)
, canStartDragging(false)
, partMoving(false)
@@ -204,6 +204,8 @@ bool ViewProviderAssembly::setEdit(int ModNum)
setDragger();
attachSelection();
return true;
}
@@ -216,6 +218,8 @@ void ViewProviderAssembly::unsetEdit(int ModNum)
unsetDragger();
detachSelection();
// Check if the view is still active before trying to deactivate the assembly.
auto doc = getDocument();
if (!doc) {
@@ -860,6 +864,10 @@ void ViewProviderAssembly::draggerMotionCallback(void* data, SoDragger* d)
void ViewProviderAssembly::onSelectionChanged(const Gui::SelectionChanges& msg)
{
if (!isInEditMode()) {
return;
}
if (msg.Type == Gui::SelectionChanges::AddSelection
|| msg.Type == Gui::SelectionChanges::ClrSelection
|| msg.Type == Gui::SelectionChanges::RmvSelection) {