fix(gui): resolve PartDesign toolbars and breadcrumb when editing body inside assembly #309

Merged
forbes merged 1 commits from fix/partdesign-context-in-assembly into main 2026-02-21 15:44:50 +00:00
Owner

Problem

When double-clicking a PartDesign Body inside an Assembly, two issues occur:

  1. No PartDesign toolbars — Pad, Pocket, Sketch etc. buttons don't appear despite PartDesign workbench being active
  2. No proper breadcrumb — No "Assembly > Body" context indicator in the viewport

Root Causes

Priority preemption: assembly.edit context (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, but ViewProviderBody::toggleActiveBody() sets "part" to the containing App::Part (which IS the Assembly, since AssemblyObject inherits from App::Part). The Body is set under "pdbody", which the resolver never queried.

Missing refresh trigger: ActiveObjectList::setObject() fires Document::signalActivatedViewProvider, but EditingContextResolver had no connection to it, so setActiveObject("pdbody", body) never triggered a 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) matching 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 part key
  • Add Assembly > Body breadcrumb with Blue > Mauve coloring
  • Update label resolution to prefer pdbody name

Testing

  1. Open an assembly containing a Part with a Body
  2. Double-click the Body in the tree
  3. Verify PartDesign toolbars appear and breadcrumb shows "Assembly > Body"
  4. Double-click a Sketch → verify Sketcher context activates
  5. Exit sketch → verify returns to PartDesign context
  6. Exit body → verify returns to Assembly context
  7. Test standalone Part (not in assembly) → verify existing behavior unchanged
## Problem When double-clicking a PartDesign Body inside an Assembly, two issues occur: 1. **No PartDesign toolbars** — Pad, Pocket, Sketch etc. buttons don't appear despite PartDesign workbench being active 2. **No proper breadcrumb** — No "Assembly > Body" context indicator in the viewport ## Root Causes **Priority preemption:** `assembly.edit` context (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, but `ViewProviderBody::toggleActiveBody()` sets `"part"` to the containing `App::Part` (which IS the Assembly, since `AssemblyObject` inherits from `App::Part`). The Body is set under `"pdbody"`, which the resolver never queried. **Missing refresh trigger:** `ActiveObjectList::setObject()` fires `Document::signalActivatedViewProvider`, but `EditingContextResolver` had no connection to it, so `setActiveObject("pdbody", body)` never triggered a 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) matching 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 part key - Add Assembly > Body breadcrumb with Blue > Mauve coloring - Update label resolution to prefer pdbody name ## Testing 1. Open an assembly containing a Part with a Body 2. Double-click the Body in the tree 3. Verify PartDesign toolbars appear and breadcrumb shows "Assembly > Body" 4. Double-click a Sketch → verify Sketcher context activates 5. Exit sketch → verify returns to PartDesign context 6. Exit body → verify returns to Assembly context 7. Test standalone Part (not in assembly) → verify existing behavior unchanged
forbes added 1 commit 2026-02-21 15:44:14 +00:00
fix(gui): resolve PartDesign toolbars and breadcrumb when editing body inside assembly
Some checks failed
Build and Test / build (pull_request) Has been cancelled
5883ac8a0d
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
forbes merged commit a6d0427639 into main 2026-02-21 15:44:50 +00:00
forbes deleted branch fix/partdesign-context-in-assembly 2026-02-21 15:44:51 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#309