Add animation store for pre-made clips
aac.AnimationStore(folder) seeds a clip from an existing .anim asset and returns a normal ClipBuilder, so pre-made clips work anywhere generated clips do and can still be edited (looping, keyframes, toggles, blend shapes). The Unity side clones the asset into the container and applies the script's changes to the clone, leaving the original untouched. - ClipData gains optional source; looping becomes Option<bool> so an untouched store clip keeps the asset's own looping setting. - Add rust/examples/animation_store.rhai, a worked store example.
This commit is contained in:
@@ -60,6 +60,27 @@ use `when_all([speed < 0.05, is_sitting == false])`.
|
||||
See `rust/examples/avatar.rhai` for the full surface: parameters, clips, curves, blend trees,
|
||||
sub-state machines, any-state transitions, and transition settings.
|
||||
|
||||
### Pre-made clips (animation store)
|
||||
|
||||
An animation store seeds clips from `AnimationClip` assets that already exist in the project.
|
||||
`store.clip(name)` resolves to `<folder>/<name>.anim` and returns a motion usable anywhere a
|
||||
generated clip is: as a state motion, as a blend tree child, or through `add_motion_direct`. A store
|
||||
clip can be edited like any other clip.
|
||||
|
||||
```rhai
|
||||
let store = aac.AnimationStore("Assets/Doloro/Clips");
|
||||
let walk = store.clip("Walk"); // Assets/Doloro/Clips/Walk.anim
|
||||
walk.looping(true);
|
||||
walk.keyframe("Body/Props", "m_IsActive", 0.0, 0.0);
|
||||
walk_state.set_clip(walk);
|
||||
locomotion.add_motion(walk, 0.0);
|
||||
```
|
||||
|
||||
The generator loads the asset with `AssetDatabase.LoadAssetAtPath`, clones it into the asset
|
||||
container, and applies the script's keyframes and looping on the clone: the pre-made asset is never
|
||||
modified. A store clip with no `looping(...)` call keeps the source asset's own looping setting.
|
||||
Requesting the same asset twice reuses the one reference, and a missing asset is a clear error.
|
||||
|
||||
## Generating
|
||||
|
||||
Open *Tools > Animator As Crab* and fill in the window:
|
||||
|
||||
Reference in New Issue
Block a user