@umicat/three-sdk 1.30.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -359,6 +359,25 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
359
359
  selectionBox.visible = false;
360
360
  selectionBox.renderOrder = 998;
361
361
  selectionBox.material.depthTest = false;
362
+ /**
363
+ * ADR-052 — the outline shown when a CONTEXT MENU opens on a hidden or
364
+ * locked entity.
365
+ *
366
+ * Same look as the selection box on purpose: the question it answers is the
367
+ * same one ("which thing is this menu about?"), and inventing a second
368
+ * visual language for it would only make the answer harder to read. What it
369
+ * deliberately does NOT come with is the gizmo — showing you what you are
370
+ * acting on is not the same as handing back the drag handles that lock
371
+ * exists to take away.
372
+ *
373
+ * Its own helper rather than reusing `selectionBox`, so `applySelection`
374
+ * stays the single owner of that one and the two cannot fight over
375
+ * visibility.
376
+ */
377
+ const menuTargetBox = new THREE.BoxHelper(new THREE.Object3D(), 0xffd23f);
378
+ menuTargetBox.visible = false;
379
+ menuTargetBox.renderOrder = 998;
380
+ menuTargetBox.material.depthTest = false;
362
381
  // ADR-046 — multi-select (box-select + ⌘/Ctrl-click). `multiSelected` is
363
382
  // now the ONE authoritative source of truth for "what's selected" — the
364
383
  // single-select visuals above (`gizmo.attached`/`selectionBox`) are kept
@@ -539,6 +558,8 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
539
558
  // the ground-marquee regression: the claim there is "the ground did NOT
540
559
  // move AND both Parts got selected", and neither half is observable from
541
560
  // the host protocol alone (a drag that moves nothing posts nothing).
561
+ globalThis.__umicatMenuTargetVisible =
562
+ () => menuTargetBox.visible;
542
563
  globalThis.__umicatSelectedIds =
543
564
  () => [...multiSelected].map((o) => entityByObject.get(o)).filter((id) => !!id);
544
565
  globalThis.__umicatEntityWorldPos =
@@ -1149,6 +1170,8 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
1149
1170
  moved = true;
1150
1171
  };
1151
1172
  const onPointerDown = (e) => {
1173
+ // Any new press ends the previous menu's business, including its outline.
1174
+ menuTargetBox.visible = false;
1152
1175
  // Right button — camera look-drag, a separate gesture channel entirely
1153
1176
  // from everything below. Hard-returns before touching any select/drag/
1154
1177
  // gizmo state, so a right-click can never be misread as the start of a
@@ -1393,6 +1416,10 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
1393
1416
  return;
1394
1417
  }
1395
1418
  if (isInert(hit.entityId)) {
1419
+ // Outline it without selecting it. The menu needs to say what it is
1420
+ // about; the gizmo would undo the lock.
1421
+ menuTargetBox.setFromObject(hit.entityRoot);
1422
+ menuTargetBox.visible = true;
1396
1423
  window.parent.postMessage({ type: 'umicat:editor:contextMenu3d', entityId: hit.entityId, inert: true, clientX: e.clientX, clientY: e.clientY }, '*');
1397
1424
  return;
1398
1425
  }
@@ -1862,6 +1889,20 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
1862
1889
  disposeMeshInPlace(object);
1863
1890
  object = swapEntityObject(object, fresh, m.entityId);
1864
1891
  }
1892
+ if (m.patch?.name !== undefined) {
1893
+ // ADR-052 — display name. Kept live as well as on disk because
1894
+ // `Object3D.name` is what game code and any future debug overlay read;
1895
+ // a rename that only landed on disk would be invisible until a rebuild,
1896
+ // which is indistinguishable from a control that does not work.
1897
+ const authored = sceneData?.entities.find((e) => e.id === m.entityId);
1898
+ if (authored) {
1899
+ if (m.patch.name)
1900
+ authored.name = m.patch.name;
1901
+ else
1902
+ delete authored.name;
1903
+ }
1904
+ object.name = m.patch.name || m.entityId;
1905
+ }
1865
1906
  if (m.patch?.editorHidden !== undefined || m.patch?.editorLocked !== undefined) {
1866
1907
  const authored = sceneData?.entities.find((e) => e.id === m.entityId);
1867
1908
  if (!authored)
@@ -2611,6 +2652,8 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
2611
2652
  scene.add(marker);
2612
2653
  selectionBox.visible = false;
2613
2654
  scene.add(selectionBox);
2655
+ menuTargetBox.visible = false;
2656
+ scene.add(menuTargetBox);
2614
2657
  scene.add(gizmo.root);
2615
2658
  // ADR-046 Phase 3b — the shared pivot itself has no visible geometry,
2616
2659
  // but it still needs to be IN the (fresh) scene graph for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umicat/three-sdk",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "description": "Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",