Files
tekton/tools/README.md
T
2026-06-12 18:05:04 +08:00

64 lines
2.3 KiB
Markdown

# Dasher Animation 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.
## One-time generation (headless, no editor needed)
```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
```
Output:
- `assets/characters/animations/dasher_<name>.res` (one per glb)
- `assets/characters/animations/dasher-pack.res` (combined library)
`scenes/player.tscn` already references `dasher-pack.res` as a second
AnimationLibrary on the AnimationPlayer node, alongside the original
`animation-pack.res`.
## Or run inside the editor
Use the EditorScript variants:
- `tools/convert_dasher_animations.gd` (`@tool extends EditorScript`)
- `tools/build_dasher_pack.gd` (`@tool extends EditorScript`)
Open each in the editor and `File > Run` (`Ctrl+Shift+X`).
## Usage
```gdscript
anim_player.play("dasher-pack/dasher_hit")
anim_player.play("dasher-pack/dasher_stun")
# etc.
```
## How it works
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 `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.
## Editing the bone remap
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.