diff options
Diffstat (limited to 'scene/animation/animation_tree.cpp')
| -rw-r--r-- | scene/animation/animation_tree.cpp | 36 | 
1 files changed, 14 insertions, 22 deletions
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 466536db10..d7d55b468e 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -1288,39 +1288,31 @@ String AnimationTree::get_configuration_warning() const {  	String warning = Node::get_configuration_warning();  	if (!root.is_valid()) { -		if (warning != String()) { +		if (!warning.empty()) {  			warning += "\n\n";  		}  		warning += TTR("No root AnimationNode for the graph is set.");  	}  	if (!has_node(animation_player)) { -		if (warning != String()) { +		if (!warning.empty()) {  			warning += "\n\n";  		} -  		warning += TTR("Path to an AnimationPlayer node containing animations is not set."); -		return warning; -	} - -	AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player)); - -	if (!player) { -		if (warning != String()) { -			warning += "\n\n"; -		} - -		warning += TTR("Path set for AnimationPlayer does not lead to an AnimationPlayer node."); -		return warning; -	} +	} else { +		AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player)); -	if (!player->has_node(player->get_root())) { -		if (warning != String()) { -			warning += "\n\n"; +		if (!player) { +			if (!warning.empty()) { +				warning += "\n\n"; +			} +			warning += TTR("Path set for AnimationPlayer does not lead to an AnimationPlayer node."); +		} else if (!player->has_node(player->get_root())) { +			if (!warning.empty()) { +				warning += "\n\n"; +			} +			warning += TTR("The AnimationPlayer root node is not a valid node.");  		} - -		warning += TTR("The AnimationPlayer root node is not a valid node."); -		return warning;  	}  	return warning;  |