Skip to content

feat: bidirectional-sync - #18

Open
ericgozzi wants to merge 4 commits into
mainfrom
feature/bidirectional-sync
Open

feat: bidirectional-sync#18
ericgozzi wants to merge 4 commits into
mainfrom
feature/bidirectional-sync

Conversation

@ericgozzi

@ericgozzi ericgozzi commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces a new "Objects" toolbar group in the UI, enabling users to add new geometry (box, sphere, point) and edit object materials (color, metalness, roughness) directly from the frontend. These actions now send messages to the backend to mutate live Python objects, making the viewer bidirectional for object creation and material editing. The implementation includes new UI components, supporting methods in ViewerRuntime, and documentation.

UI Enhancements:

  • Added AddObjectGroup to the main toolbar, grouping the new AddObjectButton and MaterialButton for object creation and material editing. (Toolbar.vue, AddObjectGroup.vue, index.ts) [1] [2] [3]
  • Implemented AddObjectButton.vue: a popover UI to select geometry type and parameters, calling createGeometry() on add. (AddObjectButton.vue)
  • Implemented MaterialButton.vue: a popover UI for editing the selected object's color, metalness, and roughness, disabled unless an object is picked. (MaterialButton.vue)

Bidirectional Backend Communication:

  • Added createGeometry(type, params) to ViewerRuntime, sending a create_geometry message to the backend to create new objects at the camera's target. (viewer_runtime.ts)
  • Added getMaterialSnapshot(guid) and setMaterial(guid, fields) to read and update material properties both locally and on the backend via material_edit messages. (viewer_runtime.ts)
  • Improved transform gizmo interaction: captures drag start matrix and sends a delta transform to the backend on drag end, ensuring correct placement and avoiding animation conflicts. (viewer_runtime.ts) [1] [2]

Documentation:

  • Added a comprehensive BIDIRECTIONAL_SYNC.md explaining the new bidirectional sync architecture, message formats, and UI integration. (BIDIRECTIONAL_SYNC.md)

Checklist

  • npm run check is green (formatting, lint, types, unit tests, both builds).
  • npm run test:browser and npm run test:package pass.

ericgozzi and others added 4 commits August 17, 2026 10:44
… edit

Mirrors frontend edits back to the backend's live COMPAS objects instead of
only receiving updates from it:

- Transform gizmo drag/rotate on a picked object now sends the world-space
  delta to the backend on release (dispatch: object_transform), computed
  against the object's matrix as of drag-start so it's correct regardless of
  whether the frontend's placement convention for that object is identity or
  absolute. Also guards against a continuously self-animating object (e.g. a
  spinning torus) rebuilding the mesh out from under an active drag.
- New "Add object" toolbar control (AddObjectButton.vue) sends
  create_geometry for Box/Sphere/Point, spawned at the camera's current orbit
  target.
- New "Material" toolbar control (MaterialButton.vue) streams color/
  metalness/roughness edits (material_edit) for the picked object, with
  local instant preview.
- New reactive store field pickedObjectGuid, since nothing previously exposed
  the current pick selection to Vue components.

Requires the paired compas_threejs backend changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Explains the transform-gizmo delta math, the two bugs found and fixed while
building it (wrong matrix convention, a spinning object fighting its own
drag), the new create_geometry/material_edit UI, and the new pickedObjectGuid
store field, for a future agent to pick up without re-deriving it. Pairs with
the equivalent doc in the compas_threejs backend repo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ericgozzi
ericgozzi marked this pull request as ready for review August 19, 2026 13:08
@ericgozzi
ericgozzi requested a review from gonzalocasas August 19, 2026 13:08
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.

1 participant