summaryrefslogtreecommitdiffstats
path: root/scene/animation/animation_blend_tree.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-13 12:05:17 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-13 12:05:17 +0200
commitba533f53755f9b247d4c5bb961e7f7da0a6ab0a9 (patch)
treea98024e471f1dec2d7c50acc74216e9ddc371537 /scene/animation/animation_blend_tree.cpp
parent4219af202d091db2ae0f0e30e9ecc348ba29e534 (diff)
parenta262d2d8811a43c906a4cac55b7126ebec7699be (diff)
downloadredot-engine-ba533f53755f9b247d4c5bb961e7f7da0a6ab0a9.tar.gz
Merge pull request #81303 from KoBeWi/the_forbidden_name_of_strings
Add shorthand for using singleton string names
Diffstat (limited to 'scene/animation/animation_blend_tree.cpp')
-rw-r--r--scene/animation/animation_blend_tree.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 1cf235a807..e0b84eb6c7 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -1421,7 +1421,7 @@ AnimationNodeOutput::AnimationNodeOutput() {
void AnimationNodeBlendTree::add_node(const StringName &p_name, Ref<AnimationNode> p_node, const Vector2 &p_position) {
ERR_FAIL_COND(nodes.has(p_name));
ERR_FAIL_COND(p_node.is_null());
- ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output);
+ ERR_FAIL_COND(p_name == SceneStringName(output));
ERR_FAIL_COND(String(p_name).contains("/"));
Node n;
@@ -1491,7 +1491,7 @@ Vector<StringName> AnimationNodeBlendTree::get_node_connection_array(const Strin
void AnimationNodeBlendTree::remove_node(const StringName &p_name) {
ERR_FAIL_COND(!nodes.has(p_name));
- ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output); //can't delete output
+ ERR_FAIL_COND(p_name == SceneStringName(output)); //can't delete output
{
Ref<AnimationNode> node = nodes[p_name].node;
@@ -1520,8 +1520,8 @@ void AnimationNodeBlendTree::remove_node(const StringName &p_name) {
void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringName &p_new_name) {
ERR_FAIL_COND(!nodes.has(p_name));
ERR_FAIL_COND(nodes.has(p_new_name));
- ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output);
- ERR_FAIL_COND(p_new_name == SceneStringNames::get_singleton()->output);
+ ERR_FAIL_COND(p_name == SceneStringName(output));
+ ERR_FAIL_COND(p_new_name == SceneStringName(output));
nodes[p_name].node->disconnect_changed(callable_mp(this, &AnimationNodeBlendTree::_node_changed));
@@ -1546,7 +1546,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN
void AnimationNodeBlendTree::connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) {
ERR_FAIL_COND(!nodes.has(p_output_node));
ERR_FAIL_COND(!nodes.has(p_input_node));
- ERR_FAIL_COND(p_output_node == SceneStringNames::get_singleton()->output);
+ ERR_FAIL_COND(p_output_node == SceneStringName(output));
ERR_FAIL_COND(p_input_node == p_output_node);
Ref<AnimationNode> input = nodes[p_input_node].node;
@@ -1574,7 +1574,7 @@ void AnimationNodeBlendTree::disconnect_node(const StringName &p_node, int p_inp
}
AnimationNodeBlendTree::ConnectionError AnimationNodeBlendTree::can_connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) const {
- if (!nodes.has(p_output_node) || p_output_node == SceneStringNames::get_singleton()->output) {
+ if (!nodes.has(p_output_node) || p_output_node == SceneStringName(output)) {
return CONNECTION_ERROR_NO_OUTPUT;
}
@@ -1627,8 +1627,8 @@ String AnimationNodeBlendTree::get_caption() const {
}
AnimationNode::NodeTimeInfo AnimationNodeBlendTree::_process(const AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only) {
- Ref<AnimationNodeOutput> output = nodes[SceneStringNames::get_singleton()->output].node;
- node_state.connections = nodes[SceneStringNames::get_singleton()->output].connections;
+ Ref<AnimationNodeOutput> output = nodes[SceneStringName(output)].node;
+ node_state.connections = nodes[SceneStringName(output)].connections;
ERR_FAIL_COND_V(output.is_null(), NodeTimeInfo());
AnimationMixer::PlaybackInfo pi = p_playback_info;