separate Gltf/Morph/BoneAnimationComponentManager definitions

move gltf animation instantiation to GltfAnimationComponentManager (this helps ensure we are creating the component on the correct entity)
This commit is contained in:
Nick Fisher
2025-05-20 14:57:26 +08:00
parent d61723dee2
commit 1fb68b20e9
24 changed files with 629 additions and 354 deletions

View File

@@ -621,8 +621,12 @@ class FFIAsset extends ThermionAsset {
///
@override
Future<double> getGltfAnimationDuration(int animationIndex) async {
return AnimationManager_getGltfAnimationDuration(
final duration = AnimationManager_getGltfAnimationDuration(
animationManager, asset, animationIndex);
if (duration < 0) {
throw Exception("Failed to get glTF animation duration");
}
return duration;
}
///
@@ -1030,6 +1034,18 @@ class FFIAsset extends ThermionAsset {
///
///
Future removeAnimationComponent() async {
AnimationManager_removeGltfAnimationComponent(animationManager, this.asset);
if (!AnimationManager_removeGltfAnimationComponent(
animationManager, asset)) {
throw Exception("Failed to remove glTF animation component");
}
if (!AnimationManager_removeBoneAnimationComponent(
animationManager, asset)) {
throw Exception("Failed to remove bone animation component");
}
AnimationManager_removeMorphAnimationComponent(animationManager, entity);
for (final child in await getChildEntities()) {
AnimationManager_removeMorphAnimationComponent(animationManager, child);
}
}
}