Skip to content

[fix] local-objects share reaches peers + list reactivity + role dropdown color - #52

Merged
AlexZ005 merged 3 commits into
mainfrom
fix/localobjects-share-reactivity-dropdown
Jul 25, 2026
Merged

[fix] local-objects share reaches peers + list reactivity + role dropdown color#52
AlexZ005 merged 3 commits into
mainfrom
fix/localobjects-share-reactivity-dropdown

Conversation

@AlexZ005

Copy link
Copy Markdown
Collaborator

Follow-up fixes to the viewer object-permissions batch (#51), from the user's testing.

Fixes

  • Share now copies to peers. shareLocal/shareAll sent {type:'object', element: toJSON(), uuids:[uuid]}. A non-null uuids routes the receiver's createObject into the GLTFLoader branch, which rejects a THREE toJSON() payload — so the shared object silently never landed on peers. Every proven single-object send (prefabs, autosave, drawMode, environment, Inspector) omits uuids and hits the ObjectLoader branch; both share paths now match.
  • List reactivity. THREE object trees aren't Svelte-reactive; Objects.svelte now re-derives kids and the __localOnly badge (isLocal) from an objectsGroup poke via $derived.by. Fixes: the "Local only" mark persisting after Share, group children not appearing as more are added, and the show-local toggle duplicating rows.
  • Role dropdown color. Menu items render colored role-badge pills (editor blue / admin violet) matching the trigger pill, replacing the plain dot + label.
  • Drag-to-root. Dropping a local object on the Local-objects background un-nests it to the top level (moveObjectToGroup(uuid, 'root')) instead of only allowing drops into groups.
  • Docs. CLAUDE.md + peer-feature skill updated (objectPermissions, cloudApi v2.2, Connect drawer, role UI, CRLF/tabs + THREE-not-reactive traps).

Verification

  • npm run build green; npx svelte-check 485 errors / 72 warnings (baseline held, 0 new).
  • Boot-tested headless (HTTP 200, app mounts, no import cycle from the new LocalObjects→objectActions edge).
  • Share round-trip is a two-peer + cloud-roles-plugin behavior — needs the user's manual two-peer re-test to confirm the object now appears for the joiner.

🤖 Generated with Claude Code

AlexZ005 and others added 3 commits July 25, 2026 21:02
…down color

- Share now actually copies objects to peers: dropped the uuids array from the
  {type:object} send. A non-null uuids routed createObject into the GLTF-loader
  branch, which rejected a THREE toJSON payload, so the object never landed. Every
  proven single-object send (prefabs/autosave/drawMode/environment/Inspector) omits
  uuids and hits the ObjectLoader branch; shareLocal + shareAll now match.
- Objects.svelte re-derives children + the __localOnly badge from an objectsGroup
  poke (THREE trees aren't reactive) so the local mark clears after Share, group
  children appear as they are added, and the show-local toggle stops duplicating rows.
- Role menu items render colored role-badge pills (editor blue / admin violet) to
  match the trigger pill instead of a plain dot + label.
- Drag a local object onto the Local-objects background to un-nest it to the top
  level (moveObjectToGroup root) rather than only into groups.
- Docs: CLAUDE.md + peer-feature skill cover objectPermissions, cloudApi v2.2,
  Connect drawer, role UI, the CRLF/tabs + THREE-not-reactive traps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…der role pills

- Dragging a local object into the shared object list now REPLICATES it, not just
  reparents it. moveObjectToGroup sends a `group` message keyed by a uuid peers never
  received, so it was a silent no-op on their side; nesting merely hid the object from
  the top-level "Local objects" filter, so it looked shared but never left the machine.
- New shareObject(obj, groupUuid?) in objectPermissions: re-parents into the target
  group (so toJSON carries the group-local transform), clears __localOnly, broadcasts
  {type:object}, pokes the list. Wired into all three drop targets:
  - a new full-width drop zone over the shared list body (Svelte action, so no
    on:-directive / a11y warnings) -> share to scene root;
  - the list header drop-to-root -> shares local objects instead of a dead reparent;
  - dropping onto a shared group row -> shares into that group.
  Dropping within the Local-objects section still keeps the object local.
- shareLocal / shareAll now route through shareObject too.
- Role pill: fully-rounded, 600-weight, padded chip with a button shadow on the admin
  trigger + a clearer caret, and a distinct slate viewer color, so every role reads as
  a colored pill rather than a plain dropdown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… on share

Sharing a Stairs primitive arrived rotated ~90 deg on peers. Root cause: the custom
builders apply post-construction geometry.rotateY/rotateX/translate to a PARAMETRIC
ExtrudeGeometry / PlaneGeometry. Those subclasses' toJSON() serialize only the shape +
options, so ObjectLoader.parse on the receiver rebuilds a fresh geometry WITHOUT the
baked transforms -- Stairs/Corner/Terrain lose their rotate, Wedge/Arch lose their
translate. Verified: parsed bbox [0,0,0..2,1.5,2] vs original [-1,0,-1..1,1.5,1].

Fix: bake custom-builder output into a plain BufferGeometry (copy) at creation, so its
toJSON carries the real vertices. Standard primitives stay parametric (they round-trip
fine -- no post-construction transforms). The deterministic /create path is unchanged;
this only affected the toJSON share/serialize path. Covers SDK-registered builders too.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AlexZ005
AlexZ005 merged commit 38e96a0 into main Jul 25, 2026
@AlexZ005
AlexZ005 deleted the fix/localobjects-share-reactivity-dropdown branch July 25, 2026 18:53
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