summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-12-10 08:56:31 +0100
committerGitHub <noreply@github.com>2021-12-10 08:56:31 +0100
commitbdf8340e5993ec3f86e4bf1d5ede48df7d023a12 (patch)
tree1e366583662397e366d4f84bb334660db37cb5bd /scene/animation
parent5ad9d8bad69309d71ea55f3d799af7e3711dc262 (diff)
parent49403cbfa0399bb4284ea5c36cc90216a0bda6ff (diff)
Merge pull request #43181 from nathanfranke/string-empty
Replace String comparisons with "", String() to is_empty()
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_blend_tree.cpp2
-rw-r--r--scene/animation/animation_node_state_machine.cpp2
-rw-r--r--scene/animation/animation_player.cpp2
-rw-r--r--scene/animation/animation_tree.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index d6c5d0b51c..8f644face5 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -57,7 +57,7 @@ void AnimationNodeAnimation::_validate_property(PropertyInfo &property) const {
}
anims += String(names[i]);
}
- if (anims != String()) {
+ if (!anims.is_empty()) {
property.hint = PROPERTY_HINT_ENUM;
property.hint_string = anims;
}
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index c8fa8bf395..31a1d4d64c 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -52,7 +52,7 @@ void AnimationNodeStateMachineTransition::set_advance_condition(const StringName
String cs = p_condition;
ERR_FAIL_COND(cs.find("/") != -1 || cs.find(":") != -1);
advance_condition = p_condition;
- if (cs != String()) {
+ if (!cs.is_empty()) {
advance_condition_name = "conditions/" + cs;
} else {
advance_condition_name = StringName();
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index b9435b6692..d603106696 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1416,7 +1416,7 @@ bool AnimationPlayer::is_playing() const {
}
void AnimationPlayer::set_current_animation(const String &p_anim) {
- if (p_anim == "[stop]" || p_anim == "") {
+ if (p_anim == "[stop]" || p_anim.is_empty()) {
stop();
} else if (!is_playing() || playback.assigned != p_anim) {
play(p_anim);
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 57c615a6ab..527946b9de 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -138,7 +138,7 @@ real_t AnimationNode::_pre_process(const StringName &p_base_path, AnimationNode
void AnimationNode::make_invalid(const String &p_reason) {
ERR_FAIL_COND(!state);
state->valid = false;
- if (state->invalid_reasons != String()) {
+ if (!state->invalid_reasons.is_empty()) {
state->invalid_reasons += "\n";
}
state->invalid_reasons += String::utf8("• ") + p_reason;