diff --git a/editor/icons/icon_animation_tree.svg b/editor/icons/icon_animation_tree.svg
new file mode 100644
index 00000000000..046506fa37b
--- /dev/null
+++ b/editor/icons/icon_animation_tree.svg
@@ -0,0 +1,5 @@
+
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 15d259e4395..2e128db8830 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -62,7 +62,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refadd_submenu_item(TTR("Add Animation"), "animations");
- AnimationGraphPlayer *gp = blend_space->get_graph_player();
+ AnimationTree *gp = blend_space->get_tree();
ERR_FAIL_COND(!gp);
if (gp->has_node(gp->get_animation_player())) {
@@ -519,12 +519,12 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_PROCESS) {
String error;
- if (!blend_space->get_graph_player()) {
- error = TTR("BlendSpace1D does not belong to an AnimationGraphPlayer node.");
- } else if (!blend_space->get_graph_player()->is_active()) {
- error = TTR("AnimationGraphPlayer is inactive.\nActivate to enable playback, check node warnings if activation fails.");
- } else if (blend_space->get_graph_player()->is_state_invalid()) {
- error = blend_space->get_graph_player()->get_invalid_state_reason();
+ if (!blend_space->get_tree()) {
+ error = TTR("BlendSpace1D does not belong to an AnimationTree node.");
+ } else if (!blend_space->get_tree()->is_active()) {
+ error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
+ } else if (blend_space->get_tree()->is_state_invalid()) {
+ error = blend_space->get_tree()->get_invalid_state_reason();
}
if (error != error_label->get_text()) {
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 775fdba932c..8d170622482 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -54,7 +54,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refadd_submenu_item(TTR("Add Animation"), "animations");
- AnimationGraphPlayer *gp = blend_space->get_graph_player();
+ AnimationTree *gp = blend_space->get_tree();
ERR_FAIL_COND(!gp);
if (gp && gp->has_node(gp->get_animation_player())) {
AnimationPlayer *ap = Object::cast_to(gp->get_node(gp->get_animation_player()));
@@ -693,12 +693,12 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
String error;
- if (!blend_space->get_graph_player()) {
- error = TTR("BlendSpace2D does not belong to an AnimationGraphPlayer node.");
- } else if (!blend_space->get_graph_player()->is_active()) {
- error = TTR("AnimationGraphPlayer is inactive.\nActivate to enable playback, check node warnings if activation fails.");
- } else if (blend_space->get_graph_player()->is_state_invalid()) {
- error = blend_space->get_graph_player()->get_invalid_state_reason();
+ if (!blend_space->get_tree()) {
+ error = TTR("BlendSpace2D does not belong to an AnimationTree node.");
+ } else if (!blend_space->get_tree()->is_active()) {
+ error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
+ } else if (blend_space->get_tree()->is_state_invalid()) {
+ error = blend_space->get_tree()->get_invalid_state_reason();
} else if (blend_space->get_triangle_count() == 0) {
error = TTR("No triangles exist, so no blending can take place.");
}
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 32fc617a358..7d0e2929bd4 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -169,7 +169,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
ProgressBar *pb = memnew(ProgressBar);
- AnimationGraphPlayer *player = anim->get_graph_player();
+ AnimationTree *player = anim->get_tree();
if (player->has_node(player->get_animation_player())) {
AnimationPlayer *ap = Object::cast_to(player->get_node(player->get_animation_player()));
if (ap) {
@@ -417,14 +417,14 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano
if (updating || _filter_edit != anode)
return false;
- NodePath player_path = anode->get_graph_player()->get_animation_player();
+ NodePath player_path = anode->get_tree()->get_animation_player();
- if (!anode->get_graph_player()->has_node(player_path)) {
+ if (!anode->get_tree()->has_node(player_path)) {
EditorNode::get_singleton()->show_warning(TTR("No animation player set, so unable to retrieve track names."));
return false;
}
- AnimationPlayer *player = Object::cast_to(anode->get_graph_player()->get_node(player_path));
+ AnimationPlayer *player = Object::cast_to(anode->get_tree()->get_node(player_path));
if (!player) {
EditorNode::get_singleton()->show_warning(TTR("Player path set is invalid, so unable to retrieve track names."));
return false;
@@ -603,12 +603,12 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
String error;
- if (!blend_tree->get_graph_player()) {
- error = TTR("BlendTree does not belong to an AnimationGraphPlayer node.");
- } else if (!blend_tree->get_graph_player()->is_active()) {
- error = TTR("AnimationGraphPlayer is inactive.\nActivate to enable playback, check node warnings if activation fails.");
- } else if (blend_tree->get_graph_player()->is_state_invalid()) {
- error = blend_tree->get_graph_player()->get_invalid_state_reason();
+ if (!blend_tree->get_tree()) {
+ error = TTR("BlendTree does not belong to an AnimationTree node.");
+ } else if (!blend_tree->get_tree()->is_active()) {
+ error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
+ } else if (blend_tree->get_tree()->is_state_invalid()) {
+ error = blend_tree->get_tree()->get_invalid_state_reason();
}
if (error != error_label->get_text()) {
@@ -624,13 +624,13 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
blend_tree->get_node_connections(&conns);
for (List::Element *E = conns.front(); E; E = E->next()) {
float activity = 0;
- if (blend_tree->get_graph_player() && !blend_tree->get_graph_player()->is_state_invalid()) {
+ if (blend_tree->get_tree() && !blend_tree->get_tree()->is_state_invalid()) {
activity = blend_tree->get_connection_activity(E->get().input_node, E->get().input_index);
}
graph->set_connection_activity(E->get().output_node, 0, E->get().input_node, E->get().input_index, activity);
}
- AnimationGraphPlayer *graph_player = blend_tree->get_graph_player();
+ AnimationTree *graph_player = blend_tree->get_tree();
AnimationPlayer *player = NULL;
if (graph_player->has_node(graph_player->get_animation_player())) {
player = Object::cast_to(graph_player->get_node(graph_player->get_animation_player()));
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 0146f41163e..04bd5f0cec7 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -59,7 +59,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Refadd_submenu_item(TTR("Add Animation"), "animations");
- AnimationGraphPlayer *gp = state_machine->get_graph_player();
+ AnimationTree *gp = state_machine->get_tree();
ERR_FAIL_COND(!gp);
if (gp && gp->has_node(gp->get_animation_player())) {
AnimationPlayer *ap = Object::cast_to(gp->get_node(gp->get_animation_player()));
@@ -859,12 +859,12 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
if (error_time > 0) {
error = error_text;
error_time -= get_process_delta_time();
- } else if (!state_machine->get_graph_player()) {
- error = TTR("StateMachine does not belong to an AnimationGraphPlayer node.");
- } else if (!state_machine->get_graph_player()->is_active()) {
- error = TTR("AnimationGraphPlayer is inactive.\nActivate to enable playback, check node warnings if activation fails.");
- } else if (state_machine->get_graph_player()->is_state_invalid()) {
- error = state_machine->get_graph_player()->get_invalid_state_reason();
+ } else if (!state_machine->get_tree()) {
+ error = TTR("StateMachine does not belong to an AnimationTree node.");
+ } else if (!state_machine->get_tree()->is_active()) {
+ error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
+ } else if (state_machine->get_tree()->is_state_invalid()) {
+ error = state_machine->get_tree()->get_invalid_state_reason();
} else if (state_machine->get_parent().is_valid() && state_machine->get_parent()->is_class("AnimationNodeStateMachine")) {
if (state_machine->get_start_node() == StringName() || state_machine->get_end_node() == StringName()) {
error = TTR("Start and end nodes are needed for a sub-transition.");
diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp
index 6f659cc2bb1..c9953b27619 100644
--- a/scene/animation/animation_blend_space_1d.cpp
+++ b/scene/animation/animation_blend_space_1d.cpp
@@ -67,7 +67,7 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref &p_
blend_points[p_at_index].position = p_position;
blend_points[p_at_index].node->set_parent(this);
- blend_points[p_at_index].node->set_graph_player(get_graph_player());
+ blend_points[p_at_index].node->set_tree(get_tree());
blend_points_used++;
}
@@ -84,12 +84,12 @@ void AnimationNodeBlendSpace1D::set_blend_point_node(int p_point, const Refset_parent(NULL);
- blend_points[p_point].node->set_graph_player(NULL);
+ blend_points[p_point].node->set_tree(NULL);
}
blend_points[p_point].node = p_node;
blend_points[p_point].node->set_parent(this);
- blend_points[p_point].node->set_graph_player(get_graph_player());
+ blend_points[p_point].node->set_tree(get_tree());
}
float AnimationNodeBlendSpace1D::get_blend_point_position(int p_point) const {
@@ -106,7 +106,7 @@ void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) {
ERR_FAIL_INDEX(p_point, blend_points_used);
blend_points[p_point].node->set_parent(NULL);
- blend_points[p_point].node->set_graph_player(NULL);
+ blend_points[p_point].node->set_tree(NULL);
for (int i = p_point; i < blend_points_used - 1; i++) {
blend_points[i] = blend_points[i + 1];
@@ -267,6 +267,6 @@ AnimationNodeBlendSpace1D::~AnimationNodeBlendSpace1D() {
for (int i = 0; i < blend_points_used; i++) {
blend_points[i].node->set_parent(this);
- blend_points[i].node->set_graph_player(get_graph_player());
+ blend_points[i].node->set_tree(get_tree());
}
}
diff --git a/scene/animation/animation_blend_space_1d.h b/scene/animation/animation_blend_space_1d.h
index 447c948e93e..6e264076c42 100644
--- a/scene/animation/animation_blend_space_1d.h
+++ b/scene/animation/animation_blend_space_1d.h
@@ -1,7 +1,7 @@
#ifndef ANIMATION_BLEND_SPACE_1D_H
#define ANIMATION_BLEND_SPACE_1D_H
-#include "scene/animation/animation_graph_player.h"
+#include "scene/animation/animation_tree.h"
class AnimationNodeBlendSpace1D : public AnimationRootNode {
GDCLASS(AnimationNodeBlendSpace1D, AnimationRootNode)
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index 675285b0755..28e4ca4eda3 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -25,7 +25,7 @@ void AnimationNodeBlendSpace2D::add_blend_point(const Ref &p_
blend_points[p_at_index].position = p_position;
blend_points[p_at_index].node->set_parent(this);
- blend_points[p_at_index].node->set_graph_player(get_graph_player());
+ blend_points[p_at_index].node->set_tree(get_tree());
blend_points_used++;
if (auto_triangles) {
@@ -46,11 +46,11 @@ void AnimationNodeBlendSpace2D::set_blend_point_node(int p_point, const Refset_parent(NULL);
- blend_points[p_point].node->set_graph_player(NULL);
+ blend_points[p_point].node->set_tree(NULL);
}
blend_points[p_point].node = p_node;
blend_points[p_point].node->set_parent(this);
- blend_points[p_point].node->set_graph_player(get_graph_player());
+ blend_points[p_point].node->set_tree(get_tree());
}
Vector2 AnimationNodeBlendSpace2D::get_blend_point_position(int p_point) const {
ERR_FAIL_INDEX_V(p_point, blend_points_used, Vector2());
@@ -64,7 +64,7 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) {
ERR_FAIL_INDEX(p_point, blend_points_used);
blend_points[p_point].node->set_parent(NULL);
- blend_points[p_point].node->set_graph_player(NULL);
+ blend_points[p_point].node->set_tree(NULL);
for (int i = 0; i < triangles.size(); i++) {
bool erase = false;
@@ -553,6 +553,6 @@ AnimationNodeBlendSpace2D::~AnimationNodeBlendSpace2D() {
for (int i = 0; i < blend_points_used; i++) {
blend_points[i].node->set_parent(this);
- blend_points[i].node->set_graph_player(get_graph_player());
+ blend_points[i].node->set_tree(get_tree());
}
}
diff --git a/scene/animation/animation_blend_space_2d.h b/scene/animation/animation_blend_space_2d.h
index f8f2440088a..5af0b9ba7ff 100644
--- a/scene/animation/animation_blend_space_2d.h
+++ b/scene/animation/animation_blend_space_2d.h
@@ -1,7 +1,7 @@
#ifndef ANIMATION_BLEND_SPACE_2D_H
#define ANIMATION_BLEND_SPACE_2D_H
-#include "scene/animation/animation_graph_player.h"
+#include "scene/animation/animation_tree.h"
class AnimationNodeBlendSpace2D : public AnimationRootNode {
GDCLASS(AnimationNodeBlendSpace2D, AnimationRootNode)
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index ced0cbbbba7..feacea56569 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -16,7 +16,7 @@ float AnimationNodeAnimation::get_playback_time() const {
void AnimationNodeAnimation::_validate_property(PropertyInfo &property) const {
if (property.name == "animation") {
- AnimationGraphPlayer *gp = get_graph_player();
+ AnimationTree *gp = get_tree();
if (gp && gp->has_node(gp->get_animation_player())) {
AnimationPlayer *ap = Object::cast_to(gp->get_node(gp->get_animation_player()));
if (ap) {
@@ -762,13 +762,13 @@ void AnimationNodeBlendTree::add_node(const StringName &p_name, Refget_parent().is_valid());
- ERR_FAIL_COND(p_node->get_graph_player() != NULL);
+ ERR_FAIL_COND(p_node->get_tree() != NULL);
ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output);
ERR_FAIL_COND(String(p_name).find("/") != -1);
nodes[p_name] = p_node;
p_node->set_parent(this);
- p_node->set_graph_player(get_graph_player());
+ p_node->set_tree(get_tree());
emit_changed();
}
@@ -804,7 +804,7 @@ void AnimationNodeBlendTree::remove_node(const StringName &p_name) {
node->set_input_connection(i, StringName());
}
node->set_parent(NULL);
- node->set_graph_player(NULL);
+ node->set_tree(NULL);
}
nodes.erase(p_name);
@@ -965,13 +965,13 @@ Vector2 AnimationNodeBlendTree::get_graph_offset() const {
return graph_offset;
}
-void AnimationNodeBlendTree::set_graph_player(AnimationGraphPlayer *p_player) {
+void AnimationNodeBlendTree::set_tree(AnimationTree *p_player) {
- AnimationNode::set_graph_player(p_player);
+ AnimationNode::set_tree(p_player);
for (Map >::Element *E = nodes.front(); E; E = E->next()) {
Ref node = E->get();
- node->set_graph_player(p_player);
+ node->set_tree(p_player);
}
}
@@ -1107,6 +1107,6 @@ AnimationNodeBlendTree::~AnimationNodeBlendTree() {
for (Map >::Element *E = nodes.front(); E; E = E->next()) {
E->get()->set_parent(NULL);
- E->get()->set_graph_player(NULL);
+ E->get()->set_tree(NULL);
}
}
diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h
index 7623fd3e571..8d7932196c8 100644
--- a/scene/animation/animation_blend_tree.h
+++ b/scene/animation/animation_blend_tree.h
@@ -1,7 +1,7 @@
#ifndef ANIMATION_BLEND_TREE_H
#define ANIMATION_BLEND_TREE_H
-#include "scene/animation/animation_graph_player.h"
+#include "scene/animation/animation_tree.h"
class AnimationNodeAnimation : public AnimationRootNode {
@@ -318,7 +318,7 @@ public:
void set_graph_offset(const Vector2 &p_graph_offset);
Vector2 get_graph_offset() const;
- virtual void set_graph_player(AnimationGraphPlayer *p_player);
+ virtual void set_tree(AnimationTree *p_player);
AnimationNodeBlendTree();
~AnimationNodeBlendTree();
};
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 4b4666803c1..c5ad9808065 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -91,12 +91,12 @@ void AnimationNodeStateMachine::add_node(const StringName &p_name, Refget_parent().is_valid());
- ERR_FAIL_COND(p_node->get_graph_player() != NULL);
+ ERR_FAIL_COND(p_node->get_tree() != NULL);
ERR_FAIL_COND(String(p_name).find("/") != -1);
states[p_name] = p_node;
p_node->set_parent(this);
- p_node->set_graph_player(get_graph_player());
+ p_node->set_tree(get_tree());
emit_changed();
}
@@ -132,7 +132,7 @@ void AnimationNodeStateMachine::remove_node(const StringName &p_name) {
node->set_input_connection(i, StringName());
}
node->set_parent(NULL);
- node->set_graph_player(NULL);
+ node->set_tree(NULL);
}
states.erase(p_name);
@@ -623,13 +623,13 @@ String AnimationNodeStateMachine::get_caption() const {
void AnimationNodeStateMachine::_notification(int p_what) {
}
-void AnimationNodeStateMachine::set_graph_player(AnimationGraphPlayer *p_player) {
+void AnimationNodeStateMachine::set_tree(AnimationTree *p_player) {
- AnimationNode::set_graph_player(p_player);
+ AnimationNode::set_tree(p_player);
for (Map >::Element *E = states.front(); E; E = E->next()) {
Ref node = E->get();
- node->set_graph_player(p_player);
+ node->set_tree(p_player);
}
}
diff --git a/scene/animation/animation_node_state_machine.h b/scene/animation/animation_node_state_machine.h
index 438a2f18553..e7357e09ea1 100644
--- a/scene/animation/animation_node_state_machine.h
+++ b/scene/animation/animation_node_state_machine.h
@@ -1,7 +1,7 @@
#ifndef ANIMATION_NODE_STATE_MACHINE_H
#define ANIMATION_NODE_STATE_MACHINE_H
-#include "scene/animation/animation_graph_player.h"
+#include "scene/animation/animation_tree.h"
class AnimationNodeStateMachineTransition : public Resource {
GDCLASS(AnimationNodeStateMachineTransition, Resource)
@@ -134,7 +134,7 @@ public:
float get_current_play_pos() const;
float get_current_length() const;
- virtual void set_graph_player(AnimationGraphPlayer *p_player);
+ virtual void set_tree(AnimationTree *p_player);
AnimationNodeStateMachine();
};
diff --git a/scene/animation/animation_graph_player.cpp b/scene/animation/animation_tree.cpp
similarity index 91%
rename from scene/animation/animation_graph_player.cpp
rename to scene/animation/animation_tree.cpp
index b8efecebe91..7cc67b4cc33 100644
--- a/scene/animation/animation_graph_player.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -1,4 +1,4 @@
-#include "animation_graph_player.h"
+#include "animation_tree.h"
#include "animation_blend_tree.h"
#include "core/method_bind_ext.gen.inc"
#include "engine.h"
@@ -56,11 +56,11 @@ void AnimationNode::make_invalid(const String &p_reason) {
float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) {
ERR_FAIL_INDEX_V(p_input, inputs.size(), 0);
ERR_FAIL_COND_V(!state, 0);
- ERR_FAIL_COND_V(!get_graph_player(), 0); //should not happen, but used to catch bugs
+ ERR_FAIL_COND_V(!get_tree(), 0); //should not happen, but used to catch bugs
Ref tree = get_parent();
- if (!tree.is_valid() && get_graph_player()->get_graph_root().ptr() != this) {
+ if (!tree.is_valid() && get_tree()->get_graph_root().ptr() != this) {
make_invalid(RTR("Can't blend input because node is not in a tree"));
return 0;
}
@@ -204,10 +204,10 @@ String AnimationNode::get_input_name(int p_input) {
float AnimationNode::get_input_activity(int p_input) const {
ERR_FAIL_INDEX_V(p_input, inputs.size(), 0);
- if (!get_graph_player())
+ if (!get_tree())
return 0;
- if (get_graph_player()->get_last_process_pass() != inputs[p_input].last_pass) {
+ if (get_tree()->get_last_process_pass() != inputs[p_input].last_pass) {
return 0;
}
return inputs[p_input].activity;
@@ -265,7 +265,7 @@ Ref AnimationNode::get_parent() const {
return Ref();
}
-AnimationGraphPlayer *AnimationNode::get_graph_player() const {
+AnimationTree *AnimationNode::get_tree() const {
return player;
}
@@ -316,7 +316,7 @@ Vector2 AnimationNode::get_position() const {
return position;
}
-void AnimationNode::set_graph_player(AnimationGraphPlayer *p_player) {
+void AnimationNode::set_tree(AnimationTree *p_player) {
if (player != NULL && p_player == NULL) {
emit_signal("removed_from_graph");
@@ -398,10 +398,10 @@ AnimationNode::AnimationNode() {
////////////////////
-void AnimationGraphPlayer::set_graph_root(const Ref &p_root) {
+void AnimationTree::set_graph_root(const Ref &p_root) {
if (root.is_valid()) {
- root->set_graph_player(NULL);
+ root->set_tree(NULL);
}
if (p_root.is_valid()) {
ERR_EXPLAIN("root node already set to another player");
@@ -410,17 +410,17 @@ void AnimationGraphPlayer::set_graph_root(const Ref &p_root) {
root = p_root;
if (root.is_valid()) {
- root->set_graph_player(this);
+ root->set_tree(this);
}
update_configuration_warning();
}
-Ref AnimationGraphPlayer::get_graph_root() const {
+Ref AnimationTree::get_graph_root() const {
return root;
}
-void AnimationGraphPlayer::set_active(bool p_active) {
+void AnimationTree::set_active(bool p_active) {
if (active == p_active)
return;
@@ -447,12 +447,12 @@ void AnimationGraphPlayer::set_active(bool p_active) {
}
}
-bool AnimationGraphPlayer::is_active() const {
+bool AnimationTree::is_active() const {
return active;
}
-void AnimationGraphPlayer::set_process_mode(AnimationProcessMode p_mode) {
+void AnimationTree::set_process_mode(AnimationProcessMode p_mode) {
if (process_mode == p_mode)
return;
@@ -469,20 +469,20 @@ void AnimationGraphPlayer::set_process_mode(AnimationProcessMode p_mode) {
}
}
-AnimationGraphPlayer::AnimationProcessMode AnimationGraphPlayer::get_process_mode() const {
+AnimationTree::AnimationProcessMode AnimationTree::get_process_mode() const {
return process_mode;
}
-void AnimationGraphPlayer::_node_removed(Node *p_node) {
+void AnimationTree::_node_removed(Node *p_node) {
cache_valid = false;
}
-bool AnimationGraphPlayer::_update_caches(AnimationPlayer *player) {
+bool AnimationTree::_update_caches(AnimationPlayer *player) {
setup_pass++;
if (!player->has_node(player->get_root())) {
- ERR_PRINT("AnimationGraphPlayer: AnimationPlayer root is invalid.");
+ ERR_PRINT("AnimationTree: AnimationPlayer root is invalid.");
set_active(false);
return false;
}
@@ -517,7 +517,7 @@ bool AnimationGraphPlayer::_update_caches(AnimationPlayer *player) {
Node *child = parent->get_node_and_resource(path, resource, leftover_path);
if (!child) {
- ERR_PRINTS("AnimationGraphPlayer: '" + String(E->get()) + "', couldn't resolve track: '" + String(path) + "'");
+ ERR_PRINTS("AnimationTree: '" + String(E->get()) + "', couldn't resolve track: '" + String(path) + "'");
continue;
}
@@ -547,7 +547,7 @@ bool AnimationGraphPlayer::_update_caches(AnimationPlayer *player) {
Spatial *spatial = Object::cast_to(child);
if (!spatial) {
- ERR_PRINTS("AnimationGraphPlayer: '" + String(E->get()) + "', transform track does not point to spatial: '" + String(path) + "'");
+ ERR_PRINTS("AnimationTree: '" + String(E->get()) + "', transform track does not point to spatial: '" + String(path) + "'");
continue;
}
@@ -666,7 +666,7 @@ bool AnimationGraphPlayer::_update_caches(AnimationPlayer *player) {
return true;
}
-void AnimationGraphPlayer::_clear_caches() {
+void AnimationTree::_clear_caches() {
const NodePath *K = NULL;
while ((K = track_cache.next(K))) {
@@ -678,19 +678,19 @@ void AnimationGraphPlayer::_clear_caches() {
cache_valid = false;
}
-void AnimationGraphPlayer::_process_graph(float p_delta) {
+void AnimationTree::_process_graph(float p_delta) {
//check all tracks, see if they need modification
if (!root.is_valid()) {
- ERR_PRINT("AnimationGraphPlayer: root AnimationNode is not set, disabling playback.");
+ ERR_PRINT("AnimationTree: root AnimationNode is not set, disabling playback.");
set_active(false);
cache_valid = false;
return;
}
if (!has_node(animation_player)) {
- ERR_PRINT("AnimationGraphPlayer: no valid AnimationPlayer path set, disabling playback");
+ ERR_PRINT("AnimationTree: no valid AnimationPlayer path set, disabling playback");
set_active(false);
cache_valid = false;
return;
@@ -699,7 +699,7 @@ void AnimationGraphPlayer::_process_graph(float p_delta) {
AnimationPlayer *player = Object::cast_to(get_node(animation_player));
if (!player) {
- ERR_PRINT("AnimationGraphPlayer: path points to a node not an AnimationPlayer, disabling playback");
+ ERR_PRINT("AnimationTree: path points to a node not an AnimationPlayer, disabling playback");
set_active(false);
cache_valid = false;
return;
@@ -1093,7 +1093,7 @@ void AnimationGraphPlayer::_process_graph(float p_delta) {
}
}
-void AnimationGraphPlayer::_notification(int p_what) {
+void AnimationTree::_notification(int p_what) {
if (active && p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS && process_mode == ANIMATION_PROCESS_PHYSICS) {
_process_graph(get_physics_process_delta_time());
@@ -1108,29 +1108,29 @@ void AnimationGraphPlayer::_notification(int p_what) {
}
}
-void AnimationGraphPlayer::set_animation_player(const NodePath &p_player) {
+void AnimationTree::set_animation_player(const NodePath &p_player) {
animation_player = p_player;
update_configuration_warning();
}
-NodePath AnimationGraphPlayer::get_animation_player() const {
+NodePath AnimationTree::get_animation_player() const {
return animation_player;
}
-bool AnimationGraphPlayer::is_state_invalid() const {
+bool AnimationTree::is_state_invalid() const {
return !state.valid;
}
-String AnimationGraphPlayer::get_invalid_state_reason() const {
+String AnimationTree::get_invalid_state_reason() const {
return state.invalid_reasons;
}
-uint64_t AnimationGraphPlayer::get_last_process_pass() const {
+uint64_t AnimationTree::get_last_process_pass() const {
return process_pass;
}
-String AnimationGraphPlayer::get_configuration_warning() const {
+String AnimationTree::get_configuration_warning() const {
String warning = Node::get_configuration_warning();
@@ -1174,20 +1174,20 @@ String AnimationGraphPlayer::get_configuration_warning() const {
return warning;
}
-void AnimationGraphPlayer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationGraphPlayer::set_active);
- ClassDB::bind_method(D_METHOD("is_active"), &AnimationGraphPlayer::is_active);
+void AnimationTree::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationTree::set_active);
+ ClassDB::bind_method(D_METHOD("is_active"), &AnimationTree::is_active);
- ClassDB::bind_method(D_METHOD("set_graph_root", "root"), &AnimationGraphPlayer::set_graph_root);
- ClassDB::bind_method(D_METHOD("get_graph_root"), &AnimationGraphPlayer::get_graph_root);
+ ClassDB::bind_method(D_METHOD("set_graph_root", "root"), &AnimationTree::set_graph_root);
+ ClassDB::bind_method(D_METHOD("get_graph_root"), &AnimationTree::get_graph_root);
- ClassDB::bind_method(D_METHOD("set_process_mode", "mode"), &AnimationGraphPlayer::set_process_mode);
- ClassDB::bind_method(D_METHOD("get_process_mode"), &AnimationGraphPlayer::get_process_mode);
+ ClassDB::bind_method(D_METHOD("set_process_mode", "mode"), &AnimationTree::set_process_mode);
+ ClassDB::bind_method(D_METHOD("get_process_mode"), &AnimationTree::get_process_mode);
- ClassDB::bind_method(D_METHOD("set_animation_player", "root"), &AnimationGraphPlayer::set_animation_player);
- ClassDB::bind_method(D_METHOD("get_animation_player"), &AnimationGraphPlayer::get_animation_player);
+ ClassDB::bind_method(D_METHOD("set_animation_player", "root"), &AnimationTree::set_animation_player);
+ ClassDB::bind_method(D_METHOD("get_animation_player"), &AnimationTree::get_animation_player);
- ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationGraphPlayer::_node_removed);
+ ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationTree::_node_removed);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "graph_root", PROPERTY_HINT_RESOURCE_TYPE, "AnimationRootNode", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_graph_root", "get_graph_root");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "anim_player"), "set_animation_player", "get_animation_player");
@@ -1195,7 +1195,7 @@ void AnimationGraphPlayer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_process_mode", "get_process_mode");
}
-AnimationGraphPlayer::AnimationGraphPlayer() {
+AnimationTree::AnimationTree() {
process_mode = ANIMATION_PROCESS_IDLE;
active = false;
@@ -1204,7 +1204,7 @@ AnimationGraphPlayer::AnimationGraphPlayer() {
started = true;
}
-AnimationGraphPlayer::~AnimationGraphPlayer() {
+AnimationTree::~AnimationTree() {
if (root.is_valid()) {
root->player = NULL;
}
diff --git a/scene/animation/animation_graph_player.h b/scene/animation/animation_tree.h
similarity index 93%
rename from scene/animation/animation_graph_player.h
rename to scene/animation/animation_tree.h
index 8952be75c90..adc25d5607f 100644
--- a/scene/animation/animation_graph_player.h
+++ b/scene/animation/animation_tree.h
@@ -8,7 +8,7 @@
class AnimationNodeBlendTree;
class AnimationPlayer;
-class AnimationGraphPlayer;
+class AnimationTree;
class AnimationNode : public Resource {
GDCLASS(AnimationNode, Resource)
@@ -32,7 +32,7 @@ public:
float process_input(int p_input, float p_time, bool p_seek, float p_blend);
- friend class AnimationGraphPlayer;
+ friend class AnimationTree;
struct AnimationState {
@@ -62,7 +62,7 @@ public:
Vector2 position;
AnimationNode *parent;
- AnimationGraphPlayer *player;
+ AnimationTree *player;
float _blend_node(Ref p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true, float *r_max = NULL);
@@ -85,8 +85,8 @@ protected:
public:
void set_parent(AnimationNode *p_parent);
Ref get_parent() const;
- virtual void set_graph_player(AnimationGraphPlayer *p_player);
- AnimationGraphPlayer *get_graph_player() const;
+ virtual void set_tree(AnimationTree *p_player);
+ AnimationTree *get_tree() const;
AnimationPlayer *get_player() const;
virtual float process(float p_time, bool p_seek);
@@ -125,8 +125,8 @@ public:
AnimationRootNode() {}
};
-class AnimationGraphPlayer : public Node {
- GDCLASS(AnimationGraphPlayer, Node)
+class AnimationTree : public Node {
+ GDCLASS(AnimationTree, Node)
public:
enum AnimationProcessMode {
ANIMATION_PROCESS_PHYSICS,
@@ -258,10 +258,10 @@ public:
String get_invalid_state_reason() const;
uint64_t get_last_process_pass() const;
- AnimationGraphPlayer();
- ~AnimationGraphPlayer();
+ AnimationTree();
+ ~AnimationTree();
};
-VARIANT_ENUM_CAST(AnimationGraphPlayer::AnimationProcessMode)
+VARIANT_ENUM_CAST(AnimationTree::AnimationProcessMode)
#endif // ANIMATION_GRAPH_PLAYER_H
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index e7cde8ddb9b..333e5c8e087 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -66,7 +66,7 @@
#include "scene/animation/animation_blend_space_1d.h"
#include "scene/animation/animation_blend_space_2d.h"
#include "scene/animation/animation_blend_tree.h"
-#include "scene/animation/animation_graph_player.h"
+#include "scene/animation/animation_tree.h"
#include "scene/animation/animation_node_state_machine.h"
#include "scene/animation/animation_player.h"
#include "scene/animation/animation_tree_player.h"
@@ -387,7 +387,7 @@ void register_scene_types() {
ClassDB::register_class();
ClassDB::register_class();
- ClassDB::register_class();
+ ClassDB::register_class();
ClassDB::register_class();
ClassDB::register_class();
ClassDB::register_class();