Item JSON format v2: data changes (issue #47) #48

Merged
merith-tk merged 12 commits from muse-lantern/engine-legacy:object-grip-overhaul into main 2026-11-16 21:36:19 +00:00
Member

Item JSON format v2: data changes (issue #47)

The data half of #47: every item file, both loaders, and the rename blast radius. The editor reads and writes the new shape (minimal adaptation — no redesign, no new features). This branch has since grown past the data build — it now also carries the grip-driver runtime, the gun_bolt rename, the mag-rail fix, grip-pose slice 5 (bolt slam + lock), and the Phase 3 UIX rebuild. The UIX rebuild still needs Zach's in-editor check of the viewport click itself. No merge until item-v2 + toolkit-uix-v2 + grip-pose-v2 all land (Zach, 2026-11-15).
Update 2026-11-16 (trim, d840df2): the branch was trimmed to the work the new plan needs. The 10 tip commits are gone — the margins commit (d949417, Inspector spacing + native value editors) and the 9 toolkit-split commits (462e9da–a8c54d1, ranges table, explicit spacing, value editors, one file per section, stage controls). The rebuild deletes every file they touch, so they are no longer needed on #48; the dock rebuild stays as the working dock. The hybrid inspector rebuild goes on its own branch (toolkit-inspector-rebuild, base d840df2). The deferred items are recorded on issue #47 (comment 1085). Head is now d840df2, 12 commits. The ranges table's numbers are preserved in the UIX map (dead-air-editor-uix-map.md), not lost with the trim.

Update 2026-11-16: the toolkit-uix-v2 pass and the legacy-JSON migration have landed (commits below, verification below). The dock/stage/schema now edit v2 items (spine in the JSON, spatial in the prefab), and all 11 devkit item JSONs are item-data-v2 on disk, scene-backed. The editor suites are green on the converted files.

Update 2026-11-16 (later): the staging scene carries scene-backed items again (2019e75). The hands, bolt sim, rack/fire, fire-select, grip driver, and stage gizmos had been stranded behind the stage gate since the scenes transition — the dock refused to load a scene-backed item into an open stage. The dock now loads the focused item into an open stage whether or not it is scene-backed, and Open staging scene opens the stage for scene-backed items too; the prefab stays openable from a new Open prefab button. The trigger node itself is still not animated in the editor — the Trigger slider was always a hand-curl input, never a trigger control; that is a separate, unauthorised fix.

Update 2026-11-16 (dock margins + native value editors, 5acf34f): the dock looked like a debug dump because it hand-rolled every row with no margins — fixed. The dock content now sits in a MarginContainer (Inspector section indent on the sides, one container separation top/bottom), each section body indents one section indent under its header, and every row goes through one helper with the theme HBox separation; all spacing is read from the live editor theme. Value editing now uses the native controls where reachable: a _make_spin() factory returns a flat EditorSpinSlider in the editor (SpinBox headless, same Range contract), Vector3 rows follow the Inspector pattern (lowercase x/y/z labels in the theme axis colors, ° suffix on rotations), and box colliders get the Inspector AABB pattern (one bounds grid — pos x/y/z + size w/h/d — plus a rot row). True built-in EditorProperty editors cannot be instantiated from GDScript (the concrete EditorProperty* classes are not in ClassDB), so the native path is EditorSpinSlider directly, not an embedded Inspector. Vector2/Vector4 have no dock values today; ints/strings/bools/enums are unchanged (LineEdit/CheckButton/OptionButton already match the Inspector). Verified in the editor under xvfb with the handgun loaded: margins render, float sliders are flat native sliders, pose rows show colored x/y/z with ° on rotations. One pre-existing defect surfaced, NOT fixed here: the collider details ▸ toggle has MOUSE_FILTER_IGNORE (base head, dock.gd:2146), so a box collider's details cannot be expanded by mouse in the editor — the bounds grid itself is proven by suite (6 sliders, values, write-through) but its on-screen render was not directly observed.

What changed

  • Four sections, in order. Item files are now a_object (controller, name, model, tags, value/weight, colliders) / b_properties (per-type tables: weapon_onehand with accepts_mag / accepts_ammo, data, refpoints, states) / c_assembly (fire_select, bolt, trigger) / d_grips (grip_points).

  • Loaders. ItemDefinition.from_dict() and ItemSpec read the four sections, resolve namespaced paths, and resolve the new controller field through the deadair:controller/... registry (absent = generic_object). The loader resolves extension keys: weapon_onehand counts as weapon for is_type("weapon"). The old shape loaded through a fallback compose layer while the migration landed; the fallback is now removed.

  • Migration. All item JSONs converted (scripted fold: grip_offset / grip_rotate into explicit grip_points primary poses — the fold equals the old composed runtime pose). reload_time and stack dropped. value / weight moved into a_object (optional, default 0). Colliders moved to a_object.colliders (box, mesh, convex, sphere, cylinder). Bolt origin z 0.00004 → 0.0. Travel lives only in assembly — no travel in grip points.

  • Renames. Generic pistol → generic handgun: file, item id, mag id, GLB and textures (devkit:weapon/gun/generic_handgun, devkit:mag/generic_handgun, devkit:ammo.9mm). holster.hip is gone; the slot is devkit:weapon.secondary. Controller is deadair:controller/generic_weapon — the object controller and the grip controller are one thing. gun_slide → gun_bolt (bolt is the general term; slide is reserved for pump-action shotguns with their own handler); assembly part slide → bolt, grip point slide → bolt, driver slide_grip_pose → bolt_grip_pose. The editor's internal slide-sim identifiers (slide_amount, set_slide_amount, play_slide_cycle, _slide_*, SLIDE_*, dock "Slide" header) are renamed to bolt as well.

  • Blast radius. Registry, tests/suites, bridge, start kit, and the editor references follow the renames. examples/example_module/items/example_gun.json was also migrated (its accepts_mag/ammo point at the handgun mag — an inference, see below).

  • Editor (minimal, data-only). Schema, stage, and dock read the four-section shape; the editor round-trips values correctly. No layout or behaviour changes — the redesign is Phase 3.

  • UIX rebuild, Phase 3 — full rebuild (74bb4e4, fbe68b2, 2bf6e7e reskin, superseded; d67ce6f, f0b3343, 3c8e348, 2864c86 rebuild). The reskin landed first (Inspector-style dock, click-to-select, Selected tab + driver surface) and was then thrown out on Zach's call — "EFFECTIVELY we are completely throwing out what we have and rebuilding it." The rebuilt dock is a single pane, no tabs, no status line: sections in JSON order (Item, a_object, b_properties, c_assembly, d_grips, References), each a flat inline Inspector-style header (▸/▾ + bold title, no dark-band body). Collapsed, the body is 206 px tall and needs no scrollbar. FileSystem integration: opening/focusing a mod item JSON (a_object check) in the FileSystem dock or script editor focuses that item; a .tscn focuses its owning item. Markers are added to the list (grip right/left default), each carrying a tier (primary / secondary / tertiary — tertiary maps to the runtime GENERAL mode, so a bolt grip never counts for the two-hand condition). Components add + assign in one step (object + tag, add row at the top); the bolt is a component like any other — adding it creates c_assembly.bolt and its UI lives on the component row, no standalone Bolt section. Properties: one tree per item (import weapon / weapon_onehand / weapon_twohand, or a custom tree by JSON). Colliders create + assign in one step and are editable in the UI (pos/rot/size spins, mesh-name edit). Conditional rendering: grip pose rows, state finger fields, and section bodies render only when their subject is expanded or present. Click-to-select in the staging scene is kept from the reskin: item_stage.selectable_for() maps markers, rails, collider gizmos, and assembly-bound model nodes; the dock mirrors EditorSelection. The driver surface (picker from GripDrivers.ids(), trigger slider injecting pull into the stage's tree-free evaluation via HandView.set_finger_pose) is kept, now inside the grip pose controls. One bug caught building: a bolt origin edit would have been reverted by collect_item() writing stale bolt-rail ends back — fixed with stage.refresh_bolt_rail(). (Update 2026-11-16: the prefab is the node-level surface for scene-backed items, and the staging scene is the simulation surface for ALL items since 2019e75 — it rebuilds a scene-backed item from the prefab's spatial, so the hands, bolt sim, and test animations run on it; "Open prefab scene" is now the separate Open prefab button.)

  • Grip-driver runtime (25b37ca). GripDriver base (tree-free evaluate, default-inheritance state resolution), GripDrivers registry (static_grip_pose / gun_grip_pose / bolt_grip_pose), GunGripDriver (trigger_rest → trigger_full blend by analog pull), HandView.set_finger_pose (per-finger curl + spread + thumb opposition). New tests/grip_driver_check.gd (82 checks, wired into tests.yml by cbb91fd). The driver surface (picker, trigger slider, grip preview) is in the rebuilt dock's grip pose controls.

  • modtool_meta is editor-only, ignored everywhere (13b93a7, 7b3c6cd). *.modtool_meta.json files carry no game data; the editor scan and the runtime loader both skip them.

  • Mag rail t fix (245eb97, shape b). While a mag is snapped, _snap_t was computed from the hand follower's previous-frame position (one physics tick stale, ~2.5 mm at slide speed). Now HandFollower.desired_global_transform() computes the follower's desired position for the current frame, shared by the follower and _update_snap. Proving test in item_follow_check (drive the grip at 0.15 m/s, assert the mag's rail pose against the hand's current rail projection, <1 mm).

  • Slice 5: bolt slam + lock (f9f92fb). Firearm holds bolt_t 0..1 + bolt_locked; fire_once() drives the bolt to 1 then springs it back (default 250 ms, tunable); on the last round (chamber empty + mag empty) it stays at 1 (locked); rack() releases the lock and chambers from a fresh mag. The bolt node is posed per physics frame as origin + t·travel from c_assembly.bolt, and the bolt grip point is recomputed from the node's live transform every frame. Bolt behaviour is tuned in b_properties.weapon_onehand.bolt (moved there from the base weapon table by f0b3343 — the handgun carries exactly one property tree, and the editor never authors split trees): dry_fire_primes false · snap_back_ms 250.0 · stroke_ms 30.0 · lock_on_empty true · release_on_mag_insert false · rack_empty_cycles true · drop_mid_cycle "finish". New signal bolt_reached_rear fires once per rearward stroke — the hook point for slice 4's casing eject (eject itself not built). New tests/bolt_check.gd (90 checks, wired into tests.yml). Two bugs found by tests and fixed in the same commit: the editor's type_table() returned the bolt-only base table so markers/accepts_mag read null (fixed — merged base+extension view via ItemSpec._merged_type_table, single source of truth, +5 regression checks); a freeze-test race (re-grab + drop one idle frame apart misses the physics frame — test-side 0.2 s settle, no gameplay impact).

  • Tertiary grip tier (d67ce6f). Grip points carry a tier: primary (first grab), secondary (grabbable only while primary is held), tertiary (gun elements — bolt, mag setups). Tertiary builds as GrabPoint.Mode.GENERAL, so it never counts for the two-hand condition. The handgun's bolt grip point is now tertiary (was secondary).

  • Toolkit UIX v2 — the dock/stage/schema v2 pass (1b37777, a8101d6). The authoring layer was v2dev-only: a converted item showed EMPTY in the dock, and any edit wrote v2dev keys into the v2 file. The edit model is now split by field — the JSON spine or the prefab scene, depending on what the field is. Schema gains shape-aware accessors (object/controller/model/properties/grip points/assembly branch on v2 vs v2dev), a spatial routing layer (_v2_route maps v2dev paths to spine or spatial), and spatial-aware grip/collider/marker/assembly helpers; poses, origins, travel, mode poses, refpoints, markers, and colliders live in the spatial dict for v2, identity/tuning/mode-name lists live in the spine, and origins are never written for v2 (the origin is the model node's rest pose, model-owned). The stage holds the item plus its spatial dict — loaded from the prefab scene for scene-backed items via ItemDataV2.spatial_for (PackedScene state, never instanced), or from the item's own inline spatial; collect_item() returns the spine, collect_spatial() the spatial, and save_spatial_to_prefab() writes it back into the prefab. The prefab author gains headless spatial write-back (apply_spatial_to_root) and branches add_component modes (v2 name list vs v2dev dict). The stand-in accepts a v2 model string (wireframe cube, no abort). The dock keeps a _prefab_spatial copy with a _spatial_dirty flag, renames its sections to the UI-map names for v2 items (Object / Properties / Assembly / Grips), and saves both sides for a scene-backed item (JSON spine here, prefab through the editor when open or headlessly from the spatial copy when not). The editor suites are reworked to the v2 surface on the REAL pistol and mag (values from the prefab scene via the loader, never synthetic v2dev data): inline-spatial temps for the save/collect round-trips, a dedicated prefab round-trip test, and the bolt-origin edit replaced by a model-default display assertion plus a travel edit. Three gaps the suites found and fixed in a8101d6: the stage never loaded a scene-backed item's spatial (new spatial_values_for_item helper; the no-arg spine-only read contract is unchanged), grip_hand_pose returned a zero pose for a hand with no entry (every side read as custom), and the check found the primary grip row by index (the converted file lists grips alphabetically — JSON.stringify sorts keys — so the bolt row comes first).

  • Legacy-JSON migration (689fba9). All 11 devkit items converted to item-data-v2 on disk, scene-backed by their sibling prefab .tscn (scripted fold via one-shot tests/migration_convert.gd, not committed: inject spatial: {source: "scene", ...}, run ItemDataV2.convert_v2dev, write JSON.stringify(v2, "\t"), verify by re-parse + exact round-trip and legacy_spatial_fields empty on every file). The inline items — deadair primitives, testgun, example module — stay inline, unconverted, by scope. Line endings preserved (the 6 CRLF files stay CRLF). The hardened loader adds legacy_spatial_fields (single source of truth for legacy spatial data), _warn_legacy_fields (a scene-backed v2dev dict warns at load; converted files load with zero warnings), and the convert_v2dev scene-injected guard (inline values are never copied out when a scene is injected). One deviation from the replay bundle: _pose_dict/_pos_array normalize -0.0 to 0.0 — basis math hands back -0.0 components, numerically zero but formatted as "-0.0" in the dock (the fire_select mode lines read rot (-0.0, 0.0, 0.0)); data-neutral. The four updated check files land with it (item_data_v2_check 1151, item_scene_prefab_check 377, item_prefab_author_check 147, item_binding_check 21). Loaded-state identity, proven by snapshot diff: pre (v2dev) vs now differs in exactly 15 places — the 11 format_on_disk markers plus the 4 registry.model_path fixes from the one-liner below; the v2 dict, element, definition, and registry spec fields are otherwise IDENTICAL for all 11 items across all three load paths. Audit: zero gaps (10 of 11 items no inline-vs-scene difference beyond 1 mm / 0.05°; the handgun's 3 scene-only entries are expected: trigger origin from the model node, trigger travel pos [0,0,0] canonicalization, bindings shape A).

  • Staging scene carries scene-backed items (2019e75). The hands, bolt sim, rack/fire, fire-select, grip driver, and stage gizmos exist only in the staging scene, and since the scenes transition the dock refused to load a scene-backed item into an open stage — stranding all of them behind a stage no scene-backed item could open (Zach's in-editor report, 2026-11-15: gun visible, no hands, no test animations). The dock now loads the focused item into an open stage whether or not it is scene-backed (the stage rebuilds from the prefab's spatial, so a focus change always swaps the stage to the new item — it can never show another item's build), and Open staging scene opens the stage for scene-backed items too. The prefab stays openable from a new Open prefab toolbar button (node-level editing still happens there; the button shows only for scene-backed items). The dock reads the stage's spatial when the stage carries the focused item; the spine stays dock-side, and the five stage-collect handlers keep it that way instead of swapping in the stage's load-time spine copy (which would revert unsaved spine edits). Save collects a stage-open scene-backed item's spatial into the prefab. The Trigger slider is NOT changed — it curls the preview hand's trigger finger, as always; animating the trigger node itself was never built and is not in this commit. New editor checks (433 ok): the dock loads the pistol into an injected stage (hands, bolt slider, rack, fire-select, focus swap, stage-open save round-trip with a temp prefab + temp JSON).

  • Dock margins + native value editors (5acf34f). The dock content sits in a MarginContainer (section indent sides, container separation top/bottom); section bodies indent under their headers; every hand-built row goes through _row() with the theme HBox separation — all spacing from the live editor theme, default-theme fallbacks headless. _make_spin() returns a flat EditorSpinSlider in the editor, SpinBox headless; Vector3 rows use the Inspector pattern (lowercase x/y/z in property_color_x/y/z, ° on rotations); box colliders use the Inspector AABB pattern (bounds grid + rot row, replacing three Vector3 rows); float rows return Range. New editor checks (+7, 440 ok): scroll margins, section indent, spin fallback headless, vector-row structure, bounds grid label/count/values/write-through.

  • Model path into the item definition (3f7646d, own commit). to_item_definition() copied the model dict but dropped model_path, so registry defs carried "" instead of the resolved GLB path for all 4 GLB items. Real bug, independent of the conversion (it affects v2dev GLB items too); world_scene was still correct, so the functional impact is nil, but the registry spec is now faithful. Found by the new _check_item_v2 element-vs-registry comparison.

  • One property tree per item (f0b3343, 3c8e348). The handgun's bolt table moved from base b_properties.weapon to b_properties.weapon_onehand; the base table is gone. Schema helpers (property_tree_keys / import_property_tree / set_custom_property_tree, bolt_table_of / bolt_knob_set, addable_markers / add_marker_value, assembly_add_assigned, grip_point_with_role / set_grip_point_role) back the rebuild's add-flows and one-tree presentation.

  • Item-data-v2 (extends the item-v2 half of this PR — Zach, 2026-11-15, major breaking change, build authorized). The four-section JSON struct above is stored as item-json-v2dev; the new system is item-data-v2. Three surfaces, one value each: scene = structure + spatial (node tree, model, reference points, colliders, how the object looks); JSON = identity + tuning + registry (the spine that references the scene and scripts); GDScript = behavior, attached as part of both. Phase 1 (f3852f3, 104f4df): format + versioning + autoconverter — new modules/deadair/src/items/item_data_v2.gd (the format definition lives in its header comment); detection is the "format" key ("item-data-v2" = v2, no key = v2dev autoconverted in memory, stamped source_format); JSON keeps format/id/identity/controller/model (string reference only)/properties (one tree per item; refpoints is a name manifest)/assembly (object node-name reference, modes as a list of mode names)/grips (role, object, mirror, per-hand {driver, state}); the scene takes all spatial numbers. The seam is ItemDataV2.spatial_for(v2) → _spatial_from_scene(), returning one normalized flat spatial dict. Phase 2 (228bdf8, b8bcd79, 7384d15, f82418d): scene prefabs for all 11 devkit items (handgun first) — the reader uses PackedScene.get_state() ONLY, no instancing at load, so no mod script runs at load time; discovery is a sibling .tscn next to the JSON (the loader injects spatial: {source: "scene", ...}); for a scene-backed item the prefab IS the world scene. Zero .json files changed in either phase. Phase 3 (6c6b8e1, d184f88): the toolkit as scene authoring + prefab tool — new DAItemPrefabAuthor (addons/da_item_editor/item_prefab_author.gd) with dual-write add/remove flows (add a bolt component → node in the prefab scene AND the item-data entry; no spatial numbers ever land in the JSON, no tuning values ever land in the scene); the prefab is the staging surface for scene-backed items ("Open prefab scene"); the JSON side is the tuning panel per the UI map. New suites: item_data_v2_check (1320 checks), item_scene_prefab_check (333), item_prefab_author_check (147). Follow-up (e630995): prefab Model instances editable in the editor — the dock enables Editable Children on the prefab's Model instance when a prefab scene opens (saves only when it changed), the author enables it at prefab creation, and all 11 devkit prefabs carry [editable path="Model"], so the GLB's parts show in the scene hierarchy with their names. Viewing-only rule: never save an override on a model part (a part that needs moving belongs in Blender or in the prefab's own sibling markers) — an override inlines the part's mesh and orphans into a phantom duplicate on a GLB rename, while the marker itself is keyed by instance path and survives renames. Caveat: the packer only records [editable] for instance roots, so the 7 primitive-built prefabs lose the marker on an editor re-save (their parts are plain scene nodes, already visible, so nothing is lost in practice); the 4 GLB-backed prefabs keep it stably.

Commits (12, on object-grip-overhaul, base f9919ea)

Head: d840df2. Trimmed 2026-11-16 from 22 commits — the margins commit d949417 and the 9 split commits 462e9da–a8c54d1 were removed (the hybrid inspector rebuild supersedes them; the rebuild goes on its own branch). History before the trim: 26 commits at 5acf34f, squashed to 13 at d949417, plus 9 split commits at a8c54d1.

  1. 5eda2d7 Item format v2 (issue #47) — e79c9a2 + 8712fbe squashed
  2. 45699d0 resave object json (merith-tk)
  3. 016363f Revert test gun magwell to a point rail
  4. 7ec9e1c Grip driver runtime (issue #46) (merith-tk)
  5. 4b65716 modtool_meta.json is editor-only
  6. 0763069 Rename gun_slide -> gun_bolt
  7. e28fd27 Mag rail t uses the hand's current-frame position (shape b)
  8. f49ffc2 Slice 5: bolt slams on fire and locks on the last round (issue #42)
  9. 71ff6f9 DA Mod Editor: rebuild the dock — single pane, Inspector-style (issue #47 Phase 3)
  10. a8ed817 Grip data fixes for the rebuild
  11. 9194c95 Wire grip_driver_check into CI
  12. d840df2 Item: carry model_path into the item definition

Verification (current head d840df2, trimmed)

  • Double --import: 0 errors both passes. python3 tools/check.py: 6/6.
  • Full headless battery: TOTAL_OK=2046, 37 PASS, 2 FAIL — the known mag reds only (mag_filo 31, mag_interaction 50). The 8-check drop from the 2054 bar is exactly the margins suite checks (scroll margins, section indent, spin fallback, vector rows, bolt travel, collider bounds grid) that tested the trimmed d949417 work. Editor suites on the real pistol: item_editor_check 395, item_editor_manage_check 111, grip_driver_check 82, bolt_check 90 — all PASS, 0 script errors. Script errors are the known noise only (level_loader.gd:47 add_child-on-null, firearm is_trigger_down).
  • Bridge e2e under xvfb-run (not --headless): PASS, exit 0.
  • The 5 deleted scene suites (item_data_v2, item_scene_prefab, item_prefab_author, item_binding, rig_skip) report N/A — removed by the revert.

The two failing suites — stack fallout, not a mag regression

mag_filo_check (31 ok, was 47) and mag_interaction_check (50 ok, was 69) fail on the same mechanism, traced in code and confirmed by re-running both suites:

  • stack is gone per #47, so max_stack is 1 and ItemInstance.create(id, 60) now makes a count-1 round. Magazines.load_from_stack moves mini(room, stack.count(), n) rounds, so a test that loads "2 regular" or "10 regular" from a count-N stack now moves 1, and every downstream check (13 rounds, FILO order, rack counts, the 60-stack eject scenario) fails with it.
  • This is fallout of the decided stack removal, not a broken mag: the mag stores individual rounds (load_from_stack creates one count-1 child per round moved; make_loaded fills with individual instances), and the game spawn path already handles non-stackable items by spawning N separate copies (game.gd). The mag still loads, holds, and ejects individual rounds; FILO order is preserved in the children list.
  • Decided (Zach, 2026-11-14): the in-game ammo source is loose rounds — a round held in the grip, or ejected from a container (hold trigger to show the bullet), brought to the mag opening; mag-to-mag transfer supported; ammo boxes follow the same logic as a mag but carry no gun tag. Volume rule: mags and bullets do no collider checks inside a volume — a loose round in a volume can't be picked up by a mag, and a round can't be inserted into a mag loose in a volume, but a round CAN be inserted into an ammo box loose in a volume (bulk sorting). These two suites get redesigned around that model; that redesign is the biggest remaining item on this branch.

Known gaps and caveats (stated plainly, not hidden)

  • Editor round-trip: values yes, order no — ACCEPTED. Loading the handgun and saving it back produces identical parsed values, but inner key order is re-sorted alphabetically by JSON.stringify (a point's role, object, both comes back both, object, role), and "schema": 1 becomes "schema": 1.0. Zach (2026-11-15): alphabetical order is fine; a byte-identical round-trip via a custom order-preserving serializer is a parked later patch.
  • Bolt tracking: built (slice 5). The bolt grip point follows Handgun_Upper's live transform; the bolt moves on fire and locks on the last round. (Was: static point only.)
  • Driver evaluation: built (25b37ca) + editor surface (Part C). trigger_rest → trigger_full blending by analog pull; HandView.set_finger_pose; driver picker + trigger slider + grip preview in the editor. The viewport click itself still needs Zach's in-editor check — headless cannot prove the click → EditorSelection → dock glue (the mapping and dock-side selection are suite-proven).
  • Docs not regenerated. docs/modding.md, MECHANICS.md, mechanics.json still reference generic_pistol in places.
  • Pistol HUD shows SAFE initially (modes [safe, semi], index 0) — expected from modes-from-file-order.
  • Example gun accepts_ammo is an inference (it takes the handgun mag).
  • Item-data-v2 open items (stated plainly, not hidden). Scene references are by sibling-.tscn convention, not declared in the JSON — Zach's direction is that the JSON defines which scenes an object references, but migrating the devkit JSONs to declared references means editing them, which needs his go; the JSON-declared path already exists as the override (converter honours a scene-source spatial; native v2 files carry it). The stale-inline-coordinates wart is GONE as of 689fba9 — the 11 devkit JSONs no longer carry inline spatial data (the loader warns if any ever reappears). Duplicate copies the JSON only (the copy comes out inline); Delete deletes the JSON only (orphans the prefab). Mode poses show as display lines in component details; posing a mode from the dock runs through the staging scene, which carries scene-backed items since 2019e75. The trigger node is still not animated in the editor — the Trigger slider curls the preview hand's trigger finger only; animating the trigger node itself was never built. Not scene-backed: deadair primitives, testgun (2), example module (3) — all stay inline by scope, asserted by the prefab suite.

Not in this PR

The mag test redesign around loose rounds, the float cap (0.1 mm round-on-save + normalize-on-load), doc regeneration, the fire-select input-binding change, and casing eject (slice 4; hook bolt_reached_rear wired at t=1). Issue #46 is subsumed by this format — d_grips is its recommended shape.

Update 2026-11-16 (revert to item-json-v2dev + squash, d949417): per Zach's "for now" call, the branch is back on the item-json-v2dev format (a_object/b_properties/c_assembly/d_grips with inline spatial). The scenes work is reverted, not deleted: the design survives on spike/refpoint-binding, in ~/workspace/migration-v2/ and ~/workspace/uix2/, and in the generator at ~/workspace/phase2-staging/gen_item_scenes.py on the VM. The UIX gains stay: the dock rebuild and the margins + native value editors are in the history below.

Update 2026-11-16 (toolkit split: ranges table, real margins, section modules, a8c54d1): per Zach's "break up and organize the mod toolkit to not be monolithic GDScripts? I want to manually adjust the slider ranges, also there isnt any real margin changes" + "OKAY revert landed, go ahead and do that please." The dock is split into one file per concern; behavior is identical except the two explicit items below. Nine commits on top of d949417, all NORMAL pushes, head a8c54d1.

  • Ranges table (462e9da). Every slider's min/max/step lives in one table, DAItemEditorRanges in addons/da_item_editor/item_ranges.gd — const RANGES with keys pos [-10,10,0.001], rot [-360,360,0.1], unit [0,1,0.01], value [0,100000,1], weight [0,100000,0.01], data [-100000,100000,0.01], bolt_knob [0,100000,1], size [0.001,10,0.001]; range_for(key) + apply_range(spin, key). The row factories take a range key instead of three numbers; the trigger and bolt sliders apply the unit range through the same table. No range is hardcoded at a call site afterwards. Values are the ones the dock always used, only relocated — Zach adjusts them himself. Proven to drive the sliders: changing value to [0,500,5] in the table moved only the Value slider to 0/500/5 in a headless dock probe, then reverted. To edit: change a triple in RANGES (min, max, step); ranges are soft bounds (spins allow typing outside).
  • Real margins (478a084). Spacing is explicit values in DAItemEditorSpacing (addons/da_item_editor/item_spacing.gd): sides 12, top/bottom 5, section gap 4, section indent 12, body separation 8, row separation 6, grid separation 6. The theme constants are gone (they resolved to ~4-6 px and read as no padding). Constraint found while verifying: the suite sizes the dock to 240 px and asserts the collapsed content needs no scrollbar, and the baseline was already exactly at that limit (range 0.0) — six 31 px headers + 11 gaps + margins must fit 240, so 8 px section gaps would need that check revisited; the gap stays 4 and top/bottom 5. The visible padding is carried by the sides (12) and indent (12) and the 8 px body separation. Verified with xvfb screenshots (1920x1080, handgun loaded): side inset +12 px, section indent +12 px, rows visibly separated; pose values unchanged (pos 0.0 / -0.061 / 0.053, rot 90.0 / 0.0 / 0.0). Screenshots in ~/workspace/dock-split/ (after_full/dock/handgun/pose/pose_zoom).
  • Value editors (72294a1). The row factories move verbatim into DAItemEditorWidgets (addons/da_item_editor/item_widgets.gd) as static factories — _row, _make_spin, _make_v3_row, _make_aabb_row, _make_float_row, _make_text_row, _make_bool_row, _note, _add_detail_line, _fmt_pose, _row_stylebox, plus the axis-color helper. The dock keeps one-line delegates with the same names and signatures, so call sites and the suite do not change.
  • Section split (3bb6179, f928e01, 36bea12, a45cbf4, f94e309, a8c54d1). dock.gd 3264 → 833 lines. Each section is a RefCounted collaborator holding an untyped var dock (typing it DAItemEditorDock would be a cyclic class reference); the dock creates the instances in _ready() before _build_ui(), keeps all member-var declarations and the spine (_ready, editor hooks, _build_ui, section shell, load/save, selection, _refresh_sections as orchestrator, _fill_model_node_picker), and keeps thin delegates for every method the suites call or that is public API. Module map: dock_section_item.gd (417 lines: Item list/filter/new-item form/duplicate/delete, References, dialogs; TEMPLATE_LABELS moves with it, TEMPLATE_KINDS read as DAItemSchema.TEMPLATE_KINDS) · dock_section_object.gd (297: a_object fields + colliders) · dock_section_props.gd (806: b_properties, data table, states, bolt knobs, marker list, _data_*/_tree/_parse_scalar) · dock_section_assembly.gd (389: c_assembly + components; COMPONENT_TAGS moves with it; SELECTED_FONT_COLOR duplicated there with a sync comment, the suite pins the dock's copy) · dock_section_grips.gd (562: d_grips) · dock_stage_controls.gd (191: grip preview, bolt sim, reference selection; its handlers are delegated because the Item, assembly, and grips sections connect to them through the dock). Two mechanical consequences of the untyped dock reference, both behavior-neutral: var x := dock.... cannot infer, so those declarations use plain = in the sections (including transitively, where a value derives from an untyped dock value); bare add_child(...) in moved code becomes dock.add_child(...).

Head: a8c54d1 (22 commits on f9919ea). Tree is byte-identical to the pre-squash reverted tree (5013453, verified with an empty diff before the force-push).
Trimmed out 2026-11-16 — these 9 commits plus d949417 are no longer on the branch; head is now d840df2, 12 commits.

Commits (all on f9919ea):

  1. 5eda2d7 Item format v2 (issue #47) — e79c9a2 + 8712fbe squashed
  2. 45699d0 resave object json (merith-tk)
  3. 016363f Revert test gun magwell to a point rail
  4. 7ec9e1c Grip driver runtime (issue #46) (merith-tk)
  5. 4b65716 modtool_meta.json is editor-only
  6. 0763069 Rename gun_slide -> gun_bolt
  7. e28fd27 Mag rail t uses the hand's current-frame position (shape b)
  8. f49ffc2 Slice 5: bolt slams on fire and locks on the last round (issue #42)
  9. 71ff6f9 DA Mod Editor: rebuild the dock — single pane, Inspector-style (issue #47 Phase 3)
  10. a8ed817 Grip data fixes for the rebuild
  11. 9194c95 Wire grip_driver_check into CI
  12. d840df2 Item: carry model_path into the item definition
  13. d949417 Dock: Inspector spacing + native value editors (issue #48) — rebased onto the v2dev dock
  14. 462e9da Dock: slider ranges in one table (issue #48)
  15. 478a084 Dock: explicit spacing values, not the theme (issue #48)
  16. 72294a1 Dock: value editors live in DAItemEditorWidgets (issue #48)
  17. 3bb6179 Dock: Item section lives in DAItemEditorItemSection (issue #48)
  18. f928e01 Dock: a_object section lives in DAItemEditorObjectSection (issue #48)
  19. 36bea12 Dock: b_properties section lives in DAItemEditorPropsSection (issue #48)
  20. a45cbf4 Dock: c_assembly section lives in DAItemEditorAssemblySection (issue #48)
  21. f94e309 Dock: d_grips section lives in DAItemEditorGripsSection (issue #48)
  22. a8c54d1 Dock: stage controls live in DAItemEditorStageControls (issue #48)

Note on the squash list: the plan's item 13 (a reworked dock/stage v2dev pass from 1b37777/a8101d6/2019e75) collapsed — there is no separable UIX gain to carry. The dock pass's new functions are all v2/prefab machinery (_spatial, _prefab_root, _mark_prefab_dirty, _on_open_prefab, _on_pick_script/_on_attach_script, _take_stage_collect, _rename_sections); the UI-map section names are identical at b7b77c5 and 2019e75 (they came from the dock rebuild), the stage was already the editing surface at b7b77c5, and _take_stage_collect guards a hazard that does not exist in v2dev form (no separate spatial to collect). The reverted tree's editor is the b7b77c5 editor + margins, and the squashed [12] already contains that editor, so a separate pass commit would be empty. 13 commits, not 14.

Verification on the reverted tree (head 5013453, re-checked on the squashed head d949417 for import/check.py/editor suites):

  • Double --import: 0 errors both passes. check.py: 6/6.
  • Battery (v2dev baseline, re-established): TOTAL_OK=2054, 37 PASS, 2 FAIL — the known mag reds only (mag_filo 31, mag_interaction 50; item_scene_prefab is gone with its suite). The 5 deleted scene suites account for the drop from the scenes-era 3868 (item_data_v2 1320 + item_scene_prefab 321 + item_prefab_author 147 + item_binding 21 + rig_skip 14 = 1823). rig_chains PASS (64 checks) and twist PASS on top of the runner total. Script errors are the known noise only (level_loader.gd:47, firearm is_trigger_down).
  • Model forms load: test_gun pistol (scene path), handgun (GLB path), rifle (primitive dict) — 8/8 checks PASS.
  • Editor suites on the real pistol: item_editor_check 403 ok, item_editor_manage_check 111 ok, grip_driver_check 82, bolt_check 90 — all PASS, 0 script errors.
  • Bridge e2e: PASS (xvfb-run).

Verification at the split head a8c54d1 (re-run per split commit, same numbers every time): double --import 0 errors both passes; check.py 6/6; full battery TOTAL_OK=2054, 37 PASS, 2 FAIL (the known mag reds only, mag_filo 31, mag_interaction 50); editor suites on the real pistol item_editor_check 403, item_editor_manage_check 111, grip_driver_check 82, bolt_check 90 — all PASS, 0 script errors; bridge e2e under xvfb-run PASS, exit 0, 142 ok checks.

Still open / not merged: the no-merge condition stands. The collider-details toggle MOUSE_FILTER_IGNORE defect and the trigger-node animation are still unauthorised, not fixed here. Zach's local broken generic_handgun.tscn was his own metadata experiment; the committed prefab is deleted by this revert anyway.

Resync: the branch was rewritten — fetch and reset --hard to d949417 before pushing to it again.

# Item JSON format v2: data changes (issue #47) The data half of #47: every item file, both loaders, and the rename blast radius. The editor reads and writes the new shape (minimal adaptation — no redesign, no new features). This branch has since grown past the data build — it now also carries the grip-driver runtime, the gun_bolt rename, the mag-rail fix, grip-pose slice 5 (bolt slam + lock), and the Phase 3 UIX rebuild. The UIX rebuild still needs Zach's in-editor check of the viewport click itself. No merge until item-v2 + toolkit-uix-v2 + grip-pose-v2 all land (Zach, 2026-11-15). Update 2026-11-16 (trim, `d840df2`): the branch was trimmed to the work the new plan needs. The 10 tip commits are gone — the margins commit (`d949417`, Inspector spacing + native value editors) and the 9 toolkit-split commits (`462e9da`–`a8c54d1`, ranges table, explicit spacing, value editors, one file per section, stage controls). The rebuild deletes every file they touch, so they are no longer needed on #48; the dock rebuild stays as the working dock. The hybrid inspector rebuild goes on its own branch (`toolkit-inspector-rebuild`, base `d840df2`). The deferred items are recorded on issue #47 (comment 1085). Head is now `d840df2`, 12 commits. The ranges table's numbers are preserved in the UIX map (`dead-air-editor-uix-map.md`), not lost with the trim. Update 2026-11-16: the toolkit-uix-v2 pass and the legacy-JSON migration have landed (commits below, verification below). The dock/stage/schema now edit v2 items (spine in the JSON, spatial in the prefab), and all 11 devkit item JSONs are item-data-v2 on disk, scene-backed. The editor suites are green on the converted files. Update 2026-11-16 (later): the staging scene carries scene-backed items again (`2019e75`). The hands, bolt sim, rack/fire, fire-select, grip driver, and stage gizmos had been stranded behind the stage gate since the scenes transition — the dock refused to load a scene-backed item into an open stage. The dock now loads the focused item into an open stage whether or not it is scene-backed, and Open staging scene opens the stage for scene-backed items too; the prefab stays openable from a new Open prefab button. The trigger node itself is still not animated in the editor — the Trigger slider was always a hand-curl input, never a trigger control; that is a separate, unauthorised fix. Update 2026-11-16 (dock margins + native value editors, `5acf34f`): the dock looked like a debug dump because it hand-rolled every row with no margins — fixed. The dock content now sits in a MarginContainer (Inspector section indent on the sides, one container separation top/bottom), each section body indents one section indent under its header, and every row goes through one helper with the theme HBox separation; all spacing is read from the live editor theme. Value editing now uses the native controls where reachable: a `_make_spin()` factory returns a flat EditorSpinSlider in the editor (SpinBox headless, same Range contract), Vector3 rows follow the Inspector pattern (lowercase x/y/z labels in the theme axis colors, ° suffix on rotations), and box colliders get the Inspector AABB pattern (one bounds grid — pos x/y/z + size w/h/d — plus a rot row). True built-in EditorProperty editors cannot be instantiated from GDScript (the concrete EditorProperty* classes are not in ClassDB), so the native path is EditorSpinSlider directly, not an embedded Inspector. Vector2/Vector4 have no dock values today; ints/strings/bools/enums are unchanged (LineEdit/CheckButton/OptionButton already match the Inspector). Verified in the editor under xvfb with the handgun loaded: margins render, float sliders are flat native sliders, pose rows show colored x/y/z with ° on rotations. One pre-existing defect surfaced, NOT fixed here: the collider details ▸ toggle has MOUSE_FILTER_IGNORE (base head, dock.gd:2146), so a box collider's details cannot be expanded by mouse in the editor — the bounds grid itself is proven by suite (6 sliders, values, write-through) but its on-screen render was not directly observed. ## What changed - **Four sections, in order.** Item files are now `a_object` (controller, name, model, tags, value/weight, colliders) / `b_properties` (per-type tables: `weapon_onehand` with `accepts_mag` / `accepts_ammo`, `data`, `refpoints`, `states`) / `c_assembly` (fire_select, bolt, trigger) / `d_grips` (grip_points). - **Loaders.** `ItemDefinition.from_dict()` and `ItemSpec` read the four sections, resolve namespaced paths, and resolve the new `controller` field through the `deadair:controller/...` registry (absent = `generic_object`). The loader resolves extension keys: `weapon_onehand` counts as `weapon` for `is_type("weapon")`. The old shape loaded through a fallback compose layer while the migration landed; the fallback is now removed. - **Migration.** All item JSONs converted (scripted fold: `grip_offset` / `grip_rotate` into explicit `grip_points` primary poses — the fold equals the old composed runtime pose). `reload_time` and `stack` dropped. `value` / `weight` moved into `a_object` (optional, default 0). Colliders moved to `a_object.colliders` (box, mesh, convex, sphere, cylinder). Bolt origin z `0.00004` → `0.0`. Travel lives only in `assembly` — no travel in grip points. - **Renames.** Generic pistol → generic handgun: file, item id, mag id, GLB and textures (`devkit:weapon/gun/generic_handgun`, `devkit:mag/generic_handgun`, `devkit:ammo.9mm`). `holster.hip` is gone; the slot is `devkit:weapon.secondary`. Controller is `deadair:controller/generic_weapon` — the object controller and the grip controller are one thing. `gun_slide` → `gun_bolt` (bolt is the general term; `slide` is reserved for pump-action shotguns with their own handler); assembly part `slide` → `bolt`, grip point `slide` → `bolt`, driver `slide_grip_pose` → `bolt_grip_pose`. The editor's internal slide-sim identifiers (`slide_amount`, `set_slide_amount`, `play_slide_cycle`, `_slide_*`, `SLIDE_*`, dock "Slide" header) are renamed to bolt as well. - **Blast radius.** Registry, tests/suites, bridge, start kit, and the editor references follow the renames. `examples/example_module/items/example_gun.json` was also migrated (its accepts_mag/ammo point at the handgun mag — an inference, see below). - **Editor (minimal, data-only).** Schema, stage, and dock read the four-section shape; the editor round-trips values correctly. No layout or behaviour changes — the redesign is Phase 3. - **UIX rebuild, Phase 3 — full rebuild (`74bb4e4`, `fbe68b2`, `2bf6e7e` reskin, superseded; `d67ce6f`, `f0b3343`, `3c8e348`, `2864c86` rebuild).** The reskin landed first (Inspector-style dock, click-to-select, Selected tab + driver surface) and was then thrown out on Zach's call — "EFFECTIVELY we are completely throwing out what we have and rebuilding it." The rebuilt dock is a single pane, no tabs, no status line: sections in JSON order (Item, a_object, b_properties, c_assembly, d_grips, References), each a flat inline Inspector-style header (▸/▾ + bold title, no dark-band body). Collapsed, the body is 206 px tall and needs no scrollbar. FileSystem integration: opening/focusing a mod item JSON (a_object check) in the FileSystem dock or script editor focuses that item; a .tscn focuses its owning item. Markers are added to the list (grip right/left default), each carrying a tier (primary / secondary / tertiary — tertiary maps to the runtime GENERAL mode, so a bolt grip never counts for the two-hand condition). Components add + assign in one step (object + tag, add row at the top); the bolt is a component like any other — adding it creates `c_assembly.bolt` and its UI lives on the component row, no standalone Bolt section. Properties: one tree per item (import weapon / weapon_onehand / weapon_twohand, or a custom tree by JSON). Colliders create + assign in one step and are editable in the UI (pos/rot/size spins, mesh-name edit). Conditional rendering: grip pose rows, state finger fields, and section bodies render only when their subject is expanded or present. Click-to-select in the staging scene is kept from the reskin: `item_stage.selectable_for()` maps markers, rails, collider gizmos, and assembly-bound model nodes; the dock mirrors `EditorSelection`. The driver surface (picker from `GripDrivers.ids()`, trigger slider injecting pull into the stage's tree-free evaluation via `HandView.set_finger_pose`) is kept, now inside the grip pose controls. One bug caught building: a bolt origin edit would have been reverted by `collect_item()` writing stale bolt-rail ends back — fixed with `stage.refresh_bolt_rail()`. (Update 2026-11-16: the prefab is the node-level surface for scene-backed items, and the staging scene is the simulation surface for ALL items since `2019e75` — it rebuilds a scene-backed item from the prefab's spatial, so the hands, bolt sim, and test animations run on it; "Open prefab scene" is now the separate Open prefab button.) - **Grip-driver runtime (`25b37ca`).** `GripDriver` base (tree-free `evaluate`, default-inheritance state resolution), `GripDrivers` registry (`static_grip_pose` / `gun_grip_pose` / `bolt_grip_pose`), `GunGripDriver` (trigger_rest → trigger_full blend by analog pull), `HandView.set_finger_pose` (per-finger curl + spread + thumb opposition). New `tests/grip_driver_check.gd` (82 checks, wired into tests.yml by `cbb91fd`). The driver surface (picker, trigger slider, grip preview) is in the rebuilt dock's grip pose controls. - **modtool_meta is editor-only, ignored everywhere (`13b93a7`, `7b3c6cd`).** `*.modtool_meta.json` files carry no game data; the editor scan and the runtime loader both skip them. - **Mag rail `t` fix (`245eb97`, shape b).** While a mag is snapped, `_snap_t` was computed from the hand follower's previous-frame position (one physics tick stale, ~2.5 mm at slide speed). Now `HandFollower.desired_global_transform()` computes the follower's desired position for the current frame, shared by the follower and `_update_snap`. Proving test in `item_follow_check` (drive the grip at 0.15 m/s, assert the mag's rail pose against the hand's current rail projection, <1 mm). - **Slice 5: bolt slam + lock (`f9f92fb`).** `Firearm` holds `bolt_t` 0..1 + `bolt_locked`; `fire_once()` drives the bolt to 1 then springs it back (default 250 ms, tunable); on the last round (chamber empty + mag empty) it stays at 1 (locked); `rack()` releases the lock and chambers from a fresh mag. The bolt node is posed per physics frame as origin + t·travel from `c_assembly.bolt`, and the bolt grip point is recomputed from the node's live transform every frame. Bolt behaviour is tuned in `b_properties.weapon_onehand.bolt` (moved there from the base `weapon` table by `f0b3343` — the handgun carries exactly one property tree, and the editor never authors split trees): `dry_fire_primes` false · `snap_back_ms` 250.0 · `stroke_ms` 30.0 · `lock_on_empty` true · `release_on_mag_insert` false · `rack_empty_cycles` true · `drop_mid_cycle` "finish". New signal `bolt_reached_rear` fires once per rearward stroke — the hook point for slice 4's casing eject (eject itself not built). New `tests/bolt_check.gd` (90 checks, wired into tests.yml). Two bugs found by tests and fixed in the same commit: the editor's `type_table()` returned the bolt-only base table so markers/`accepts_mag` read null (fixed — merged base+extension view via `ItemSpec._merged_type_table`, single source of truth, +5 regression checks); a freeze-test race (re-grab + drop one idle frame apart misses the physics frame — test-side 0.2 s settle, no gameplay impact). - **Tertiary grip tier (`d67ce6f`).** Grip points carry a tier: primary (first grab), secondary (grabbable only while primary is held), tertiary (gun elements — bolt, mag setups). Tertiary builds as `GrabPoint.Mode.GENERAL`, so it never counts for the two-hand condition. The handgun's bolt grip point is now tertiary (was secondary). - **Toolkit UIX v2 — the dock/stage/schema v2 pass (`1b37777`, `a8101d6`).** The authoring layer was v2dev-only: a converted item showed EMPTY in the dock, and any edit wrote v2dev keys into the v2 file. The edit model is now split by field — the JSON spine or the prefab scene, depending on what the field is. Schema gains shape-aware accessors (object/controller/model/properties/grip points/assembly branch on v2 vs v2dev), a spatial routing layer (`_v2_route` maps v2dev paths to spine or spatial), and spatial-aware grip/collider/marker/assembly helpers; poses, origins, travel, mode poses, refpoints, markers, and colliders live in the spatial dict for v2, identity/tuning/mode-name lists live in the spine, and origins are never written for v2 (the origin is the model node's rest pose, model-owned). The stage holds the item plus its spatial dict — loaded from the prefab scene for scene-backed items via `ItemDataV2.spatial_for` (PackedScene state, never instanced), or from the item's own inline spatial; `collect_item()` returns the spine, `collect_spatial()` the spatial, and `save_spatial_to_prefab()` writes it back into the prefab. The prefab author gains headless spatial write-back (`apply_spatial_to_root`) and branches `add_component` modes (v2 name list vs v2dev dict). The stand-in accepts a v2 model string (wireframe cube, no abort). The dock keeps a `_prefab_spatial` copy with a `_spatial_dirty` flag, renames its sections to the UI-map names for v2 items (Object / Properties / Assembly / Grips), and saves both sides for a scene-backed item (JSON spine here, prefab through the editor when open or headlessly from the spatial copy when not). The editor suites are reworked to the v2 surface on the REAL pistol and mag (values from the prefab scene via the loader, never synthetic v2dev data): inline-spatial temps for the save/collect round-trips, a dedicated prefab round-trip test, and the bolt-origin edit replaced by a model-default display assertion plus a travel edit. Three gaps the suites found and fixed in `a8101d6`: the stage never loaded a scene-backed item's spatial (new `spatial_values_for_item` helper; the no-arg spine-only read contract is unchanged), `grip_hand_pose` returned a zero pose for a hand with no entry (every side read as custom), and the check found the primary grip row by index (the converted file lists grips alphabetically — `JSON.stringify` sorts keys — so the bolt row comes first). - **Legacy-JSON migration (`689fba9`).** All 11 devkit items converted to item-data-v2 on disk, scene-backed by their sibling prefab `.tscn` (scripted fold via one-shot `tests/migration_convert.gd`, not committed: inject `spatial: {source: "scene", ...}`, run `ItemDataV2.convert_v2dev`, write `JSON.stringify(v2, "\t")`, verify by re-parse + exact round-trip and `legacy_spatial_fields` empty on every file). The inline items — deadair primitives, testgun, example module — stay inline, unconverted, by scope. Line endings preserved (the 6 CRLF files stay CRLF). The hardened loader adds `legacy_spatial_fields` (single source of truth for legacy spatial data), `_warn_legacy_fields` (a scene-backed v2dev dict warns at load; converted files load with zero warnings), and the `convert_v2dev` scene-injected guard (inline values are never copied out when a scene is injected). One deviation from the replay bundle: `_pose_dict`/`_pos_array` normalize `-0.0` to `0.0` — basis math hands back `-0.0` components, numerically zero but formatted as `"-0.0"` in the dock (the fire_select mode lines read `rot (-0.0, 0.0, 0.0)`); data-neutral. The four updated check files land with it (`item_data_v2_check` 1151, `item_scene_prefab_check` 377, `item_prefab_author_check` 147, `item_binding_check` 21). Loaded-state identity, proven by snapshot diff: pre (v2dev) vs now differs in exactly 15 places — the 11 `format_on_disk` markers plus the 4 `registry.model_path` fixes from the one-liner below; the v2 dict, element, definition, and registry spec fields are otherwise IDENTICAL for all 11 items across all three load paths. Audit: zero gaps (10 of 11 items no inline-vs-scene difference beyond 1 mm / 0.05°; the handgun's 3 scene-only entries are expected: trigger origin from the model node, trigger travel pos `[0,0,0]` canonicalization, `bindings` shape A). - **Staging scene carries scene-backed items (`2019e75`).** The hands, bolt sim, rack/fire, fire-select, grip driver, and stage gizmos exist only in the staging scene, and since the scenes transition the dock refused to load a scene-backed item into an open stage — stranding all of them behind a stage no scene-backed item could open (Zach's in-editor report, 2026-11-15: gun visible, no hands, no test animations). The dock now loads the focused item into an open stage whether or not it is scene-backed (the stage rebuilds from the prefab's spatial, so a focus change always swaps the stage to the new item — it can never show another item's build), and Open staging scene opens the stage for scene-backed items too. The prefab stays openable from a new Open prefab toolbar button (node-level editing still happens there; the button shows only for scene-backed items). The dock reads the stage's spatial when the stage carries the focused item; the spine stays dock-side, and the five stage-collect handlers keep it that way instead of swapping in the stage's load-time spine copy (which would revert unsaved spine edits). Save collects a stage-open scene-backed item's spatial into the prefab. The Trigger slider is NOT changed — it curls the preview hand's trigger finger, as always; animating the trigger node itself was never built and is not in this commit. New editor checks (433 ok): the dock loads the pistol into an injected stage (hands, bolt slider, rack, fire-select, focus swap, stage-open save round-trip with a temp prefab + temp JSON). - **Dock margins + native value editors (`5acf34f`).** The dock content sits in a MarginContainer (section indent sides, container separation top/bottom); section bodies indent under their headers; every hand-built row goes through `_row()` with the theme HBox separation — all spacing from the live editor theme, default-theme fallbacks headless. `_make_spin()` returns a flat EditorSpinSlider in the editor, SpinBox headless; Vector3 rows use the Inspector pattern (lowercase x/y/z in `property_color_x/y/z`, ° on rotations); box colliders use the Inspector AABB pattern (bounds grid + rot row, replacing three Vector3 rows); float rows return Range. New editor checks (+7, 440 ok): scroll margins, section indent, spin fallback headless, vector-row structure, bounds grid label/count/values/write-through. - **Model path into the item definition (`3f7646d`, own commit).** `to_item_definition()` copied the model dict but dropped `model_path`, so registry defs carried `""` instead of the resolved GLB path for all 4 GLB items. Real bug, independent of the conversion (it affects v2dev GLB items too); `world_scene` was still correct, so the functional impact is nil, but the registry spec is now faithful. Found by the new `_check_item_v2` element-vs-registry comparison. - **One property tree per item (`f0b3343`, `3c8e348`).** The handgun's bolt table moved from base `b_properties.weapon` to `b_properties.weapon_onehand`; the base table is gone. Schema helpers (`property_tree_keys` / `import_property_tree` / `set_custom_property_tree`, `bolt_table_of` / `bolt_knob_set`, `addable_markers` / `add_marker_value`, `assembly_add_assigned`, `grip_point_with_role` / `set_grip_point_role`) back the rebuild's add-flows and one-tree presentation. - **Item-data-v2 (extends the item-v2 half of this PR — Zach, 2026-11-15, major breaking change, build authorized).** The four-section JSON struct above is stored as **`item-json-v2dev`**; the new system is **`item-data-v2`**. Three surfaces, one value each: scene = structure + spatial (node tree, model, reference points, colliders, how the object looks); JSON = identity + tuning + registry (the spine that references the scene and scripts); GDScript = behavior, attached as part of both. Phase 1 (`f3852f3`, `104f4df`): format + versioning + autoconverter — new `modules/deadair/src/items/item_data_v2.gd` (the format definition lives in its header comment); detection is the `"format"` key (`"item-data-v2"` = v2, no key = v2dev autoconverted in memory, stamped `source_format`); JSON keeps `format`/`id`/`identity`/`controller`/`model` (string reference only)/`properties` (one tree per item; `refpoints` is a name manifest)/`assembly` (`object` node-name reference, `modes` as a list of mode names)/`grips` (role, `object`, `mirror`, per-hand `{driver, state}`); the scene takes all spatial numbers. The seam is `ItemDataV2.spatial_for(v2)` → `_spatial_from_scene()`, returning one normalized flat spatial dict. Phase 2 (`228bdf8`, `b8bcd79`, `7384d15`, `f82418d`): scene prefabs for all 11 devkit items (handgun first) — the reader uses `PackedScene.get_state()` ONLY, no instancing at load, so no mod script runs at load time; discovery is a sibling `.tscn` next to the JSON (the loader injects `spatial: {source: "scene", ...}`); for a scene-backed item the prefab IS the world scene. Zero `.json` files changed in either phase. Phase 3 (`6c6b8e1`, `d184f88`): the toolkit as scene authoring + prefab tool — new `DAItemPrefabAuthor` (`addons/da_item_editor/item_prefab_author.gd`) with dual-write add/remove flows (add a bolt component → node in the prefab scene AND the item-data entry; no spatial numbers ever land in the JSON, no tuning values ever land in the scene); the prefab is the staging surface for scene-backed items ("Open prefab scene"); the JSON side is the tuning panel per the UI map. New suites: `item_data_v2_check` (1320 checks), `item_scene_prefab_check` (333), `item_prefab_author_check` (147). Follow-up (`e630995`): prefab Model instances editable in the editor — the dock enables Editable Children on the prefab's Model instance when a prefab scene opens (saves only when it changed), the author enables it at prefab creation, and all 11 devkit prefabs carry `[editable path="Model"]`, so the GLB's parts show in the scene hierarchy with their names. Viewing-only rule: never save an override on a model part (a part that needs moving belongs in Blender or in the prefab's own sibling markers) — an override inlines the part's mesh and orphans into a phantom duplicate on a GLB rename, while the marker itself is keyed by instance path and survives renames. Caveat: the packer only records `[editable]` for instance roots, so the 7 primitive-built prefabs lose the marker on an editor re-save (their parts are plain scene nodes, already visible, so nothing is lost in practice); the 4 GLB-backed prefabs keep it stably. ## Commits (12, on `object-grip-overhaul`, base `f9919ea`) Head: `d840df2`. Trimmed 2026-11-16 from 22 commits — the margins commit `d949417` and the 9 split commits `462e9da`–`a8c54d1` were removed (the hybrid inspector rebuild supersedes them; the rebuild goes on its own branch). History before the trim: 26 commits at `5acf34f`, squashed to 13 at `d949417`, plus 9 split commits at `a8c54d1`. 1. `5eda2d7` Item format v2 (issue #47) — e79c9a2 + 8712fbe squashed 2. `45699d0` resave object json (merith-tk) 3. `016363f` Revert test gun magwell to a point rail 4. `7ec9e1c` Grip driver runtime (issue #46) (merith-tk) 5. `4b65716` modtool_meta.json is editor-only 6. `0763069` Rename gun_slide -> gun_bolt 7. `e28fd27` Mag rail t uses the hand's current-frame position (shape b) 8. `f49ffc2` Slice 5: bolt slams on fire and locks on the last round (issue #42) 9. `71ff6f9` DA Mod Editor: rebuild the dock — single pane, Inspector-style (issue #47 Phase 3) 10. `a8ed817` Grip data fixes for the rebuild 11. `9194c95` Wire grip_driver_check into CI 12. `d840df2` Item: carry model_path into the item definition ## Verification (current head `d840df2`, trimmed) - Double `--import`: 0 errors both passes. `python3 tools/check.py`: 6/6. - Full headless battery: **TOTAL_OK=2046, 37 PASS, 2 FAIL** — the known mag reds only (mag_filo 31, mag_interaction 50). The 8-check drop from the 2054 bar is exactly the margins suite checks (scroll margins, section indent, spin fallback, vector rows, bolt travel, collider bounds grid) that tested the trimmed `d949417` work. Editor suites on the real pistol: item_editor_check 395, item_editor_manage_check 111, grip_driver_check 82, bolt_check 90 — all PASS, 0 script errors. Script errors are the known noise only (level_loader.gd:47 add_child-on-null, firearm is_trigger_down). - Bridge e2e under `xvfb-run` (not `--headless`): **PASS**, exit 0. - The 5 deleted scene suites (item_data_v2, item_scene_prefab, item_prefab_author, item_binding, rig_skip) report N/A — removed by the revert. ## The two failing suites — stack fallout, not a mag regression `mag_filo_check` (31 ok, was 47) and `mag_interaction_check` (50 ok, was 69) fail on the same mechanism, traced in code and confirmed by re-running both suites: - `stack` is gone per #47, so `max_stack` is 1 and `ItemInstance.create(id, 60)` now makes a count-1 round. `Magazines.load_from_stack` moves `mini(room, stack.count(), n)` rounds, so a test that loads "2 regular" or "10 regular" from a count-N stack now moves 1, and every downstream check (13 rounds, FILO order, rack counts, the 60-stack eject scenario) fails with it. - This is fallout of the decided stack removal, not a broken mag: the mag stores individual rounds (`load_from_stack` creates one count-1 child per round moved; `make_loaded` fills with individual instances), and the game spawn path already handles non-stackable items by spawning N separate copies (`game.gd`). The mag still loads, holds, and ejects individual rounds; FILO order is preserved in the children list. - **Decided (Zach, 2026-11-14):** the in-game ammo source is loose rounds — a round held in the grip, or ejected from a container (hold trigger to show the bullet), brought to the mag opening; mag-to-mag transfer supported; ammo boxes follow the same logic as a mag but carry no gun tag. Volume rule: mags and bullets do no collider checks inside a volume — a loose round in a volume can't be picked up by a mag, and a round can't be inserted into a mag loose in a volume, but a round CAN be inserted into an ammo box loose in a volume (bulk sorting). These two suites get redesigned around that model; that redesign is the biggest remaining item on this branch. ## Known gaps and caveats (stated plainly, not hidden) - **Editor round-trip: values yes, order no — ACCEPTED.** Loading the handgun and saving it back produces identical parsed values, but inner key order is re-sorted alphabetically by `JSON.stringify` (a point's `role, object, both` comes back `both, object, role`), and `"schema": 1` becomes `"schema": 1.0`. Zach (2026-11-15): alphabetical order is fine; a byte-identical round-trip via a custom order-preserving serializer is a parked later patch. - **Bolt tracking: built (slice 5).** The bolt grip point follows `Handgun_Upper`'s live transform; the bolt moves on fire and locks on the last round. (Was: static point only.) - **Driver evaluation: built (`25b37ca`) + editor surface (Part C).** trigger_rest → trigger_full blending by analog pull; `HandView.set_finger_pose`; driver picker + trigger slider + grip preview in the editor. The viewport click itself still needs Zach's in-editor check — headless cannot prove the click → `EditorSelection` → dock glue (the mapping and dock-side selection are suite-proven). - **Docs not regenerated.** `docs/modding.md`, `MECHANICS.md`, `mechanics.json` still reference `generic_pistol` in places. - **Pistol HUD shows SAFE initially** (modes `[safe, semi]`, index 0) — expected from modes-from-file-order. - **Example gun accepts_ammo is an inference** (it takes the handgun mag). - **Item-data-v2 open items (stated plainly, not hidden).** Scene references are by sibling-`.tscn` convention, not declared in the JSON — Zach's direction is that the JSON defines which scenes an object references, but migrating the devkit JSONs to declared references means editing them, which needs his go; the JSON-declared path already exists as the override (converter honours a scene-source `spatial`; native v2 files carry it). The stale-inline-coordinates wart is GONE as of `689fba9` — the 11 devkit JSONs no longer carry inline spatial data (the loader warns if any ever reappears). Duplicate copies the JSON only (the copy comes out inline); Delete deletes the JSON only (orphans the prefab). Mode poses show as display lines in component details; posing a mode from the dock runs through the staging scene, which carries scene-backed items since `2019e75`. The trigger node is still not animated in the editor — the Trigger slider curls the preview hand's trigger finger only; animating the trigger node itself was never built. Not scene-backed: deadair primitives, testgun (2), example module (3) — all stay inline by scope, asserted by the prefab suite. ## Not in this PR The mag test redesign around loose rounds, the float cap (0.1 mm round-on-save + normalize-on-load), doc regeneration, the fire-select input-binding change, and casing eject (slice 4; hook `bolt_reached_rear` wired at t=1). Issue #46 is subsumed by this format — `d_grips` is its recommended shape. Update 2026-11-16 (revert to item-json-v2dev + squash, `d949417`): per Zach's "for now" call, the branch is back on the item-json-v2dev format (a_object/b_properties/c_assembly/d_grips with inline spatial). The scenes work is reverted, not deleted: the design survives on spike/refpoint-binding, in ~/workspace/migration-v2/ and ~/workspace/uix2/, and in the generator at ~/workspace/phase2-staging/gen_item_scenes.py on the VM. The UIX gains stay: the dock rebuild and the margins + native value editors are in the history below. Update 2026-11-16 (toolkit split: ranges table, real margins, section modules, `a8c54d1`): per Zach's "break up and organize the mod toolkit to not be monolithic GDScripts? I want to manually adjust the slider ranges, also there isnt any real margin changes" + "OKAY revert landed, go ahead and do that please." The dock is split into one file per concern; behavior is identical except the two explicit items below. Nine commits on top of d949417, all NORMAL pushes, head `a8c54d1`. - **Ranges table (`462e9da`).** Every slider's min/max/step lives in one table, `DAItemEditorRanges` in `addons/da_item_editor/item_ranges.gd` — `const RANGES` with keys `pos` [-10,10,0.001], `rot` [-360,360,0.1], `unit` [0,1,0.01], `value` [0,100000,1], `weight` [0,100000,0.01], `data` [-100000,100000,0.01], `bolt_knob` [0,100000,1], `size` [0.001,10,0.001]; `range_for(key)` + `apply_range(spin, key)`. The row factories take a range key instead of three numbers; the trigger and bolt sliders apply the `unit` range through the same table. No range is hardcoded at a call site afterwards. Values are the ones the dock always used, only relocated — Zach adjusts them himself. Proven to drive the sliders: changing `value` to [0,500,5] in the table moved only the Value slider to 0/500/5 in a headless dock probe, then reverted. To edit: change a triple in `RANGES` (min, max, step); ranges are soft bounds (spins allow typing outside). - **Real margins (`478a084`).** Spacing is explicit values in `DAItemEditorSpacing` (`addons/da_item_editor/item_spacing.gd`): sides 12, top/bottom 5, section gap 4, section indent 12, body separation 8, row separation 6, grid separation 6. The theme constants are gone (they resolved to ~4-6 px and read as no padding). Constraint found while verifying: the suite sizes the dock to 240 px and asserts the collapsed content needs no scrollbar, and the baseline was already exactly at that limit (range 0.0) — six 31 px headers + 11 gaps + margins must fit 240, so 8 px section gaps would need that check revisited; the gap stays 4 and top/bottom 5. The visible padding is carried by the sides (12) and indent (12) and the 8 px body separation. Verified with xvfb screenshots (1920x1080, handgun loaded): side inset +12 px, section indent +12 px, rows visibly separated; pose values unchanged (pos 0.0 / -0.061 / 0.053, rot 90.0 / 0.0 / 0.0). Screenshots in `~/workspace/dock-split/` (after_full/dock/handgun/pose/pose_zoom). - **Value editors (`72294a1`).** The row factories move verbatim into `DAItemEditorWidgets` (`addons/da_item_editor/item_widgets.gd`) as static factories — `_row`, `_make_spin`, `_make_v3_row`, `_make_aabb_row`, `_make_float_row`, `_make_text_row`, `_make_bool_row`, `_note`, `_add_detail_line`, `_fmt_pose`, `_row_stylebox`, plus the axis-color helper. The dock keeps one-line delegates with the same names and signatures, so call sites and the suite do not change. - **Section split (`3bb6179`, `f928e01`, `36bea12`, `a45cbf4`, `f94e309`, `a8c54d1`).** dock.gd 3264 → 833 lines. Each section is a RefCounted collaborator holding an untyped `var dock` (typing it DAItemEditorDock would be a cyclic class reference); the dock creates the instances in `_ready()` before `_build_ui()`, keeps all member-var declarations and the spine (`_ready`, editor hooks, `_build_ui`, section shell, load/save, selection, `_refresh_sections` as orchestrator, `_fill_model_node_picker`), and keeps thin delegates for every method the suites call or that is public API. Module map: `dock_section_item.gd` (417 lines: Item list/filter/new-item form/duplicate/delete, References, dialogs; TEMPLATE_LABELS moves with it, TEMPLATE_KINDS read as DAItemSchema.TEMPLATE_KINDS) · `dock_section_object.gd` (297: a_object fields + colliders) · `dock_section_props.gd` (806: b_properties, data table, states, bolt knobs, marker list, `_data_*`/`_tree`/`_parse_scalar`) · `dock_section_assembly.gd` (389: c_assembly + components; COMPONENT_TAGS moves with it; SELECTED_FONT_COLOR duplicated there with a sync comment, the suite pins the dock's copy) · `dock_section_grips.gd` (562: d_grips) · `dock_stage_controls.gd` (191: grip preview, bolt sim, reference selection; its handlers are delegated because the Item, assembly, and grips sections connect to them through the dock). Two mechanical consequences of the untyped dock reference, both behavior-neutral: `var x := dock....` cannot infer, so those declarations use plain `=` in the sections (including transitively, where a value derives from an untyped dock value); bare `add_child(...)` in moved code becomes `dock.add_child(...)`. Head: `a8c54d1` (22 commits on `f9919ea`). Tree is byte-identical to the pre-squash reverted tree (`5013453`, verified with an empty diff before the force-push). Trimmed out 2026-11-16 — these 9 commits plus `d949417` are no longer on the branch; head is now `d840df2`, 12 commits. Commits (all on `f9919ea`): 1. `5eda2d7` Item format v2 (issue #47) — e79c9a2 + 8712fbe squashed 2. `45699d0` resave object json (merith-tk) 3. `016363f` Revert test gun magwell to a point rail 4. `7ec9e1c` Grip driver runtime (issue #46) (merith-tk) 5. `4b65716` modtool_meta.json is editor-only 6. `0763069` Rename gun_slide -> gun_bolt 7. `e28fd27` Mag rail t uses the hand's current-frame position (shape b) 8. `f49ffc2` Slice 5: bolt slams on fire and locks on the last round (issue #42) 9. `71ff6f9` DA Mod Editor: rebuild the dock — single pane, Inspector-style (issue #47 Phase 3) 10. `a8ed817` Grip data fixes for the rebuild 11. `9194c95` Wire grip_driver_check into CI 12. `d840df2` Item: carry model_path into the item definition 13. `d949417` Dock: Inspector spacing + native value editors (issue #48) — rebased onto the v2dev dock 14. `462e9da` Dock: slider ranges in one table (issue #48) 15. `478a084` Dock: explicit spacing values, not the theme (issue #48) 16. `72294a1` Dock: value editors live in DAItemEditorWidgets (issue #48) 17. `3bb6179` Dock: Item section lives in DAItemEditorItemSection (issue #48) 18. `f928e01` Dock: a_object section lives in DAItemEditorObjectSection (issue #48) 19. `36bea12` Dock: b_properties section lives in DAItemEditorPropsSection (issue #48) 20. `a45cbf4` Dock: c_assembly section lives in DAItemEditorAssemblySection (issue #48) 21. `f94e309` Dock: d_grips section lives in DAItemEditorGripsSection (issue #48) 22. `a8c54d1` Dock: stage controls live in DAItemEditorStageControls (issue #48) Note on the squash list: the plan's item 13 (a reworked dock/stage v2dev pass from 1b37777/a8101d6/2019e75) collapsed — there is no separable UIX gain to carry. The dock pass's new functions are all v2/prefab machinery (_spatial, _prefab_root, _mark_prefab_dirty, _on_open_prefab, _on_pick_script/_on_attach_script, _take_stage_collect, _rename_sections); the UI-map section names are identical at b7b77c5 and 2019e75 (they came from the dock rebuild), the stage was already the editing surface at b7b77c5, and _take_stage_collect guards a hazard that does not exist in v2dev form (no separate spatial to collect). The reverted tree's editor is the b7b77c5 editor + margins, and the squashed [12] already contains that editor, so a separate pass commit would be empty. 13 commits, not 14. Verification on the reverted tree (head `5013453`, re-checked on the squashed head `d949417` for import/check.py/editor suites): - Double --import: 0 errors both passes. check.py: 6/6. - Battery (v2dev baseline, re-established): TOTAL_OK=2054, 37 PASS, 2 FAIL — the known mag reds only (mag_filo 31, mag_interaction 50; item_scene_prefab is gone with its suite). The 5 deleted scene suites account for the drop from the scenes-era 3868 (item_data_v2 1320 + item_scene_prefab 321 + item_prefab_author 147 + item_binding 21 + rig_skip 14 = 1823). rig_chains PASS (64 checks) and twist PASS on top of the runner total. Script errors are the known noise only (level_loader.gd:47, firearm is_trigger_down). - Model forms load: test_gun pistol (scene path), handgun (GLB path), rifle (primitive dict) — 8/8 checks PASS. - Editor suites on the real pistol: item_editor_check 403 ok, item_editor_manage_check 111 ok, grip_driver_check 82, bolt_check 90 — all PASS, 0 script errors. - Bridge e2e: PASS (xvfb-run). Verification at the split head `a8c54d1` (re-run per split commit, same numbers every time): double --import 0 errors both passes; check.py 6/6; full battery TOTAL_OK=2054, 37 PASS, 2 FAIL (the known mag reds only, mag_filo 31, mag_interaction 50); editor suites on the real pistol item_editor_check 403, item_editor_manage_check 111, grip_driver_check 82, bolt_check 90 — all PASS, 0 script errors; bridge e2e under xvfb-run PASS, exit 0, 142 ok checks. Still open / not merged: the no-merge condition stands. The collider-details toggle MOUSE_FILTER_IGNORE defect and the trigger-node animation are still unauthorised, not fixed here. Zach's local broken generic_handgun.tscn was his own metadata experiment; the committed prefab is deleted by this revert anyway. Resync: the branch was rewritten — fetch and reset --hard to `d949417` before pushing to it again.
ItemSpec gains the v2 vocabulary: controller / grip_points /
colliders fields, TYPE_EXTENSIONS (weapon_onehand/twohand resolve
to weapon), namespace-aware has_tag/matches_tag, namespaced path
and controller resolution, and normalize_old_* helpers that fold
flat old tables into the nested {data, refpoints, states} form.
primary_grip_pose resolves from grip_points first (folded pose,
no model offset on top) and keeps the old grip_poses + offset
branch as fallback. WorldItem builds one GrabPoint per secondary
grip point (GrabSecondary_<point>_<side>); Firearm, Magazines and
the mag/consumable readers go through the nested tables; the mag
and bullet base bands now key off the accepted caliber local part
(ammo.9mm), restoring two dead branches.

Old JSONs still load: battery 35/38 green (terrain N/A); the 3
FAILs (firearm, modloader, spawn) are tests reading the flat
table keys, updated in Phase 4.
Scripted migration (parse-back verified, tab indentation, CRLF
preserved per file): a_object / b_properties / c_assembly /
d_grips with fixed grip_points key order. Pistol per the v5
appendix verbatim (Generic Handgun, slide origin z 0.0, trigger
travel rot 30, gun_grip_pose + slide_grip_pose drivers and finger
states); other primary poses folded from the probe-measured
resolved poses; rifle foregrip becomes a secondary grip point;
stack and reload_time dropped (max_stack now 1 everywhere — the
stack fallout is a separate decision); tags namespaced per module
(mag.pistol -> mag.handgun, weapon.pistol -> weapon.onehand,
holster.hip -> weapon.secondary, holster.back -> weapon.primary).

Renames: generic_pistol(.json/.glb/texture) -> generic_handgun,
generic_pistol_mag(.glb/texture) -> generic_handgun_mag, with
.import source_file updates. Slot tags ride along (hip_r ->
weapon.secondary, back -> weapon.primary).

Tests go red here by design (old ids / flat reads in the suites);
they are rewritten in the Phase 4 + editor commits. Import 0
ERROR, check.py 6/6, migration parse-back VERIFY OK.
All item ids/paths now use generic_handgun; test probes rewritten to
the four-section shape (folded d_grips poses, nested b_properties,
a_object.colliders, c_assembly); debug bridge emits grip_points +
controller; example glow_stick registered in the new shape.

Known fallout, all from the dropped stack (no new home invented):
mag_filo loses its multi-round loads (13-round mag, FILO pop order,
rack counts) and mag_interaction loses its 60-stack scenario
(create() clamps to max_stack 1, so the stack is a count-1 round that
the loose-bullet filter also counts; loading its only round frees the
world item and aborts the phase). Decision for Zach, reported in full.
item_schema.gd: markers re-pointed to b_properties.<base>.refpoints / c_assembly / d_grips.grip_points (base segment resolved per item via TYPE_EXTENSIONS); grip functions now operate on grip_points with fixed key order (role, object, mirror, both/right/left; pose, driver, state inside a hand entry); resolved_grip_pose mirrors ItemSpec.resolve_grip_point exactly (right = right??both??default; left = own entry, else mirror(right) when point.mirror ?? centered, else right as-is); templates rewritten to the new shape (weapon_onehand, accepts_mag devkit:mag/generic_handgun, accepts_ammo devkit:ammo.9mm, c_assembly.fire_select + slide travel, folded d_grips poses); colliders read/write a_object.colliders; duplicate keeps the legacy top-level model_path/world_scene branch for old-shape dicts and leaves namespaced a_object.model as-is; looks_like_item_data needs a_object + name.

item_stage.gd: grip/magwell/slide rails and markers use the resolved marker paths; gun_slide rail now builds from c_assembly (origin + origin+travel) with its own collect/build pair; ref_b written as a {pos} dict (the runtime only reads dict ref_b); _accepted_mag_bounds resolves accepts_mag as an item id first, else a tag scan.

Tests: item_editor_check 284 ok (baseline 282: +4 slide-rail checks, -1 merged grip check, -1 merged mag-grip check), item_editor_manage_check 111 ok (baseline 110: +1 no-world_scene check), both 0 FAIL. The manage duplicate fixture stays old-shape on purpose (tests the legacy branch).

Round-trip proof (generic handgun, load -> collect unmoved -> save): values stable except two float32 transform-noise spots (magwell ref_b y -3.7e-9, slide travel z +7.5e-10, both far inside the 1e-4 test tolerance); the saved file is re-sorted alphabetically and ints become floats (schema 1 -> 1.0) — both are the pre-existing save/load path (JSON.stringify sorts keys; Godot JSON parse returns floats), save_item_json/load_item_json untouched by this change. A byte-identical round-trip would need a custom order-preserving serializer (out of scope).
Loaders read the four-section shape only: normalize_old_* deleted from ItemSpec; _from_dict_old deleted from ItemDefinition; _apply_dict_old deleted from GenericItem; grip_poses field, grip_pose_for/_hand and pose_from_dict deleted; primary_grip_pose resolves from grip_points with the default fallback (resolve_grip_point({})). Firearm/Magazines/WorldItem flat-table fallbacks deleted (_data/_refpoints/_mag_data/_mag_refpoints return the nested subtable only); accepts_magazine is id equality only; legacy mag_well/mag_well_b branches deleted; array-form opening branches deleted (v2 opening is a {pos, rot} dict).

Tests: the remaining old-shape apply_dict/from_dict probes rewritten to the new shape (modloader g/g2/g3/g4 + replacer + coded coin + frozen register; module_check fixtures incl. the two-hand sword grip point and the pack item; mag_filo no-offset probe). The manage duplicate fixture stays old-shape on purpose (it tests the legacy duplicate branch, which is kept).

Known fallout (unchanged from Phase 4, decision for Zach): stack is gone from the JSONs, so multi-round loads cannot exist — mag_filo and mag_interaction stack scenarios fail on counts, not on mechanics.
Comment + test-label wording only (stage header doc, two editor check labels). No behaviour change.
The loader builds a sample element with make_element(type, {}, "") once per JSON element to read _path_fields() — the direct d["a_object"] index in _apply_dict_v2/_from_dict_v2 crashed on that empty dict (16 SCRIPT ERRORs per discovery, and the undefined_model probes aborted mid-load). Both v2 entry points now read a_object via .get() with a {} default: a dict without a_object loads as an empty basic item. undefined_model probes rewritten to the new shape (a_object.name/model).
Format v2 Phase 6: last stale doc references
Some checks failed
tests / test (pull_request) Failing after 1m57s
35d0e865cb
Comment-only: _build_slide_travel doc no longer mentions the dropped slide_travel field; template doc generic_pistol -> generic_handgun.
resave object json files
Some checks failed
tests / test (pull_request) Failing after 1m54s
f8146c1c96
to trigger proper orginization and prevent future remakes and changes because of the order being wrong in the files where the game engine saves as a different order

also changed the mag well position on the testgun
Revert test gun magwell to a point rail (rail fixtures assume it)
Some checks failed
tests / test (pull_request) Failing after 1m54s
1fe7f443b5
muse-lantern force-pushed object-grip-overhaul from a7033dcaa7
Some checks failed
tests / test (pull_request) Failing after 16s
to 25b37cab5d
Some checks failed
tests / test (pull_request) Failing after 16s
2026-11-15 04:28:18 +00:00
Compare
Item scan ignores *.modtool_meta.json (fixes item_editor_check count)
Some checks failed
tests / test (pull_request) Failing after 25s
13b93a77d0
The mag's editor metadata file (generic_handgun.modtool_meta.json,
added in 25b37ca) was counted by DAItemSchema.scan_items() as a 17th
item, failing item_editor_check's "scan finds 16 items".
Metadata files are editor-only state, never items: item_id_for_path()
now returns "" for *.modtool_meta.json paths (suffix check, so future
metadata files are excluded too), and is_item_json_path() excludes
them as well, so the editor's file detection no longer claims a
metadata file as an item. No test counts were changed.
- Marker gun_slide -> gun_bolt (item_schema marker def, stage rail
  build/collect, README marker table, editor checks).
- Assembly part slide -> bolt in the handgun JSON (the pistol slide
  IS a bolt); stage assembly_part/origin_pose/part_node calls and
  schema examples follow. GLB node Handgun_Upper untouched; the
  name-matching fallback (upper) still works.
- Grip point slide -> bolt in d_grips; driver slide_grip_pose ->
  bolt_grip_pose in the GripDrivers registry and checks.
- The editor checks manual-assignment test used bolt as an
  arbitrary part name; it now uses rail (free known part) since
  bolt is the real pistol part. mag_release was not used: it is
  special-cased in the stage.
- slide stays in ASSEMBLY_KNOWN_PARTS: it is the future
  pump-action part name.
Runtime loader ignores *.modtool_meta.json (editor-only metadata)
Some checks failed
tests / test (pull_request) Failing after 1m52s
7b3c6cd621
The module loader enumerated the mag's .modtool_meta.json as an
item and rejected its dotted id ("bad element id
mag/generic_handgun.modtool_meta"). Per Zach's decision the meta
files are editor-only; the game ignores them entirely, so the element
scan skips them at the enumeration level.
Mag rail t uses the hand's current-frame position (shape b)
Some checks failed
tests / test (pull_request) Failing after 1m54s
245eb9740e
HandInteractor runs at priority 0, before HandFollower (10), so
_update_snap read the follower's transform — last frame's hand —
and t lagged the hand by one physics tick (~2.5 mm at 0.15 m/s).
HandFollower.desired_global_transform() is the pure computation
(teleport snap + leash clamp) shared by _physics_process and
_update_snap, so t is driven from this frame's hand. The
projection is factored out as HandInteractor.snap_t_for().

item_follow_check gains the proving check: the mag's rail pose
against the hand's CURRENT rail projection (<1 mm). It fails on
the old code (max 0.0025 m) and passes with the fix.
Slice 5: bolt slams on fire and locks on the last round (issue #42)
Some checks failed
tests / test (pull_request) Failing after 2m2s
f9f92fbcb8
The bolt cycle is driven by firing and by the grip (rack), on the
shared desired-position mechanism from Part 1. Geometry stays in
c_assembly.bolt; behaviour is a new b_properties.weapon.bolt table
on the base weapon table.

- ItemSpec.table() deep-merges base + extension (extension wins per
  key), so a weapon_onehand item sees the base bolt knobs and a
  per-handedness table can override them knob-by-knob. With only
  one present the stored dict is returned as-is.
- Firearm: bolt_t 0..1 + bolt_locked; fire_once() drives the bolt to
  1 then springs it back, and locks it at 1 on the last round
  (chamber empty + mag empty); rack() releases the lock (and
  chambers from a fresh mag when release_on_mag_insert). The bolt
  node is posed per frame as origin + t*travel from c_assembly.bolt,
  and the bolt grip points are recomputed from the node's live
  transform every physics frame. bolt_reached_rear fires once per
  rearward stroke (slice 4's casing eject hooks here).
- Bolt knobs (b_properties.weapon.bolt, handgun defaults):
  dry_fire_primes false (a priming pull chambers, no shot, no
  cycle); snap_back_ms 250 (200-300 range); stroke_ms 30;
  lock_on_empty true; release_on_mag_insert false;
  rack_empty_cycles true; drop_mid_cycle "finish"
  ("finish"|"reset"|"freeze").
- Editor: DAItemSchema.type_table() / dict_get_marker_path() now
  see the same merged base+extension view as the runtime (the base
  table previously shadowed the extension's refpoints, breaking the
  muzzle/magwell/chamber markers); marker writes route to the table
  that owns the segment. Naming purge: the editor's slide-sim
  identifiers are now bolt (bolt_amount, set_bolt_amount,
  play_bolt_cycle, BoltForward/Back/Travel gizmos, "Bolt" section);
  the gun_bolt rail visualisation, magwell rail, GLB node
  Handgun_Upper, and 'slide' in ASSEMBLY_KNOWN_PARTS stay.
  _bolt_travel_vec() no longer falls back to the gun_bolt rail.

Tests: new tests/bolt_check.gd (90 checks: merge incl. a synthetic
per-knob override, fire cycle, last-round lock, rack release, dry
fire + priming, rack-empty on/off, drop finish/reset/freeze+resume,
boltless test gun inert). item_editor_check gains 5 merge checks
(289 total). Full battery: 35/37 runnable suites pass (1777 ok);
mag_filo / mag_interaction stay red on the known stack fallout
(unchanged counts); terrain_check is skipped by CI design (no file
on this branch). Bridge e2e PASS under xvfb-run.
UIX Part A: Inspector-style dock (issue #47 Phase 3)
Some checks failed
tests / test (pull_request) Failing after 2m2s
74bb4e482c
Rebuild the DA Mod Editor dock on Inspector patterns:
- Section headers are dark bands with bold left-aligned titles
  (arrow at the left, same toggle text).
- One slim toolbar row for Duplicate / Delete / Open staging /
  Save JSON (flat buttons).
- Marker rows are click-to-select (whole row selects the marker
  in the viewport and marks the dock selection, with a highlight
  band); the separate Select button is gone.
- Colliders expand to Inspector-style Vector3 pos/rot/size rows
  (three SpinBoxes each, not one x,y,z string); edits write
  through without rebuilding the list.
- Add rows are low-key flat "+ Add ..." buttons.
- The marker-row structure change updates the manage suite row
  walk (unwrap the highlight PanelContainer).

item_editor_check 309 ok, item_editor_manage_check 111 ok,
check.py 6/6.
UIX Part B: click-to-select in the staging scene (issue #47 Phase 3)
Some checks failed
tests / test (pull_request) Failing after 2m2s
fbe68b264e
Selection syncs viewport and dock list:
- item_stage.selectable_for(node) maps a viewport-selected node
  to a dock selection descriptor: markers (and their triad
  children), rails (and their end markers and line), collider
  gizmos (by index), and model nodes bound to an assembly part.
  Preview hands, references, and the model root map to nothing.
  marker_node() is public for the dock.
- The dock listens to the editor selection (EditorSelection via
  Engine.get_singleton("EditorInterface"), null-guarded headless)
  and mirrors the first mapped node as its selected thing; an
  empty or unmapped selection clears it. The sync is factored as
  _apply_viewport_selection() so the mapping is headless-provable.
- Component rows are click-to-select too (row gui_input; labels
  ignore mouse input so clicks reach the row) and the selected
  component's part name highlights in the selection colour.

The viewport click itself is editor-interactive and needs
Zach's in-editor check; the suite proves the mapping
(selectable_for) and the dock-side selection, not the click.

item_editor_check 322 ok, item_editor_manage_check 111 ok,
check.py 6/6.
UIX Part C: Selected tab + driver surface (issue #47 Phase 3)
Some checks failed
tests / test (pull_request) Failing after 2m5s
2bf6e7e724
Two tabs: "Editor" (the whole dock) and "Selected" (the
selected thing's item-data properties, never node properties).

Selected tab, per kind:
- Marker: kind, data path, authored driver + states for a grip
  marker, and editable pos/rot rows (through the stage: set the
  node, collect back into the item — the same path dragging the
  marker takes).
- Rail: ref_a / ref_b pos/rot rows, same write-through.
- Collider: summary + mesh name, or editable pos/rot/size rows
  (the same rows and handler as the Colliders section).
- Component: bound object, editable origin/travel rows, mode
  poses read-only. Origin edits start from the resolved pose
  (not zeros) and re-apply to the node; a bolt edit re-derives
  the bolt rail first, or collect_item would write the stale
  rail ends back over the edit. Both pose halves go back as
  arrays (a Vector3 would not survive JSON.stringify).

Driver surface (issue #46, in the Grip preview section):
- Driver picker: "(pose)" + GripDrivers.ids(), defaulting to
  the grip point's authored driver for the previewed side
  (new schema grip_driver_for_side / grip_state_for_side).
  Preview-only — picking a driver does not write the item.
  The pick survives refreshes until the item or side changes.
- Trigger slider (0..1) injects the pull into the stage
  evaluation; disabled (Range.editable) while "(pose)" is
  picked — HSlider has no "disabled" property.
- Stage: set_grip_driver / set_grip_trigger evaluate tree-free
  (GripDrivers.evaluate against the grip's state data) and
  apply via HandView.set_finger_pose. Hands calibrate a frame
  after _ready and set_finger_pose no-ops before that, so the
  apply is deferred to _process until every preview hand is
  built; clearing the driver applies the neutral pose so the
  last driver pose does not stick. grip_preview_pose() is the
  test seam for the applied pose.

item_editor_check 359 ok, item_editor_manage_check 111 ok,
grip_driver_check 81 ok, check.py 6/6. Full battery 39/41
(2009 ok); the 2 reds are the known stack fallout
(mag_filo 31 ok, mag_interaction 50 ok, same counts as
baseline). Bridge e2e PASS.
Grip tiers are primary (first grab), secondary (the two-hand grip)
and tertiary (gun elements — the bolt, a mag). The runtime only knew
primary/secondary, so a tertiary role was silently dropped and
validation flagged it. WorldItem now builds tertiary points as
GrabPoint.Mode.GENERAL (GrabTertiary_<point>_<side>), so the second
hand only falls back to them when there is no secondary point — the
bolt no longer counts for the two-hand condition, but it is still
grabbable for racking, and the Firearm still finds it by point name.
ItemSpec.validate accepts tertiary and flags more than one point of
any tier. The handgun bolt grip point moves secondary -> tertiary;
the bolt behaviour-table comment now points at the item weapon tree.
Handgun carries one property tree: bolt knobs move to weapon_onehand (issue #47 Phase 3)
Some checks failed
tests / test (pull_request) Failing after 2m4s
f0b3343a47
weapon, weapon_onehand and weapon_twohand are three trees that
apply the same values — onehand/twohand only add recoil/deviation
math behind them. The handgun split its weapon properties across
two trees (bolt alone on base weapon, everything else on
weapon_onehand); the editor must not author split trees. The bolt
table moves into weapon_onehand and the base weapon table goes
away, so the item has exactly one tree. The runtime and the editor
both read through the merged ItemSpec.table() view, so the firearm
still reads the same knobs — bolt_check 90, grip_driver_check 82,
item_editor_check 359, all green.
- Property trees: PROPERTY_TREES (weapon / weapon_onehand /
  weapon_twohand — one tree per item, swap the key to change the
  math), import_property_tree (swap key, values kept; insert the
  standard tree when there is none), set_custom_property_tree
  (raw JSON for unsupported properties), remove_property_tree,
  plus BOLT_KNOB_DEFS / bolt_table_of / bolt_knob_set and
  WEAPON_DATA_DEFS for the editors.
- Grip tiers: GRIP_TIERS (primary / secondary / tertiary),
  grip_point_names / grip_point_with_role / set_grip_point_role.
- Markers: addable_markers (applies + not present; grips and the
  bolt rail live in their own sections), marker_default_value
  (the stage defaults, mirrored) and add_marker_value (the
  no-stage add path).
- Assembly: is_valid_assembly_part_name (the stage charset) and
  assembly_add_assigned (add + assign in one step).
- Detection now checks purely for a_object.
Also drops a stale duplicated comment above resolve_marker_path.
Rebuild the DA Mod Editor dock: single pane chunked like the JSON (issue #47 Phase 3)
Some checks failed
tests / test (pull_request) Failing after 2m3s
2864c86e0c
Throw out the reskin dock layout and rebuild it from scratch:
single ScrollContainer pane, no tabs, no status line. Sections in
JSON order (Item, a_object, b_properties, c_assembly, d_grips,
References), each a flat inline Inspector-style header (bold text,
no dark-band body). Collapsed, the dock body is 206 px tall and
needs no scrollbar; expanded it scrolls to the bottom.

- FileSystem integration: FileSystemDock selection_changed and the
  script editor focus a mod item JSON (a_object check) in the dock;
  a .tscn focuses its owning item.
- Markers are added to the list (grip right/left default), each
  carrying a tier (primary / secondary / tertiary); the tier drives
  the grip-point role in the data. Tertiary maps to the runtime
  GENERAL mode, so a bolt grip never counts for the two-hand
  condition.
- Components add + assign in one step (object + tag, add row at the
  top of the list). The bolt is a component like any other: adding
  it creates c_assembly.bolt (object/origin/travel + behavior knobs)
  and its UI lives on the component row. No standalone Bolt section.
- Properties: one tree per item (import weapon / weapon_onehand /
  weapon_twohand, or a custom tree by JSON); the handgun bolt table
  moved to b_properties.weapon_onehand, so the editor never authors
  split trees.
- Colliders create + assign in one step and are editable in the UI
  (pos/rot/size spins, mesh name LineEdit).
- Conditional rendering: grip pose rows, state finger fields, and
  section bodies render only when their subject is expanded or
  present. Standard vocabulary lives in dropdowns with a custom
  escape hatch, never closed hardcoded lists.

Verified: double --import 0 errors, check.py 6/6, battery 37 pass
(2046 ok; only reds mag_filo 31 / mag_interaction 50, known stack
fallout), bridge e2e PASS under xvfb-run. item_editor_check 395 ok
(was 359), manage 111, grip_driver 82, bolt 90.
Wire grip_driver_check into CI (was run only ad hoc)
Some checks failed
tests / test (pull_request) Failing after 2m4s
cbb91fd869
Item-data-v2: autoconverter + loader path (issue #47, format phase 1)
Some checks failed
tests / test (pull_request) Failing after 2m4s
f3852f39c3
The current JSON struct (a_object / b_properties / c_assembly /
d_grips) is now item-json-v2dev; the new system is item-data-v2.
ItemDataV2 detects the format ("format": "item-data-v2" vs no
marker) and converts v2dev to v2 in memory at load — files on disk
are untouched — splitting each item into the JSON side (identity,
tags, controller, property trees with refpoints as a name manifest,
assembly parts with mode names, grips with driver/state references)
and the spatial source (refpoint coordinates, grip poses, collider
shapes, assembly origins/travels/mode poses, primitive models).
GenericItem and ItemDefinition both load through the new path and
fold the spatial source back into the same runtime fields, so every
existing item loads identically. The spatial source is the phase-2
seam: spatial_for() returns one normalized spatial dict, inline now,
scene-backed once _spatial_from_scene() is filled in. ItemSpec gains
format_id / spatial_source provenance. No dock changes: the editor
keeps working on v2dev dicts.
Item-data-v2: converter suite + CI wiring (issue #47, format phase 1)
Some checks failed
tests / test (pull_request) Failing after 2m6s
104f4df934
tests/item_data_v2_check.gd proves the phase-1 contract: format
detection, normalize idempotence, a converter that never mutates
its input, and every current item JSON (16 module items + 3
example-module items) converting to item-data-v2 and loading
identically in memory through both load paths (GenericItem and
ItemDefinition.from_dict) and the registry conversion — values,
markers, grips, bolt table, fire-select modes, driver/state
references — plus the v2 shape itself (name manifest for refpoints,
no spatial numbers on the JSON side) and custom-vocabulary
pass-through. Wired into .forgejo/workflows/tests.yml alongside
the other suites.
Item-data-v2: scene-prefab reader + sibling discovery (issue #47, format phase 2.1)
Some checks failed
tests / test (pull_request) Failing after 2m8s
228bdf8089
Read spatial data off scene prefabs through PackedScene.get_state()
only (no instancing, so no mod script runs at load): refpoints
(plain / oriented / rail), markers, grip poses, assembly travel
and mode poses, colliders + primitive model dict from root metadata,
and assembly origins from the part object node inside the Model
instance, with an origin marker as fallback. A sibling .tscn next
to an item JSON makes the item scene-backed (module loader injects
the scene source; the JSON on disk is untouched, no second id).
Scene-backed items resolve world_scene to the prefab; inline items
keep resolving from model_path. The v2dev converter honours an
injected scene source (scene wins over inline numbers).

Verified: double --import 0 ERROR, check.py 6/6, battery
TOTAL_OK 3346 (only mag_filo 31 + mag_interaction 50 known-red).
Item-data-v2: scene prefabs for all devkit items (issue #47, format phase 2.2)
Some checks failed
tests / test (pull_request) Failing after 2m6s
b8bcd79b8e
Sibling .tscn next to each devkit item JSON (handgun first as the
reference, then the rest); the old JSONs are untouched on disk and
no id is defined twice. Layout per ItemDataV2 header: Model (GLB
instance, or the primitive meshes + base bands for rifle mag/ammo),
Refpoints (plain / oriented / rail markers), Grips (<point>_<hand>
markers), Assembly (travel + mode markers; origins read off the
GLB model nodes), root metadata for colliders + primitive model
dicts. Scenes generated from the JSONs (tools-free generator run
from /tmp; values come from the JSONs, never transcribed).

New item_scene_prefab_check (277 checks): every scene-backed item
loads identically to its inline values (semantic compare — the
scene canonicalizes poses as full {pos, rot} and derives an origin
for every part naming a model node, incl. the trigger, which the
inline JSON never recorded; nothing reads a trigger origin),
handgun/mag/rifle reference values, world_scene = prefab,
prefab bounds = GLB / procedural build, discovery end to end
through the module loader, converter scene-source injection,
missing-scene behaviour, and a fixture scene for markers +
origin-marker fallback. Phase-1 stub test retargeted at a missing
scene; suite wired into CI.

Verified: double --import 0 ERROR, check.py 6/6,
item_data_v2_check 1300, item_editor_check 395, grip_driver 82,
bolt 90, item_editor_manage 111, item_scene_prefab 277 — all PASS.
The procedural builder sets MeshInstance3D.material_override; the
prefabs used surface_material_override/0, which reads back as a
null material_override — spawn_check caught it (rifle mag base
band is green failed). Same rendering for single-surface meshes;
now the contract matches. No spatial data changed.

Verified: spawn_check 53 PASS, item_scene_prefab_check 278 PASS,
item_data_v2_check 1320 PASS, double --import 0 ERROR, check.py 6/6.
Item-data-v2: to_item_definition copies markers through (issue #47, format phase 2.4)
Some checks failed
tests / test (pull_request) Failing after 2m7s
f82418dbb9
Deliberate decision on the phase-1 gap: registry definitions
dropped markers (the debug bridge reads def.markers), so scene
markers never reached the registry. One line in
GenericItem.to_item_definition; the weapon-table marker fallback
already read the element markers and is unchanged. No shipped
item carries top-level markers, so no loaded item changes; the
phase-1 suite lock is updated from markers-stay-empty to
markers-flow-through, plus registry-path checks in both suites.

Verified: item_data_v2_check 1320 PASS, item_scene_prefab_check
278 PASS, item_editor_check 395, grip_driver 82, bolt 90,
item_editor_manage 111 — all PASS.
Item-data-v2: prefab author engine + split focus (issue #47, format phase 3.1)
Some checks failed
tests / test (pull_request) Failing after 2m8s
6c6b8e1b36
DAItemPrefabAuthor (addons/da_item_editor/item_prefab_author.gd)
is the scene-authoring engine: dual-write add/remove flows for
components, refpoints, markers, grip points and colliders that
write the prefab scene for spatial data and the JSON spine for
tuning, or neither (every check runs before any mutation). No
spatial numbers ever land in the JSON (modes declared as
{name: {}}, grip hands carry driver/state, refpoint manifests
are name lists); no tuning values ever land in the scene.
load_split() focuses an item as JSON tuning + scene spatial
without ever authoring the loader-injected spatial key into
the dict. Also script attach on a prefab node, split_save(),
and the node lookups the dock needs (marker/part/grip nodes,
model node names, click-to-select mapping).

ItemDataV2 gains spatial_from_packed() — the same PackedScene
state read _spatial_from_scene does from a path, from an
already-loaded scene — so the dock can read a live prefab
root without saving first. No loader behavior change.

The dock records the focus split (is_scene_backed() /
scene_path() / current_item()); the prefab branches of the
add / pose / save flows land in the next commit.

New suite tests/item_prefab_author_check.gd (124 checks) + CI
wiring.
Item-data-v2: dock authors prefabs + JSON spine (issue #47, format phase 3.2)
Some checks failed
tests / test (pull_request) Failing after 2m7s
d184f888ad
The dock is the scene authoring surface for scene-backed items:
the prefab scene is the staging surface (Open button opens the
prefab, labelled Open prefab scene), and the JSON stays the
tuning spine. Every prefab branch is gated on _prefab_root()
(the edited scene root when it is this item's prefab), so with
no prefab open the dock keeps its established dict editing
headless behavior untouched.

Add flows write both sides in one step through
DAItemPrefabAuthor: components (Assembly node + JSON part with
object + mode names), refpoints (scene marker + manifest name,
dict manifests converting only once every coordinate has a
scene marker), markers (grip markers via ensure_grip_markers),
grip points (JSON role/object/driver/state, scene pose marker),
colliders (prefab root metadata), and hand entries. Pose rows
(marker / rail end / grip / component travel) move the prefab
nodes while the prefab is open; the origin shows as the model
node rest pose, not an editable row. Component details show
the prefab spatial values folded over the JSON part, and carry
the script row (Pick / Attach on the part node, controller id
shown as the item-data side reference). Save splits: JSON
spine + the editor scene save. Click-to-select maps prefab
nodes through the author, and the marker list shows prefab
placement. _live_item() never lets a stale staging scene
stand in for a scene-backed focus.

New author helpers: model_nodes_ui(), public model_bounds(),
add_grip_hand(), ensure_grip_markers(). Suite grows to 135
checks.
Item-data-v2: prefab Model instances editable in the editor (issue #47)
Some checks failed
tests / test (pull_request) Failing after 2m7s
e6309955e2
Show a prefab model's parts in the scene hierarchy: enable Editable
Children on the Model instance (viewing only - never save an override
on a model part). The dock enables it when a prefab scene opens and
saves the scene so the marker persists; the author does the same in
save_prefab, so new prefabs get it at creation; all 11 devkit prefabs
carry [editable path="Model"].

load_prefab_root now instantiates with GEN_EDIT_STATE_MAIN: packing a
DISABLED-instantiated root bakes every instance's children into the
scene file (a GLB model lands in the .tscn as inlined meshes), while
MAIN keeps the instance references - the save path and the live-root
reader both need the instance intact.

Caveat (verified): the packer only records the editable marker for
instance roots, so a plain (primitive-built) Model can never carry it
through an editor save - the marker is load-stable on those files
but an editor re-save drops it. Only the 4 GLB-backed prefabs keep
it stably; the helper no-ops for plain Models.
resave most scenes so they have metadata for later
Some checks failed
tests / test (pull_request) Failing after 2m8s
df14f396db
add resave_editor_files.gd to tools
Some checks failed
tests / test (pull_request) Failing after 2m9s
2dde5c589d
Refpoints and grip poses declare their model part with metadata/parent (String) on the marker node; the loader reads it through PackedScene.get_state() and composes the part transform at load, so the binding rides the part (bolt grip follows the slide, frame-bound markers stay put). JSON spine untouched; inline-JSON items unaffected.

Adds the item_binding_check suite (metadata readability, bindings map, ride-along math, metadata Variant probe) and wires it into CI.
Control-rig injection skip in WorldItem (issue #47)
Some checks failed
tests / test (pull_request) Failing after 2m12s
4689cb7c57
WorldItem._build_visual removes and frees any direct child instanced from the toolkit addon (res://addons/da_item_editor/...) before computing the AABB, and packed_scene_aabb skips meshes under such a node — so an injected control rig never leaks into the shipped item bounds. Hiding is not enough: the static measurer has no visibility check, so the rig must be removed, not hidden.

Adds the rig_skip_check suite (baseline bounds, rig removal through the real _build_visual path, hidden-rig control, static measurer skip) and wires it into CI.
muse-lantern force-pushed object-grip-overhaul from 4689cb7c57
Some checks failed
tests / test (pull_request) Failing after 2m12s
to f7924ade20
Some checks failed
tests / test (pull_request) Failing after 2m9s
2026-11-16 01:35:28 +00:00
Compare
The authoring layer was v2dev-only: a converted item showed EMPTY in
the dock, and any edit wrote v2dev keys into the v2 file. The edit
model is now split by field — the JSON spine or the prefab scene,
depending on what the field is:

- DAItemSchema gains shape-aware accessors (object/controller/model/
  properties/grip points/assembly branch on v2 vs v2dev), a spatial
  routing layer (_v2_route maps v2dev paths to spine or spatial), and
  spatial-aware grip/collider/marker/assembly helpers. Poses, origins,
  travel, mode poses, refpoints, markers, and colliders live in the
  spatial dict for v2; identity, tuning, and the mode-name list live
  in the spine. Origins are never written for v2 — the origin is the
  model node rest pose, model-owned.
- DAItemStage holds the item plus its spatial dict; collect splits by
  spatial source (scene-backed: spatial edits stay in the spatial,
  spine returned unchanged; inline v2: the spatial syncs back into
  the item). save_spatial_to_prefab writes the spatial into a prefab
  headlessly.
- DAItemPrefabAuthor gains apply_spatial_to_root (headless write-back:
  refpoints, markers, grip poses, assembly travel/modes, colliders)
  and branches add_component modes (v2 name list vs v2dev dict).
- DAStandin.build accepts a Variant model — a v2 model STRING builds
  the undefined wireframe cube instead of aborting the suite.
- The dock keeps a _prefab_spatial copy with a _spatial_dirty flag,
  renames its sections to the UI-map names for v2 items (Object /
  Properties / Assembly / Grips), and saves both sides for a
  scene-backed item (JSON spine here, prefab through the editor when
  open or headlessly from the spatial copy when not).
- The editor suites are reworked to the v2 surface on the REAL pistol
  and mag (values from the prefab scene via the loader, never synthetic
  v2dev data): inline-spatial temps for the save/collect round-trips,
  a dedicated prefab round-trip test, and the bolt-origin edit replaced
  by a model-default display assertion plus a travel edit.
to_item_definition() copied the model dict but dropped model_path, so
registry defs carried "" instead of the resolved GLB path for all 4
GLB items. Real bug, independent of the conversion (it affects v2dev
GLB items too); world_scene was still correct, so the functional impact
is nil, but the registry spec is now faithful. Found by the new
_check_item_v2 element-vs-registry comparison.
Three gaps the editor suites found on the converted files:

- The stage never loaded a scene-backed item spatial: _rebuild
  took _spatial from spatial_for_item, which returns {} for a
  scene-backed item (its spatial lives in the prefab, not the
  JSON) — so no markers, no rails, default grip poses, no mode
  poses, and collect wrote nothing. New schema helper
  spatial_values_for_item (inline spatial, else the prefab via
  ItemDataV2.spatial_for, PackedScene state, never instanced);
  the stage uses it in _rebuild and for cascaded reference
  owners (whose opening/eject the comment already said come
  from the prefab scene). The no-arg spine-only read contract
  is unchanged: accessors still refuse spatial writes without
  an explicit spatial.
- grip_hand_pose returned a zero pose for a hand the spatial
  has no entry for, so every side read as custom (mirror/as-is/
  base/clobber all wrong). It returns {} when the hand key is
  absent, matching the v2dev branch.
- The check found the primary grip row by index: the converted
  file lists grips alphabetically (JSON.stringify sorts keys),
  so the bolt row comes first. It finds the row by name now.
Migrate the 11 devkit items to item-data-v2 (scene-backed)
Some checks failed
tests / test (pull_request) Failing after 2m11s
689fba9110
The legacy JSONs are gone from disk: all 11 devkit items are now
item-data-v2, scene-backed by their sibling prefab .tscn (spatial
lives in the scene, the JSON carries only the spine). The inline
items — deadair primitives, testgun, example module — stay inline,
unconverted, by scope. Line endings preserved (the 6 CRLF files
stay CRLF). Converted with tests/migration_convert.gd (one-shot
tool, not committed): inject spatial {source: scene, scene: ...},
run ItemDataV2.convert_v2dev, write JSON.stringify(v2, "\t"),
verify by re-parse + exact round-trip and legacy_spatial_fields
empty on every written file.

- Hardened loader (modules/deadair/src/items/item_data_v2.gd):
  legacy_spatial_fields (single source of truth for legacy
  spatial data), _warn_legacy_fields (push_warning — a
  scene-backed v2dev dict warns 3x per load path; converted
  files load with zero warnings), the normalize() FORMAT_V2
  warning call, and the convert_v2dev scene-injected guard
  (inline values are never copied out when a scene is injected;
  the scene is authoritative, the inline values are ignored).
  One deviation from the replay bundle: _pose_dict/_pos_array
  normalize -0.0 to 0.0 — basis math (get_euler on a composed
  transform) hands back -0.0 components, numerically zero but
  formatted as "-0.0" in the dock (the fire_select mode lines
  read rot (-0.0, 0.0, 0.0)); data-neutral, same values.
- The four updated check files from the bundle
  (item_data_v2_check 1151, item_scene_prefab_check 377,
  item_prefab_author_check 147, item_binding_check 21), plus
  one expectation update in the prefab-author check: the dock
  renames the four JSON sections to the UI-map names for a v2
  item, so the section-titles check expects
  [Item, Object, Properties, Assembly, Grips, References].
- Loaded-state identity, proven by snapshot diff
  (tests/migration_snapshot.gd, one-shot tool, not committed):
  pre (v2dev) vs now differs in exactly 15 places — the 11
  format_on_disk markers plus the 4 registry.model_path fixes
  from the model_path one-liner (3f7646d). Bundle post vs now
  differs in exactly those 4 model_path fields. The v2 dict,
  element, definition, and registry spec fields are otherwise
  IDENTICAL for all 11 items across all three load paths.
  Audit: zero gaps (10 of 11 items no inline-vs-scene
  difference beyond 1mm / 0.05 deg; the handgun 3 scene-only
  entries are expected: trigger origin from the model node,
  trigger travel pos [0,0,0] canonicalization, bindings
  shape A).
Toolkit UIX v2: staging scene carries scene-backed items (issue #47)
Some checks failed
tests / test (pull_request) Failing after 2m11s
2019e75326
The hands, bolt sim, rack/fire, fire-select, grip driver, and
stage gizmos exist only in the staging scene, and since the
scenes transition the dock refused to load a scene-backed item
into an open stage — stranding all of them behind a stage no
scene-backed item could open. Nothing was deleted; it was all
stranded.

The dock now loads the focused item into an open stage whether
or not it is scene-backed (the stage rebuilds from the prefab
spatial, so a focus change always swaps the stage to the new
item — it can never show another item's build), and Open
staging scene opens the stage for scene-backed items too. The
prefab stays openable from a new Open prefab toolbar button
(node-level editing still happens there). The dock reads the
stage's spatial when the stage carries the focused item; the
spine stays dock-side, and the stage-collect handlers keep it
that way instead of swapping in the stage's load-time spine
copy. Save collects a stage-open scene-backed item's spatial
into the prefab.

Editor checks: the dock loads the pistol into an injected
stage (hands, bolt slider, rack, fire-select, focus swap,
stage-open save round-trip), 433 ok.
Dock: Inspector spacing + native value editors (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m16s
5acf34ffa9
Part 1 — margins: the dock content sits in a MarginContainer
(Inspector section indent on the sides, one container separation
top and bottom); each section body indents one section indent
under its header; every hand-built row goes through _row() with
the theme HBox separation. All spacing is read from the live
editor theme, with default-theme fallbacks headless.

Part 2 — native editors: _make_spin() returns a flat
EditorSpinSlider in the editor (SpinBox headless, same Range
contract). Vector3 rows follow the Inspector pattern — lowercase
x/y/z labels in the theme axis colors, degree suffix on
rotations. Box colliders get the Inspector AABB pattern: one
bounds grid (pos x/y/z + size w/h/d) plus a rot row, replacing
the three separate Vector3 rows. Float rows return Range.

Suites: item_editor_check 440 ok (+7 new checks: scroll margins,
section indent, spin fallback headless, vector-row structure,
bounds grid label/count/values), item_editor_manage_check 111 ok.
Battery 41 PASS / TOTAL_OK=3800, same 3 known reds; check.py 6/6;
double import 0 errors; bridge e2e PASS.
Remove the item-data-v2 load path: delete item_data_v2.gd (with the
autoconverter), restore item_definition/item_spec/world_item/
module_loader/editor_plugin/tests.yml and the resaved scenes to their
pre-phase-1 (b7b77c5) content, delete the scene-era test suites
(item_data_v2/item_scene_prefab/item_prefab_author/item_binding/
rig_skip), the scene fixture, the control-rig stand-in scene and the
resave_editor_files tool. The model_path one-liner (3f7646d) is kept:
re-applied on the restored types/item.gd, since it is a real bug that
affects v2dev GLB items too. The addon dock/stage/schema and the
editor checks are reworked in the next commit; the devkit JSONs and
prefabs in the one after that.
Restore the 11 devkit item JSONs to their f7924ad (v2dev) content —
inline spatial is the source of truth again — and delete the 11
generated prefab .tscn files (derived artifacts; the generator can
rebuild them when scenes are revisited). The testgun model scenes
(modules/testgun/models/*.tscn) are untouched: they ARE the model,
not item prefabs.
Revert (3/3): authoring layer back to item-json-v2dev (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m6s
5013453685
Restore the dock, stage, schema, standin and editor checks to their
pre-phase-3 (b7b77c5) v2dev content, delete the prefab author, and
port the margins commit (5acf34f) onto the restored dock and editor
check: Inspector spacing from the theme constants and native value
editors (EditorSpinSlider vector rows with degree units, the AABB
bounds grid for box colliders) survive the revert; the v2 branches
(spine-or-scene split, prefab spatial, Open prefab, script attach)
are gone. The four conflicts in each file were resolved by taking
the v2dev side and re-applying the margins gains (Range casts,
bounds grid, degree units) onto the v2dev APIs.
muse-lantern force-pushed object-grip-overhaul from 5013453685
Some checks failed
tests / test (pull_request) Failing after 2m6s
to d9494177fb
Some checks failed
tests / test (pull_request) Failing after 2m5s
2026-11-16 18:54:45 +00:00
Compare
Dock: slider ranges in one table (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m6s
462e9dabbc
Every Range in the dock takes its min/max/step from DAItemEditorRanges (addons/da_item_editor/item_ranges.gd): pos, rot, unit, value, weight, data, bolt_knob, size. No range is hardcoded at a call site afterwards; the values are the ones the dock has always used, only relocated. The row factories take a range key instead of three numbers; the trigger and bolt sliders apply the unit range through the same table. Verified: changing one table entry (value -> 0/500/5) moves only the Value slider in a headless dock probe, then reverted. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
Dock: explicit spacing values, not the theme (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m5s
478a084dc6
The dock no longer reads its margins from the editor theme: the theme constants resolve to ~4-6 px and read as no padding at all. All spacing lives in DAItemEditorSpacing (addons/da_item_editor/item_spacing.gd): sides 12, top/bottom 5, section gap 4, section indent 12, body separation 8, row separation 6, grid separation 6. The two margin checks in item_editor_check now assert the toolkit values instead of the old theme values. Note: the section gap and top/bottom margins are capped by the collapsed-fit layout check (the suite sizes the dock to 240 px and asserts the collapsed content needs no scrollbar): six 31 px headers + 11 gaps + margins must fit 240, and the baseline was already exactly at that limit, so 8 px gaps would need the check revisited. Verified with xvfb screenshots (handgun loaded, pose rows): side inset +12 px, section indent +12 px, rows visibly separated. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
Dock: value editors live in DAItemEditorWidgets (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m5s
72294a162a
The row factories (_row, _make_spin, _make_v3_row, _make_aabb_row, _make_float_row, _make_text_row, _make_bool_row, _note, _add_detail_line, _fmt_pose, _row_stylebox) and the axis-color helper move verbatim into addons/da_item_editor/item_widgets.gd as static factories; the dock keeps one-line delegates with the same names and signatures, so call sites and the suite do not change. The parent is the theme source for axis colors. No behavior change. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
Dock: Item section lives in DAItemEditorItemSection (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m5s
3bb6179360
First section split: the Item section (list, module filter, new-item form, duplicate/delete), the References section, and the dialogs move into addons/da_item_editor/dock_section_item.gd (RefCounted, var dock untyped to avoid a cyclic class reference). The dock keeps the spine and thin delegates for the suite-called methods (_fill_module_picker, set_module_filter, _on_module_filter_selected, _on_new_toggle, _validate_dup_dialog); spine call sites go through the section instance. TEMPLATE_LABELS moves with the section; TEMPLATE_KINDS is read as DAItemSchema.TEMPLATE_KINDS. Note: var x := dock.... cannot infer (dock is untyped), so those declarations use plain = in the section — the only semantic change, and only a typing one. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
Dock: a_object section lives in DAItemEditorObjectSection (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m4s
f928e01568
Second section split: the a_object section (name, controller, model, value, weight, tags) and the colliders list (add/remove/edit, mesh-in-model warnings) move into addons/da_item_editor/dock_section_object.gd. The dock keeps delegates for the suite-called _on_add_collider and _on_collider_mesh_changed; spine call sites go through the section instance. No behavior change. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
Dock: b_properties section lives in DAItemEditorPropsSection (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m4s
36bea12588
Third section split: the b_properties section (property-tree picker, data table, states), the bolt knobs, and the marker list move into addons/da_item_editor/dock_section_props.gd, with the _data_* helpers, _tree, and _parse_scalar. The dock keeps delegates for the suite-called props_tree_key, marker_rows_ui, _on_set_custom_props_tree, _on_props_tree_selected, _on_import_props_tree, _on_add_marker, and _on_add_bolt_knobs; spine call sites go through the section instance. No behavior change. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
Dock: c_assembly section lives in DAItemEditorAssemblySection (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m5s
a45cbf4a96
Fourth section split: the c_assembly section (component list, details, assign flow) moves into addons/da_item_editor/dock_section_assembly.gd. COMPONENT_TAGS moves with the section; SELECTED_FONT_COLOR is duplicated there with a sync comment (the suite pins the dock copy, and the section cannot read the dock const without a cycle). The dock keeps delegates for the suite-called _on_add_component and _on_component_row_clicked; spine call sites go through the section instance. No behavior change. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
Dock: d_grips section lives in DAItemEditorGripsSection (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m6s
f94e309643
Fifth section split: the d_grips section (grip point list, per-hand pose details, drivers, states) moves into addons/da_item_editor/dock_section_grips.gd. The dock keeps delegates for the suite-called grip_point_rows_ui and _on_add_grip_point; spine call sites go through the section instance. The grips builder still connects to the stage-control handlers through the dock (they move in the next commit). No behavior change. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
Dock: stage controls live in DAItemEditorStageControls (issue #48)
Some checks failed
tests / test (pull_request) Failing after 2m7s
a8c54d1179
Sixth and last section split: the grip preview (driver, trigger, mirror mode), bolt simulation, and reference-slot selection move into addons/da_item_editor/dock_stage_controls.gd. The dock keeps delegates for the handlers the Item, assembly, and grips sections connect to through it (_on_grip_driver_changed, _grip_driver_id_from_picker, _on_grip_preview_changed, _on_grip_trigger_changed, _on_mirror_mode_toggled, _on_mirror_mode_confirmed, _on_mirror_mode_canceled, _on_reference_selected, _on_bolt_slider, _on_bolt_rack); _refresh_sections now orchestrates entirely through the section instances. No behavior change. Battery TOTAL_OK=2054, 37 PASS, same 2 known mag reds.
muse-lantern force-pushed object-grip-overhaul from a8c54d1179
Some checks failed
tests / test (pull_request) Failing after 2m7s
to d840df23e7
Some checks failed
tests / test (pull_request) Failing after 2m4s
2026-11-16 21:30:26 +00:00
Compare
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
dead-air/engine-legacy!48
No description provided.