Replace dasher-pack with unified animation-pack using original Blender bone names
This commit is contained in:
+33
-46
@@ -1,63 +1,50 @@
|
||||
# Dasher Animation Tools
|
||||
# Tools
|
||||
|
||||
The dasher character (`assets/characters/dashers/dasher_*.glb`) provides six
|
||||
animation clips. They need to be retargeted to the player rig (which uses
|
||||
`GeneralSkeleton` + Mixamo bone names) and packed into a single
|
||||
`AnimationLibrary` that `player.tscn` can reference.
|
||||
## rename_rig_in_glb.py
|
||||
|
||||
## One-time generation (headless, no editor needed)
|
||||
Renames the rig root node in each character GLB to a consistent name
|
||||
(`Character`). This makes all characters share the same skeleton path
|
||||
`Character/Skeleton3D:bone_name`, enabling a shared animation library.
|
||||
|
||||
```bash
|
||||
godot --headless --path /home/beng/Godot/Projects/tekton-enet \
|
||||
--script res://tools/convert_dasher_animations_headless.gd
|
||||
|
||||
godot --headless --path /home/beng/Godot/Projects/tekton-enet \
|
||||
--script res://tools/build_dasher_pack_headless.gd
|
||||
python3 tools/rename_rig_in_glb.py
|
||||
```
|
||||
|
||||
Output:
|
||||
- `assets/characters/animations/dasher_<name>.res` (one per glb)
|
||||
- `assets/characters/animations/dasher-pack.res` (combined library)
|
||||
Modifies: `Bob.glb`, `Oldpop.glb`, `Masbro.glb`, `Gatot.glb`
|
||||
- bob-rig → Character
|
||||
- oldpop-rig → Character
|
||||
- masbro-tpose → Character
|
||||
- gatot-tpose → Character
|
||||
|
||||
`scenes/player.tscn` already references `dasher-pack.res` as a second
|
||||
AnimationLibrary on the AnimationPlayer node, alongside the original
|
||||
`animation-pack.res`.
|
||||
Creates `.glb.bak` backups on first run. Re-runnable; restores from backup
|
||||
each time to ensure idempotency.
|
||||
|
||||
## Or run inside the editor
|
||||
After running, you must reimport in the Godot editor (or via
|
||||
`godot --headless --import`).
|
||||
|
||||
Use the EditorScript variants:
|
||||
- `tools/convert_dasher_animations.gd` (`@tool extends EditorScript`)
|
||||
- `tools/build_dasher_pack.gd` (`@tool extends EditorScript`)
|
||||
## build_animation_pack.gd
|
||||
|
||||
Open each in the editor and `File > Run` (`Ctrl+Shift+X`).
|
||||
Headless script that extracts all animations from `animation-0.glb`,
|
||||
applies rest-pose correction against `Bob.glb` (the reference rig), and
|
||||
saves as `assets/characters/animations/animation-pack.res`.
|
||||
|
||||
## Usage
|
||||
|
||||
```gdscript
|
||||
anim_player.play("dasher-pack/dasher_hit")
|
||||
anim_player.play("dasher-pack/dasher_stun")
|
||||
# etc.
|
||||
```bash
|
||||
godot --headless --path . --script tools/build_animation_pack.gd
|
||||
```
|
||||
|
||||
## How it works
|
||||
Run `rename_rig_in_glb.py` first so the reference skeleton has the
|
||||
expected path.
|
||||
|
||||
Each `dasher_*.glb` contains three source animations in a single
|
||||
`AnimationLibrary` (e.g. `dasher_hold.glb` has `bob-rig|Hold|Anima_Layer`,
|
||||
`bob-rig|Put|Anima_Layer`, `bob-rig|bob ani|Anima_Layer`). The converter
|
||||
picks the most relevant one based on the glb filename
|
||||
(`ANIM_PICK` constant in `convert_dasher_animations_headless.gd`) and
|
||||
retargets the bone names. The resulting `.res` has one animation per glb
|
||||
named after the glb (`dasher_hold`, `dasher_hit`, etc.), retargeted to
|
||||
`GeneralSkeleton:<MixamoBone>` paths so they apply against the player's
|
||||
shared skeleton.
|
||||
The animation-pack contains 15 animations used by the player:
|
||||
- idle, walk_forward, backflip_1
|
||||
- take_tile_1, take_tile_2, drop_tile_1, drop_tile_2, spawn_tile_1
|
||||
- pickup_1, put_1, holding_1
|
||||
- hit_1, hitted_1, getting_hit_1, stun_1
|
||||
|
||||
The `BONE_REMAP` table in the converter defines Blender → Mixamo bone
|
||||
name translations (e.g. `head` → `Head`, `hand.L` → `LeftHand`).
|
||||
Helper nodes (`head_end`, `hand.L_end`, etc.) that don't exist in the
|
||||
player rig are silently dropped.
|
||||
All tracks use original Blender bone names with path
|
||||
`Character/Skeleton3D:bone_name` so they resolve regardless of which
|
||||
character model is active.
|
||||
|
||||
## Editing the bone remap
|
||||
## generate_version_json.py
|
||||
|
||||
If a dasher animation doesn't apply correctly, the most likely cause is a
|
||||
bone name in the glb that's not in `BONE_REMAP`. Add the entry in
|
||||
`convert_dasher_animations_headless.gd` and re-run both tools.
|
||||
Generates version.json for game update checks.
|
||||
|
||||
Reference in New Issue
Block a user