Add StkRigAdapter for runtime skeleton fitting and shape mounting

- Implemented StkRigAdapter class to adapt a master rig to a loaded .stk dictionary.
- Added methods for fitting bone lengths, recalibrating IK targets, and mounting vector shapes.
- Defined constants for default proportions and bone paths.
- Included error handling for missing nodes and invalid data structures.
This commit is contained in:
2026-08-18 17:12:54 -04:00
parent 1eeeb64b39
commit 48d98ce0fe
13 changed files with 1994 additions and 108 deletions
+62 -7
View File
@@ -268,23 +268,78 @@ The .stk file should account for the new attributes introduced in this phase.
## Stickman editor (Phase 6)
### Touchpad controls
Currently the mouse handles most of the controls. We need to adapt the controls to a touchpad as well. We should make the following adaptions:
- Panning in each window is handled by holding down the middle mouse button and moving the mouse. This should be done on a touchpad by using a 2 finger drag.
- Zoom in handled by the scroll wheel on the mouse. It should also be handled by pinch zooming on the touchpad.
Currently the mouse handles most of the controls. We need to adapt the controls to a touchpad as well. We should make the following adaptions:
- Panning in each window is handled by holding down the middle mouse button and moving the mouse. This should be done on a touchpad by using a 2 finger drag.
- Zoom in handled by the scroll wheel on the mouse. It should also be handled by pinch zooming on the touchpad.
### Color picker recent colors
The color picker currently is not storing recent colors. It should keep track of at least 8 colors that were used previously in the project so that the user can reuse colors.
The color picker currently is not storing recent colors. It should keep track of at least 8 colors that were used previously in the project so that the user can reuse colors.
### Bottom of screen status bar
Just like the menu bar at the top of the screen, the bottom of the screen should have a status bar that will hold information about the project, current operation, etc. It should be easily readable
Just like the menu bar at the top of the screen, the bottom of the screen should have a status bar that will hold information about the project, current operation, etc. It should be easily readable
### Pixel (x, y) display on the status bar
In the status bar described above, we should display the current coordinates of the cursor in the current window in pixels. The coordinates should be based off of which window the cursor is currently over. Make sure to take into account panning and zooming, so the windows should probably have a set coordinate limit. Maybe (0, 0) to (large x, large y) This coordinate display should be on the left side of the status bar.
In the status bar described above, we should display the current coordinates of the cursor in the current window in pixels. The coordinates should be based off of which window the cursor is currently over. Make sure to take into account panning and zooming, so the windows should probably have a set coordinate limit. Maybe (0, 0) to (large x, large y) This coordinate display should be on the left side of the status bar.
### Snap status
In the status bar mentioned above, there should a display that shows if snapping is on or off. Label it as "SNAP: OFF" or "SNAP: ON". That display should be on the right side of the status bar.
In the status bar mentioned above, there should a display that shows if snapping is on or off. Label it as "SNAP: OFF" or "SNAP: ON". That display should be on the right side of the status bar.
## Stickman editor (Phase 7)
### Stickman pose silhouette guide
In our 'whole stickman' window, we need to create a silhouette guide that the user can use to place the stickman part shapes. This will help with rigging the parts with bones later on.
Currently we have a new scene master_rig.tscn that I want to use as the 'pose'
The pose should be rendered semi-transparent with visual joint anchors matching the rest pose dimensions of the master_rig.tscn
The joints should be small circular joint anchor indicators (radius 6.0 px) at all key pivot locations: Head, Neck, LeftShoulder, LeftElbow, LeftWrist, RightShoulder, RightElbow, RightWrist, Hips, LeftKnee, LeftAnkle, RightKnee, RightAnkle.
Use clear visual separation to prevent misassigned limb axes:
Left Side (Left Arm / Left Leg): Cyan/Blue tint
Right Side (Right Arm / Right Leg): Orange/Red tint
Central Axis (Spine / Head): Neutral White tint
## Stickman editor (Phase 8)
### .stk proportion & joint export + runtime skeleton adapter
We are building a dynamic stickman pipeline. .stk vector graphics need to automatically fit onto master_rig.tscn. The .stk JSON currently contains vector shapes, part transforms, and colors, but lacks explicit joint pivot and bone length definitions.
Update .stk Save Exporter:
When saving/exporting a .stk file after silhouette alignment, calculate and append a top-level "proportions" object containing:
upper_arm_length: distance between shoulder joint and elbow joint.
lower_arm_length: distance between elbow joint and wrist joint.
upper_leg_length: distance between hip joint and knee joint.
lower_leg_length: distance between knee joint and ankle joint.
torso_length: height distance from hip base to neck.
Inside each part under "body_parts", add:
"pivot": { "x": float, "y": float } (local origin point of rotation).
"length": float (calculated pixel length for that specific segment).
### Runtime skeleton adapter
Build 'StkRigAdapter.gd' (Godot GDScript Loader):
Write a utility script StkRigAdapter.gd that takes a loaded .stk JSON dictionary and an instantiated master_rig.tscn node.
#### Bone Fitting Logic:
Read "proportions" from .stk.
Adjust Skeleton2D/Torso/LeftUpperArm.length and set LeftLowerArm.position.x = -upper_arm_length.
Adjust Skeleton2D/Torso/RightUpperArm.length and set RightLowerArm.position.x = upper_arm_length.
Adjust Skeleton2D/Torso/LeftUpperLeg.length and set LeftLowerLeg.position.y = upper_leg_length.
Adjust Skeleton2D/Torso/RightUpperLeg.length and set RightLowerLeg.position.y = upper_leg_length.
#### IK Target Recalibration:
Update IK_Targets/Left_Leg.position.y and IK_Targets/Right_Leg.position.y to equal (upper_leg_length + lower_leg_length).
Update Hand IK target default rests to match total arm length.
#### Visual Shape Mount:
Replace default Line2D nodes under $Body/ or instantiate .stk vector shape nodes attached as children to their corresponding Bone2D / RemoteTransform2D paths.
## Rules