summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-08-29 14:18:01 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-08-29 14:54:57 +0800
commit385a5b44aa32319bd918c19ec9c8f375444f4802 (patch)
treeb91c8d52a4d835f4831a986c43dc459ae5b1ac2d
parentc08e84af0d52fa9bce1145ba2c22c7452b7d8997 (diff)
Improve documentation for `get_animation()`
-rw-r--r--doc/classes/AnimationLibrary.xml2
-rw-r--r--doc/classes/AnimationPlayer.xml2
-rw-r--r--scene/animation/animation_player.cpp2
-rw-r--r--scene/resources/animation_library.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/doc/classes/AnimationLibrary.xml b/doc/classes/AnimationLibrary.xml
index fbbf9a3be4..75fe393dbb 100644
--- a/doc/classes/AnimationLibrary.xml
+++ b/doc/classes/AnimationLibrary.xml
@@ -22,7 +22,7 @@
<return type="Animation" />
<param index="0" name="name" type="StringName" />
<description>
- Returns the [Animation] with the key [param name], or [code]null[/code] if none is found.
+ Returns the [Animation] with the key [param name]. If the animation does not exist, [code]null[/code] is returned and an error is logged.
</description>
</method>
<method name="get_animation_list" qualifiers="const">
diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml
index d771206cc2..710dc55a4b 100644
--- a/doc/classes/AnimationPlayer.xml
+++ b/doc/classes/AnimationPlayer.xml
@@ -75,7 +75,7 @@
<return type="Animation" />
<param index="0" name="name" type="StringName" />
<description>
- Returns the [Animation] with key [param name] or [code]null[/code] if not found.
+ Returns the [Animation] with the key [param name]. If the animation does not exist, [code]null[/code] is returned and an error is logged.
</description>
</method>
<method name="get_animation_library" qualifiers="const">
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 0e2598cbc7..073f61bfdd 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1501,7 +1501,7 @@ bool AnimationPlayer::has_animation(const StringName &p_name) const {
}
Ref<Animation> AnimationPlayer::get_animation(const StringName &p_name) const {
- ERR_FAIL_COND_V_MSG(!animation_set.has(p_name), Ref<Animation>(), vformat("Animation not found: %s.", p_name));
+ ERR_FAIL_COND_V_MSG(!animation_set.has(p_name), Ref<Animation>(), vformat("Animation not found: \"%s\".", p_name));
const AnimationData &data = animation_set[p_name];
diff --git a/scene/resources/animation_library.cpp b/scene/resources/animation_library.cpp
index 5f725b2fbe..427d418551 100644
--- a/scene/resources/animation_library.cpp
+++ b/scene/resources/animation_library.cpp
@@ -85,7 +85,7 @@ bool AnimationLibrary::has_animation(const StringName &p_name) const {
}
Ref<Animation> AnimationLibrary::get_animation(const StringName &p_name) const {
- ERR_FAIL_COND_V(!animations.has(p_name), Ref<Animation>());
+ ERR_FAIL_COND_V_MSG(!animations.has(p_name), Ref<Animation>(), vformat("Animation not found: \"%s\".", p_name));
return animations[p_name];
}