Assembly: Add support to external objects. (And various fixes)

This commit is contained in:
Paddle
2023-12-19 09:21:46 +01:00
committed by PaddleStroke
parent 323deff46a
commit 4a119c43f1
5 changed files with 213 additions and 67 deletions

View File

@@ -72,7 +72,8 @@ bool ViewProviderAssembly::doubleClicked()
{
if (isInEditMode()) {
// Part is already 'Active' so we exit edit mode.
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
// Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Application::Instance->activeDocument()->resetEdit();
}
else {
// Part is not 'Active' so we enter edit mode to make it so.
@@ -160,6 +161,16 @@ void ViewProviderAssembly::unsetEdit(int ModNum)
partMoving = false;
docsToMove = {};
// Check if the view is still active before trying to deactivate the assembly.
auto activeDoc = Gui::Application::Instance->activeDocument();
if (!activeDoc) {
return;
}
auto activeView = activeDoc->getActiveView();
if (!activeView) {
return;
}
// Set the part as not 'Activated' ie not bold in the tree.
Gui::Command::doCommand(Gui::Command::Gui,
"Gui.ActiveDocument.ActiveView.setActiveObject('%s', None)",