1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

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.
This commit is contained in:
reduz
2022-04-07 13:49:28 +02:00
parent b80a6abaeb
commit 6f401439f8
21 changed files with 1742 additions and 394 deletions

View File

@@ -33,6 +33,7 @@
#include "editor/animation_track_editor.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_library_editor.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/slider.h"
@@ -40,7 +41,6 @@
#include "scene/gui/texture_button.h"
#include "scene/gui/tree.h"
class EditorFileDialog;
class AnimationPlayerEditorPlugin;
class AnimationPlayerEditor : public VBoxContainer {
@@ -51,16 +51,11 @@ class AnimationPlayerEditor : public VBoxContainer {
enum {
TOOL_NEW_ANIM,
TOOL_LOAD_ANIM,
TOOL_SAVE_ANIM,
TOOL_SAVE_AS_ANIM,
TOOL_ANIM_LIBRARY,
TOOL_DUPLICATE_ANIM,
TOOL_RENAME_ANIM,
TOOL_EDIT_TRANSITIONS,
TOOL_REMOVE_ANIM,
TOOL_COPY_ANIM,
TOOL_PASTE_ANIM,
TOOL_PASTE_ANIM_REF,
TOOL_EDIT_RESOURCE
};
@@ -103,8 +98,10 @@ class AnimationPlayerEditor : public VBoxContainer {
SpinBox *frame = nullptr;
LineEdit *scale = nullptr;
LineEdit *name = nullptr;
OptionButton *library = nullptr;
Label *name_title = nullptr;
UndoRedo *undo_redo = nullptr;
Ref<Texture2D> autoplay_icon;
Ref<Texture2D> reset_icon;
Ref<ImageTexture> autoplay_reset_icon;
@@ -114,6 +111,8 @@ class AnimationPlayerEditor : public VBoxContainer {
EditorFileDialog *file = nullptr;
ConfirmationDialog *delete_dialog = nullptr;
AnimationLibraryEditor *library_editor = nullptr;
struct BlendEditor {
AcceptDialog *dialog = nullptr;
Tree *tree = nullptr;
@@ -173,11 +172,6 @@ class AnimationPlayerEditor : public VBoxContainer {
void _animation_new();
void _animation_rename();
void _animation_name_edited();
void _animation_load();
void _animation_save_in_path(const Ref<Resource> &p_resource, const String &p_path);
void _animation_save(const Ref<Resource> &p_resource);
void _animation_save_as(const Ref<Resource> &p_resource);
void _animation_remove();
void _animation_remove_confirmed();
@@ -185,11 +179,8 @@ class AnimationPlayerEditor : public VBoxContainer {
void _animation_edit();
void _animation_duplicate();
Ref<Animation> _animation_clone(const Ref<Animation> p_anim);
void _animation_paste(const Ref<Animation> p_anim);
void _animation_resource_edit();
void _scale_changed(const String &p_scale);
void _save_animation(String p_file);
void _load_animations(Vector<String> p_files);
void _seek_value_changed(float p_value, bool p_set = false, bool p_timeline_only = false);
void _blend_editor_next_changed(const int p_idx);
@@ -219,6 +210,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _stop_onion_skinning();
void _pin_pressed();
String _get_current() const;
~AnimationPlayerEditor();