mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Implement AnimationManager the base class of AnimationPlayer/Tree
This commit is contained in:
parent
545d1c0adb
commit
1b95827d3e
49 changed files with 4746 additions and 4943 deletions
|
|
@ -50,16 +50,16 @@
|
|||
#include "scene/scene_string_names.h"
|
||||
|
||||
void AnimationTreeEditor::edit(AnimationTree *p_tree) {
|
||||
if (p_tree && !p_tree->is_connected("animation_player_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed))) {
|
||||
p_tree->connect("animation_player_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed), CONNECT_DEFERRED);
|
||||
if (p_tree && !p_tree->is_connected("animation_list_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed))) {
|
||||
p_tree->connect("animation_list_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed), CONNECT_DEFERRED);
|
||||
}
|
||||
|
||||
if (tree == p_tree) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tree && tree->is_connected("animation_player_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed))) {
|
||||
tree->disconnect("animation_player_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed));
|
||||
if (tree && tree->is_connected("animation_list_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed))) {
|
||||
tree->disconnect("animation_list_changed", callable_mp(this, &AnimationTreeEditor::_animation_list_changed));
|
||||
}
|
||||
|
||||
tree = p_tree;
|
||||
|
|
@ -122,7 +122,7 @@ void AnimationTreeEditor::_update_path() {
|
|||
void AnimationTreeEditor::edit_path(const Vector<String> &p_path) {
|
||||
button_path.clear();
|
||||
|
||||
Ref<AnimationNode> node = tree->get_tree_root();
|
||||
Ref<AnimationNode> node = tree->get_root_animation_node();
|
||||
|
||||
if (node.is_valid()) {
|
||||
current_root = node->get_instance_id();
|
||||
|
|
@ -185,8 +185,8 @@ void AnimationTreeEditor::_notification(int p_what) {
|
|||
} break;
|
||||
case NOTIFICATION_PROCESS: {
|
||||
ObjectID root;
|
||||
if (tree && tree->get_tree_root().is_valid()) {
|
||||
root = tree->get_tree_root()->get_instance_id();
|
||||
if (tree && tree->get_root_animation_node().is_valid()) {
|
||||
root = tree->get_root_animation_node()->get_instance_id();
|
||||
}
|
||||
|
||||
if (root != current_root) {
|
||||
|
|
@ -247,18 +247,12 @@ Vector<String> AnimationTreeEditor::get_animation_list() {
|
|||
}
|
||||
|
||||
AnimationTree *tree = singleton->tree;
|
||||
if (!tree || !tree->has_node(tree->get_animation_player())) {
|
||||
return Vector<String>();
|
||||
}
|
||||
|
||||
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(tree->get_node(tree->get_animation_player()));
|
||||
|
||||
if (!ap) {
|
||||
if (!tree) {
|
||||
return Vector<String>();
|
||||
}
|
||||
|
||||
List<StringName> anims;
|
||||
ap->get_animation_list(&anims);
|
||||
tree->get_animation_list(&anims);
|
||||
Vector<String> ret;
|
||||
for (const StringName &E : anims) {
|
||||
ret.push_back(E);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue