Fix Animation Editor erroring when animating SpriteAnimation3D frame but not animation.#113786
Conversation
| if (!animation_name.is_empty()) { | ||
| texture = sf->get_frame_texture(animation_name, frame); | ||
| } |
There was a problem hiding this comment.
| if (!animation_name.is_empty()) { | |
| texture = sf->get_frame_texture(animation_name, frame); | |
| } | |
| if (!animation_name.is_empty()) { | |
| texture = sf->get_frame_texture(animation_name, frame); | |
| } else { | |
| WARN_PRINT_ONCE("SpriteFrames: " + String(sf) + " animation can't be determined since it is changed depend on the runtime state."); | |
| } |
There was a problem hiding this comment.
Instead of printing, it should be shown somewhere in the editor (like a warning icon next to the track), but it's not worth it.
Note that WARN_PRINT_ONCE is literally printed once. Users would end up with some random warnings with vague explanation (the message does not really indicate that the warning comes from the editor).
|
I don't think adding a warning is useful. If no preview is available, falling back to generic key icon is fine. tbh I was not even aware that AnimationPlayer has such elaborate logic for AnimatedSprite previews. Why would you even need that if AnimatedSprite has built-in animation capabilities? 🤷♂️ |
|
The AnimatedSprite having two playback methods is a feature that's been in place for a long time (3.0 or older?), and this preview has existed since then. However since it's at least only an Editor-side process and doesn't affect runtime, so I think it's not a bad thing to keep it. |
|
Thanks! Congratulations on your first merged contribution! 🎉 |
|
Cherry-picked for 4.5.2. |
frame but not animation.
…_animation_check_if_animation_key_exists Fix Animation Editor erroring when animating SpriteAnimation3D 'frame' but not 'animation'.
Fixes 113715
The animation editor no longer directly accesses the 'animation' track for AnimatedSprite2D&3D and instead checks if it first exists and if any key value was found.
Previously this would generate errors in the editor.
With the changes the editor remains responsive in the following two cases, when previously it would generate errors.
[TokageItLab comment] recommended two items.
Finally this is my first merge request here - learning along the way :)