Godot Version
v4.3.stable.official [77dcf97d8]
Question
I’m looking to record a series of animations using MovieMaker mode. My script will load a scene and play the animation fine. But I need to wait until that animation has completed before launching the next one or it will cancel the first partway done.
My problem is that I don’t know how to recognize when the first animation is complete. I launch it with play_current_scene(), but I don’t know how to wait until it’s done. If I try to busy-wait for is_playing_scene() to go false, the await doesn’t seem to trigger the calling await when done. I wonder if using the editor’s scene root tree is the wrong way to wait – is there a scene-free-friendly way to wait? Or is busy-wait looping with await not supported?
var editor = EditorInterface
var root = editor.get_edited_scene_root()
editor.movie_maker_enabled = true
editor.play_current_scene()
while editor.is_playing_scene():
await root.get_tree().create_timer(0.5).timeout
editor.movie_maker_enabled = false
To be honest, I’d love to await
a signal from the EditorInterface indicating that the playing animation has completed, but I see nothing like that. e.g.
var editor = EditorInterface
editor.movie_maker_enabled = true
await editor.play_current_scene_until_done()
editor.movie_maker_enabled = false
Suggestions?