Godot: AnimationPlayer.GetCurrent* methods fail to run with "Condition ' !playback.current.from ' is true."

Created on 11 Feb 2018  路  13Comments  路  Source: godotengine/godot

Godot version:
master / 68f277477b5a5f3003405e36c6b6853720cb91de

OS/device including version:
_Manjaro Linux 17.1_

Issue description:

While playing an animation with AnimationPlayer, invoking any of the GetCurrent* methods fail with the following message:

ERROR: get_current_animation_position: Condition ' !playback.current.from ' is true. returned: 0
   At: scene/animation/animation_player.cpp:1068.
documentation enhancement junior job core

Most helpful comment

this happens in GDScript as well.

All 13 comments

Is this C# specific issue, or does it happen with GDScript as well?

I can only say that it happens with C# for now, as I haven't used GDScript before.

I might be able to create a GDScript project sometime later, but I wish someone who's already working on a GDScript project could confirm this one.

this happens in GDScript as well.

Still happening in GDScript v3.0.5

tried the following pointless and redundant code in failed effort to prevent error
am simply trying to reset all animations within a grid of dynamically instanced button nodes, each with a child animationplayer node, everything works just cannot rid of the error code

func resetBTN_animations():
var targetBTNs = _chartGrid.get_children()

for i in targetBTNs.size():
    if targetBTNs[i].get_node("anim").current_animation_position > 0:
        targetBTNs[i].get_node("anim").seek(0,true)
        targetBTNs[i].get_node("anim").stop()

I failed to reproduce this as of 8704b77
Calling get_current_animation_length() while the animation is running doesn't show an error.

I will close this, because I don't see how it could be a bug. Code can't be clearer also:

    ERR_FAIL_COND_V(!playback.current.from, 0);
    return playback.current.from->animation->get_length();

I also get this error while the script seems to be working perfectly fine (returns the current animation position in seconds):
Godot 3.0.6 This is the line producing the error:
var current_ani_pos = $AnimationPlayer.current_animation_position

0:00:00:0745 - Condition ' !playback.current.from ' is true. returned: 0

Type:Error
Description:
Time: 0:00:00:0745
C Error: Condition ' !playback.current.from ' is true. returned: 0
C Source: scene\animation\animation_player.cpp:1069
C Function: AnimationPlayer::get_current_animation_position

Should I just ignore it?

Also getting this error with C# in 3.1 stable.
While the error does appear, everything does work perfectly - just a bit annoying to look at in the output menu :(

Getting this with GDScript (red error in console) when using seek(0, true) or anything with seek too, but seek still works

I'm getting this with GDScript while using current_animation_position in an if statement, but I don't see a reason for the error as everything seems to work.

I found a way to get around this. Maybe someone finds it useful in the future:

if current_animation!="":
    print(current_animation_position)
    seek(0)

It won't produce any errors. The reason is obviously: when there was never an animation played, you can't access its position or seek through it.

Very useful @mrimvo - thank you. The idea that it happens when an animation was never played makes sense to me as I could sometimes replicate it and sometimes not. Would be great if this could be re-opened and addressed though.

Well that's what the error message says since the beginning, but @reduz failed to make that more explicit to users here...

Let's reopen and improve the error message.

Was this page helpful?
0 / 5 - 0 ratings