From 7b6d3b3b702febeae111aad4cd683d0daf29291d Mon Sep 17 00:00:00 2001 From: Axel Meyer Date: Mon, 18 May 2026 18:25:47 +0200 Subject: [PATCH] feat(puppet): add bone_world_scale public API Returns cascaded world.scl_x and scl_y for a bone. Used by puppet-test Group 8 scale-cascade assertions; future: vagrant-skeleton or other modules can query world-scale for compositing/effects. --- init.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/init.lua b/init.lua index 22a2a78..603c2b7 100644 --- a/init.lua +++ b/init.lua @@ -468,6 +468,22 @@ function M.bone_world_transform(handle, bone_id) return ws.x, ws.y, ws.rot end +-- ==================================================================== +-- World-scale query (public API; reads from cached bone_state.world). +-- Returns scl_x, scl_y of the bone's cached world-state. +-- ==================================================================== +function M.bone_world_scale(handle, bone_id) + local p = all_puppets[handle] + if p == nil then + error("puppet.bone_world_scale: handle " .. tostring(handle) .. " not spawned") + end + local ws = p.bone_state[bone_id] and p.bone_state[bone_id].world + if ws == nil then + error("puppet.bone_world_scale: bone '" .. tostring(bone_id) .. "' has no cached world-state") + end + return ws.scl_x, ws.scl_y +end + -- ==================================================================== -- Test-only: direct bone-angle write bypassing track-conflict guard. -- Stored in test_overrides and applied during update after rest-reset