diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 5fbca951d..7bc4521f3 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -1734,7 +1734,7 @@ void Application::runApplication(void) // Call this before showing the main window because otherwise: // 1. it shows a white window for a few seconds which doesn't look nice // 2. the layout of the toolbars is completely broken - app.activateWorkbench(start.c_str()); + //app.activateWorkbench(start.c_str()); // show the main window if (!hidden) { @@ -1766,6 +1766,9 @@ void Application::runApplication(void) SoDebugError::setHandlerCallback( messageHandlerCoin, 0 ); #endif + app.activateWorkbench(start.c_str()); + + Instance->d->startingUp = false; diff --git a/src/Mod/Assembly/App/ItemPart.h b/src/Mod/Assembly/App/ItemPart.h index 19dbc8406..f2854d9ed 100644 --- a/src/Mod/Assembly/App/ItemPart.h +++ b/src/Mod/Assembly/App/ItemPart.h @@ -38,7 +38,8 @@ class AssemblyExport ItemPart : public Assembly::Item public: ItemPart(); - App::PropertyLink Model; + App::PropertyLink Model; + App::PropertyLinkList Annotation; /** @name methods override feature */ //@{ diff --git a/src/Mod/Assembly/Gui/Command.cpp b/src/Mod/Assembly/Gui/Command.cpp index 02fcac0f6..ac89d7cc0 100644 --- a/src/Mod/Assembly/Gui/Command.cpp +++ b/src/Mod/Assembly/Gui/Command.cpp @@ -67,10 +67,13 @@ void CmdAssemblyAddNewPart::activated(int iMsg) dest = dynamic_cast(Sel.front()); }else if(ActiveAsmObject && ActiveAsmObject->getTypeId().isDerivedFrom(Assembly::ItemAssembly::getClassTypeId())) { dest = dynamic_cast(ActiveAsmObject); + }else { + + } openCommand("Insert Part"); - std::string PartName = getUniqueObjectName("Part.0"); + std::string PartName = getUniqueObjectName("Part"); doCommand(Doc,"App.activeDocument().addObject('Assembly::ItemPart','%s')",PartName.c_str()); if(dest){ std::string fatherName = dest->getNameInDocument(); @@ -80,7 +83,7 @@ void CmdAssemblyAddNewPart::activated(int iMsg) Command::addModule(Gui,"PartDesignGui"); std::string BodyName = getUniqueObjectName("Body"); doCommand(Doc,"App.activeDocument().addObject('PartDesign::Body','%s')",BodyName.c_str()); - doCommand(Doc,"App.activeDocument().%s.Model = App.activeDocument().%s.Items = App.activeDocument().%s ",BodyName.c_str(),BodyName.c_str(),BodyName.c_str()); + doCommand(Doc,"App.activeDocument().%s.Model = App.activeDocument().%s ",PartName.c_str(),BodyName.c_str(),BodyName.c_str()); } diff --git a/src/Mod/Assembly/Gui/ViewProviderPart.cpp b/src/Mod/Assembly/Gui/ViewProviderPart.cpp index 73988a966..2efa6ef1d 100644 --- a/src/Mod/Assembly/Gui/ViewProviderPart.cpp +++ b/src/Mod/Assembly/Gui/ViewProviderPart.cpp @@ -29,6 +29,7 @@ #include "ViewProviderPart.h" //#include //#include +#include using namespace AssemblyGui; @@ -48,3 +49,26 @@ bool ViewProviderItemPart::doubleClicked(void) } +std::vector ViewProviderItemPart::claimChildren(void)const +{ + std::vector res; + + if(static_cast(getObject())->Model.getValue()) + res.push_back( static_cast(getObject())->Model.getValue()); + res.insert( res.end(), static_cast(getObject())->Annotation.getValues().begin(),static_cast(getObject())->Annotation.getValues().end()); + + return res; + +} + +std::vector ViewProviderItemPart::claimChildren3D(void)const +{ + std::vector res; + + if(static_cast(getObject())->Model.getValue()) + res.push_back( static_cast(getObject())->Model.getValue()); + res.insert( res.end(), static_cast(getObject())->Annotation.getValues().begin(),static_cast(getObject())->Annotation.getValues().end()); + + return res; + +} diff --git a/src/Mod/Assembly/Gui/ViewProviderPart.h b/src/Mod/Assembly/Gui/ViewProviderPart.h index 8f60075b4..5a3c4b309 100644 --- a/src/Mod/Assembly/Gui/ViewProviderPart.h +++ b/src/Mod/Assembly/Gui/ViewProviderPart.h @@ -41,6 +41,10 @@ public: virtual bool doubleClicked(void); + virtual std::vector claimChildren(void)const; + + virtual std::vector claimChildren3D(void)const; + }; diff --git a/src/Mod/Assembly/Gui/Workbench.cpp b/src/Mod/Assembly/Gui/Workbench.cpp index ec04ec9dc..8b183a449 100644 --- a/src/Mod/Assembly/Gui/Workbench.cpp +++ b/src/Mod/Assembly/Gui/Workbench.cpp @@ -110,8 +110,8 @@ void Workbench::activated() App::Document *doc = App::GetApplication().getActiveDocument(); if(!doc){ // create a new document - - Gui::Command::doCommand(Gui::Command::Doc,"App.newDocument()"); + std::string uniqueName = App::GetApplication().getUniqueDocumentName("Assembly1"); + Gui::Command::doCommand(Gui::Command::Doc,"App.newDocument('%s')",uniqueName.c_str()); doc = App::GetApplication().getActiveDocument(); } @@ -120,9 +120,10 @@ void Workbench::activated() if(doc->countObjects()==0){ Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject('Assembly::ItemAssembly','Product')"); + Gui::Command::doCommand(Gui::Command::Doc,"AssemblyGui.setActiveAssembly(App.activeDocument().Product)"); } - + Gui::Control().showModelView(); } void Workbench::deactivated()