diff --git a/doc/classes/AnimationLibrary.xml b/doc/classes/AnimationLibrary.xml index fbbf9a3be42..75fe393dbbe 100644 --- a/doc/classes/AnimationLibrary.xml +++ b/doc/classes/AnimationLibrary.xml @@ -22,7 +22,7 @@ - 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. diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index d771206cc2d..710dc55a4b3 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -75,7 +75,7 @@ - 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. diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 0e2598cbc7c..073f61bfdd2 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 AnimationPlayer::get_animation(const StringName &p_name) const { - ERR_FAIL_COND_V_MSG(!animation_set.has(p_name), Ref(), vformat("Animation not found: %s.", p_name)); + ERR_FAIL_COND_V_MSG(!animation_set.has(p_name), Ref(), 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 5f725b2fbe8..427d4185515 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 AnimationLibrary::get_animation(const StringName &p_name) const { - ERR_FAIL_COND_V(!animations.has(p_name), Ref()); + ERR_FAIL_COND_V_MSG(!animations.has(p_name), Ref(), vformat("Animation not found: \"%s\".", p_name)); return animations[p_name]; }