summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
authorNathan Franke <natfra@pm.me>2020-10-29 05:01:28 -0500
committerNathan Franke <natfra@pm.me>2021-04-11 23:25:38 -0500
commit2a8c59c171e609d739dcc59d15e3e205dbf47cde (patch)
treec84f0fbf2fc87ce29338f31dc4a86c7bcc0d5253 /scene/animation
parent4a1f2dcb746af43dcebeb241276adfb5d99c1020 (diff)
Use Array for node configuration warnings
Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_tree.cpp30
-rw-r--r--scene/animation/animation_tree.h2
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;