Skip to content

Bonsai: sync Representation Items list selection with the 3D viewport - #8924

Open
BIMvoice wants to merge 1 commit into
IfcOpenShell:v0.8.0from
BIMvoice:feat-6239-viewport-list-select-sync
Open

BIMvoice wants to merge 1 commit into
IfcOpenShell:v0.8.0from
BIMvoice:feat-6239-viewport-list-select-sync

Conversation

@BIMvoice

Copy link
Copy Markdown
Contributor

Fixes #6239.

Selecting a representation item object in the 3D viewport now highlights the matching row in the "Representation Items" list, instead of leaving it on whatever row was last active. Geometry.sync_active_item_index() reads the newly active object's ifc_definition_id and updates active_item_index to the matching row; it reuses the existing active-object msgbus hook that already drives BIM-tool-props sync, so no new selection handler was added. It no-ops immediately outside Item Mode, for the representation host, or for unrelated objects, so it only ever scans one element's items.

Thanks for reporting this, @theoryshaw.

Test plan

  • Live-verified through the real Bonsai geometry pipeline: selecting each item object updates the list index both ways; unrelated/host objects are a safe no-op. The identical script fails on the unfixed source.
  • TestSyncActiveItemIndex (4 cases) added; full test_geometry.py suite 68/68 pass.
  • black + ruff clean.

Generated with the assistance of an AI coding tool.

When editing an element's representation items (Item Mode), selecting an
item object directly in the 3D viewport left the "Representation Items"
list unchanged, so users had to hunt through the list manually to find
the row matching what they'd just clicked on.

Geometry.sync_active_item_index() now runs on every active-object change
(same msgbus hook that already drives selection-driven BIM tool sync) and,
when Item Mode is active, updates active_item_index to the row whose
IFC id matches the newly active item object. It's a no-op outside Item
Mode, for objects with no matching row, and for the hidden representation
host object itself.

Fixes IfcOpenShell#6239.

Generated with the assistance of an AI coding tool.
@BIMvoice BIMvoice added PR Proposed A PR has been proposed for this bug/feature. and removed PR Proposed A PR has been proposed for this bug/feature. labels Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If an item is selected in the 3d viewport, that it would automatically select the item in the list as well.

1 participant