How to make multiple movie recordings - await end of play?

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?

Just split it in 2 function or use the signal.

Example1:

  • Function play_animation first call
  • Function continue_animation called by other node

Example2:

  • Signal animation_continue emit when animation is end(by node/editor)
  • Example code in Function:
    var editor = EditorInterface
    editor.movie_maker_enabled = true
    await animation_continue
    editor.movie_maker_enabled = false
    

Then the problem is How to emit the signal/call the function.

  • While loop detecting, you have used that.
  • Some RPC from instance to the editor, such as edit the scene and add a Node for that.
  • You can also add some code as Singleton loaded by editor when running to detect that if the animation is done, notice that you can use signals in scene, then output when the signal is emited.