fix(gui): resolve PartDesign toolbars and breadcrumb when editing body inside assembly #309
Reference in New Issue
Block a user
Delete Branch "fix/partdesign-context-in-assembly"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When double-clicking a PartDesign Body inside an Assembly, two issues occur:
Root Causes
Priority preemption:
assembly.editcontext (priority 90) always matched because the Assembly VP remained in edit mode, blocking all PartDesign contexts (priorities 30-40).Wrong active-object key: PartDesign matchers only queried the
"part"active object, butViewProviderBody::toggleActiveBody()sets"part"to the containingApp::Part(which IS the Assembly, sinceAssemblyObjectinherits fromApp::Part). The Body is set under"pdbody", which the resolver never queried.Missing refresh trigger:
ActiveObjectList::setObject()firesDocument::signalActivatedViewProvider, butEditingContextResolverhad no connection to it, sosetActiveObject("pdbody", body)never triggered a re-resolve.Changes
signalActivatedViewProviderfromGui::DocumenttoGui::Application(same pattern assignalInEdit/signalResetEdit)EditingContextResolverto the new application-level signalgetActivePdBodyObject()helper querying the"pdbody"keypartdesign.in_assemblycontext (priority 95) matching when a Body is active pdbody while an Assembly is in editpartdesign.bodyandpartdesign.featurematchers to check pdbody before falling back to part keyTesting
When double-clicking a PartDesign Body inside an Assembly, the editing context resolver failed to show PartDesign toolbars or a proper breadcrumb. Three root causes: 1. Priority preemption: assembly.edit (priority 90) always matched because the Assembly VP remained in edit mode, blocking all PartDesign contexts (priorities 30-40). 2. Wrong active-object key: PartDesign matchers only queried the "part" active object, but ViewProviderBody::toggleActiveBody() sets "part" to the containing App::Part (which is the Assembly itself). The Body is set under "pdbody", which was never queried. 3. Missing refresh trigger: ActiveObjectList::setObject() fires Document::signalActivatedViewProvider, but EditingContextResolver had no connection to it, so setActiveObject("pdbody", body) never triggered a context re-resolve. Changes: - Forward signalActivatedViewProvider from Gui::Document to Gui::Application (same pattern as signalInEdit/signalResetEdit) - Connect EditingContextResolver to the new application-level signal - Add getActivePdBodyObject() helper querying the "pdbody" key - Add partdesign.in_assembly context (priority 95) that matches when a Body is active pdbody while an Assembly is in edit - Update partdesign.body and partdesign.feature matchers to check pdbody before falling back to the part key - Add Assembly > Body breadcrumb with Blue > Mauve coloring - Update label resolution to prefer pdbody name