Item JSON format v2: data changes (issue #47) #48
Loading…
Reference in a new issue
No description provided.
Delete branch "muse-lantern/engine-legacy:object-grip-overhaul"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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, based840df2). The deferred items are recorded on issue #47 (comment 1085). Head is nowd840df2, 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_onehandwithaccepts_mag/accepts_ammo,data,refpoints,states) /c_assembly(fire_select, bolt, trigger) /d_grips(grip_points).Loaders.
ItemDefinition.from_dict()andItemSpecread the four sections, resolve namespaced paths, and resolve the newcontrollerfield through thedeadair:controller/...registry (absent =generic_object). The loader resolves extension keys:weapon_onehandcounts asweaponforis_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_rotateinto explicitgrip_pointsprimary poses — the fold equals the old composed runtime pose).reload_timeandstackdropped.value/weightmoved intoa_object(optional, default 0). Colliders moved toa_object.colliders(box, mesh, convex, sphere, cylinder). Bolt origin z0.00004→0.0. Travel lives only inassembly— 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.hipis gone; the slot isdevkit:weapon.secondary. Controller isdeadair:controller/generic_weapon— the object controller and the grip controller are one thing.gun_slide→gun_bolt(bolt is the general term;slideis reserved for pump-action shotguns with their own handler); assembly partslide→bolt, grip pointslide→bolt, driverslide_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.jsonwas 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,2bf6e7ereskin, superseded;d67ce6f,f0b3343,3c8e348,2864c86rebuild). 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 createsc_assembly.boltand 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 mirrorsEditorSelection. The driver surface (picker fromGripDrivers.ids(), trigger slider injecting pull into the stage's tree-free evaluation viaHandView.set_finger_pose) is kept, now inside the grip pose controls. One bug caught building: a bolt origin edit would have been reverted bycollect_item()writing stale bolt-rail ends back — fixed withstage.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 since2019e75— 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).GripDriverbase (tree-freeevaluate, default-inheritance state resolution),GripDriversregistry (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). Newtests/grip_driver_check.gd(82 checks, wired into tests.yml bycbb91fd). 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.jsonfiles carry no game data; the editor scan and the runtime loader both skip them.Mag rail
tfix (245eb97, shape b). While a mag is snapped,_snap_twas computed from the hand follower's previous-frame position (one physics tick stale, ~2.5 mm at slide speed). NowHandFollower.desired_global_transform()computes the follower's desired position for the current frame, shared by the follower and_update_snap. Proving test initem_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).Firearmholdsbolt_t0..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 fromc_assembly.bolt, and the bolt grip point is recomputed from the node's live transform every frame. Bolt behaviour is tuned inb_properties.weapon_onehand.bolt(moved there from the baseweapontable byf0b3343— the handgun carries exactly one property tree, and the editor never authors split trees):dry_fire_primesfalse ·snap_back_ms250.0 ·stroke_ms30.0 ·lock_on_emptytrue ·release_on_mag_insertfalse ·rack_empty_cyclestrue ·drop_mid_cycle"finish". New signalbolt_reached_rearfires once per rearward stroke — the hook point for slice 4's casing eject (eject itself not built). Newtests/bolt_check.gd(90 checks, wired into tests.yml). Two bugs found by tests and fixed in the same commit: the editor'stype_table()returned the bolt-only base table so markers/accepts_magread null (fixed — merged base+extension view viaItemSpec._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 asGrabPoint.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_routemaps 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 viaItemDataV2.spatial_for(PackedScene state, never instanced), or from the item's own inline spatial;collect_item()returns the spine,collect_spatial()the spatial, andsave_spatial_to_prefab()writes it back into the prefab. The prefab author gains headless spatial write-back (apply_spatial_to_root) and branchesadd_componentmodes (v2 name list vs v2dev dict). The stand-in accepts a v2 model string (wireframe cube, no abort). The dock keeps a_prefab_spatialcopy with a_spatial_dirtyflag, 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 ina8101d6: the stage never loaded a scene-backed item's spatial (newspatial_values_for_itemhelper; the no-arg spine-only read contract is unchanged),grip_hand_posereturned 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.stringifysorts 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-shottests/migration_convert.gd, not committed: injectspatial: {source: "scene", ...}, runItemDataV2.convert_v2dev, writeJSON.stringify(v2, "\t"), verify by re-parse + exact round-trip andlegacy_spatial_fieldsempty 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 addslegacy_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 theconvert_v2devscene-injected guard (inline values are never copied out when a scene is injected). One deviation from the replay bundle:_pose_dict/_pos_arraynormalize-0.0to0.0— basis math hands back-0.0components, numerically zero but formatted as"-0.0"in the dock (the fire_select mode lines readrot (-0.0, 0.0, 0.0)); data-neutral. The four updated check files land with it (item_data_v2_check1151,item_scene_prefab_check377,item_prefab_author_check147,item_binding_check21). Loaded-state identity, proven by snapshot diff: pre (v2dev) vs now differs in exactly 15 places — the 11format_on_diskmarkers plus the 4registry.model_pathfixes 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,bindingsshape 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 inproperty_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 droppedmodel_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_scenewas still correct, so the functional impact is nil, but the registry spec is now faithful. Found by the new_check_item_v2element-vs-registry comparison.One property tree per item (
f0b3343,3c8e348). The handgun's bolt table moved from baseb_properties.weapontob_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 isitem-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 — newmodules/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, stampedsource_format); JSON keepsformat/id/identity/controller/model(string reference only)/properties(one tree per item;refpointsis a name manifest)/assembly(objectnode-name reference,modesas a list of mode names)/grips(role,object,mirror, per-hand{driver, state}); the scene takes all spatial numbers. The seam isItemDataV2.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 usesPackedScene.get_state()ONLY, no instancing at load, so no mod script runs at load time; discovery is a sibling.tscnnext to the JSON (the loader injectsspatial: {source: "scene", ...}); for a scene-backed item the prefab IS the world scene. Zero.jsonfiles changed in either phase. Phase 3 (6c6b8e1,d184f88): the toolkit as scene authoring + prefab tool — newDAItemPrefabAuthor(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, basef9919ea)Head:
d840df2. Trimmed 2026-11-16 from 22 commits — the margins commitd949417and the 9 split commits462e9da–a8c54d1were removed (the hybrid inspector rebuild supersedes them; the rebuild goes on its own branch). History before the trim: 26 commits at5acf34f, squashed to 13 atd949417, plus 9 split commits ata8c54d1.5eda2d7Item format v2 (issue #47) —e79c9a2+8712fbesquashed45699d0resave object json (merith-tk)016363fRevert test gun magwell to a point rail7ec9e1cGrip driver runtime (issue #46) (merith-tk)4b65716modtool_meta.json is editor-only0763069Rename gun_slide -> gun_bolte28fd27Mag rail t uses the hand's current-frame position (shape b)f49ffc2Slice 5: bolt slams on fire and locks on the last round (issue #42)71ff6f9DA Mod Editor: rebuild the dock — single pane, Inspector-style (issue #47 Phase 3)a8ed817Grip data fixes for the rebuild9194c95Wire grip_driver_check into CId840df2Item: carry model_path into the item definitionVerification (current head
d840df2, trimmed)--import: 0 errors both passes.python3 tools/check.py: 6/6.d949417work. 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).xvfb-run(not--headless): PASS, exit 0.The two failing suites — stack fallout, not a mag regression
mag_filo_check(31 ok, was 47) andmag_interaction_check(50 ok, was 69) fail on the same mechanism, traced in code and confirmed by re-running both suites:stackis gone per #47, somax_stackis 1 andItemInstance.create(id, 60)now makes a count-1 round.Magazines.load_from_stackmovesmini(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.load_from_stackcreates one count-1 child per round moved;make_loadedfills 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.Known gaps and caveats (stated plainly, not hidden)
JSON.stringify(a point'srole, object, bothcomes backboth, object, role), and"schema": 1becomes"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.Handgun_Upper's live transform; the bolt moves on fire and locks on the last round. (Was: static point only.)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/modding.md,MECHANICS.md,mechanics.jsonstill referencegeneric_pistolin places.[safe, semi], index 0) — expected from modes-from-file-order..tscnconvention, 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-sourcespatial; native v2 files carry it). The stale-inline-coordinates wart is GONE as of689fba9— 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 since2019e75. 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_rearwired at t=1). Issue #46 is subsumed by this format —d_gripsis 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 ofd949417, all NORMAL pushes, heada8c54d1.462e9da). Every slider's min/max/step lives in one table,DAItemEditorRangesinaddons/da_item_editor/item_ranges.gd—const RANGESwith keyspos[-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 theunitrange 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: changingvalueto [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 inRANGES(min, max, step); ranges are soft bounds (spins allow typing outside).478a084). Spacing is explicit values inDAItemEditorSpacing(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).72294a1). The row factories move verbatim intoDAItemEditorWidgets(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.3bb6179,f928e01,36bea12,a45cbf4,f94e309,a8c54d1). dock.gd 3264 → 833 lines. Each section is a RefCounted collaborator holding an untypedvar 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_sectionsas 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); bareadd_child(...)in moved code becomesdock.add_child(...).Head:
a8c54d1(22 commits onf9919ea). 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
d949417are no longer on the branch; head is nowd840df2, 12 commits.Commits (all on
f9919ea):5eda2d7Item format v2 (issue #47) —e79c9a2+8712fbesquashed45699d0resave object json (merith-tk)016363fRevert test gun magwell to a point rail7ec9e1cGrip driver runtime (issue #46) (merith-tk)4b65716modtool_meta.json is editor-only0763069Rename gun_slide -> gun_bolte28fd27Mag rail t uses the hand's current-frame position (shape b)f49ffc2Slice 5: bolt slams on fire and locks on the last round (issue #42)71ff6f9DA Mod Editor: rebuild the dock — single pane, Inspector-style (issue #47 Phase 3)a8ed817Grip data fixes for the rebuild9194c95Wire grip_driver_check into CId840df2Item: carry model_path into the item definitiond949417Dock: Inspector spacing + native value editors (issue #48) — rebased onto the v2dev dock462e9daDock: slider ranges in one table (issue #48)478a084Dock: explicit spacing values, not the theme (issue #48)72294a1Dock: value editors live in DAItemEditorWidgets (issue #48)3bb6179Dock: Item section lives in DAItemEditorItemSection (issue #48)f928e01Dock: a_object section lives in DAItemEditorObjectSection (issue #48)36bea12Dock: b_properties section lives in DAItemEditorPropsSection (issue #48)a45cbf4Dock: c_assembly section lives in DAItemEditorAssemblySection (issue #48)f94e309Dock: d_grips section lives in DAItemEditorGripsSection (issue #48)a8c54d1Dock: 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
b7b77c5and2019e75(they came from the dock rebuild), the stage was already the editing surface atb7b77c5, 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 theb7b77c5editor + 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 headd949417for import/check.py/editor suites):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
d949417before 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.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.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).a7033dcaa725b37cab5dThe 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.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.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.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.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.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.4689cb7c57f7924ade20Three 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.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).5013453685d9494177fba8c54d1179d840df23e7