diff options
author | reduz <reduzio@gmail.com> | 2022-04-07 13:49:28 +0200 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2022-04-11 12:51:54 +0200 |
commit | 6f401439f849c0c99d8455c607fdef28750ee889 (patch) | |
tree | 3d491feed810e8be2483bce0df2d86626767e7d0 /modules | |
parent | b80a6abaeb8437b75d987952bb829af425f6614e (diff) |
Implement Animation Libraries
* Instead of containing single animations, AnimationPlayer now contains libraries.
* Libraries, in turn, contain the animations.
This paves the way for implementing the possibility of importing scenes as animation libraries, finally allowing to import animations separate from the 3D models.
Missing (will be done on separate PRs):
* Make it possible to import scenes (dae/fbx/gltf) as animation libraries.
* Make it possible for AnimationTree to import animation libraries on its own, so it does not rely on AnimationPlayer for everything.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gltf/gltf_document.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index ee756c6d2e..fe00f565be 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -6097,7 +6097,14 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap, animation->set_length(length); - ap->add_animation(name, animation); + Ref<AnimationLibrary> library; + if (!ap->has_animation_library("")) { + library.instantiate(); + ap->add_animation_library("", library); + } else { + library = ap->get_animation_library(""); + } + library->add_animation(name, animation); } void GLTFDocument::_convert_mesh_instances(Ref<GLTFState> state) { |