diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-12 09:40:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-12 09:40:55 +0200 |
commit | cee5414698b14be3ce837b4c9de3a3d500d28611 (patch) | |
tree | c6ef3961655e03dc601ac826f28206844876e1cb /scene/animation | |
parent | 184abce1928e694bc884537cf0d5ef42333ba10d (diff) | |
parent | 2a8c59c171e609d739dcc59d15e3e205dbf47cde (diff) |
Merge pull request #43180 from nathanfranke/node-configuration-array
Use Array for node configuration warnings
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_tree.cpp | 30 | ||||
-rw-r--r-- | scene/animation/animation_tree.h | 2 |
2 files changed, 10 insertions, 22 deletions
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 4b4d3943c9..44f2d38a84 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -458,7 +458,7 @@ void AnimationTree::set_tree_root(const Ref<AnimationNode> &p_root) { properties_dirty = true; - update_configuration_warning(); + update_configuration_warnings(); } Ref<AnimationNode> AnimationTree::get_tree_root() const { @@ -1262,7 +1262,7 @@ void AnimationTree::_notification(int p_what) { void AnimationTree::set_animation_player(const NodePath &p_player) { animation_player = p_player; - update_configuration_warning(); + update_configuration_warnings(); } NodePath AnimationTree::get_animation_player() const { @@ -1281,38 +1281,26 @@ uint64_t AnimationTree::get_last_process_pass() const { return process_pass; } -String AnimationTree::get_configuration_warning() const { - String warning = Node::get_configuration_warning(); +TypedArray<String> AnimationTree::get_configuration_warnings() const { + TypedArray<String> warnings = Node::get_configuration_warnings(); if (!root.is_valid()) { - if (!warning.is_empty()) { - warning += "\n\n"; - } - warning += TTR("No root AnimationNode for the graph is set."); + warnings.push_back(TTR("No root AnimationNode for the graph is set.")); } if (!has_node(animation_player)) { - if (!warning.is_empty()) { - warning += "\n\n"; - } - warning += TTR("Path to an AnimationPlayer node containing animations is not set."); + warnings.push_back(TTR("Path to an AnimationPlayer node containing animations is not set.")); } else { AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player)); if (!player) { - if (!warning.is_empty()) { - warning += "\n\n"; - } - warning += TTR("Path set for AnimationPlayer does not lead to an AnimationPlayer node."); + warnings.push_back(TTR("Path set for AnimationPlayer does not lead to an AnimationPlayer node.")); } else if (!player->has_node(player->get_root())) { - if (!warning.is_empty()) { - warning += "\n\n"; - } - warning += TTR("The AnimationPlayer root node is not a valid node."); + warnings.push_back(TTR("The AnimationPlayer root node is not a valid node.")); } } - return warning; + return warnings; } void AnimationTree::set_root_motion_track(const NodePath &p_track) { diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 1c5aec26ab..700ff1cb5b 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -300,7 +300,7 @@ public: void set_animation_player(const NodePath &p_player); NodePath get_animation_player() const; - virtual String get_configuration_warning() const override; + TypedArray<String> get_configuration_warnings() const override; bool is_state_invalid() const; String get_invalid_state_reason() const; |