godot icon indicating copy to clipboard operation
godot copied to clipboard

`MovieWriter` extension support

Open mobile-bungalow opened this issue 1 year ago • 3 comments
trafficstars

Fixes #96055 , MPR is fixed by this PR.

In setup2 the setup sequence for the MovieWriter runs before any user provided subclasses of MovieWriter can be inserted into the lookup table. We can't instance MovieWriter prior to this point because, to my knowledge, it must be instanced during scene loading. Moving the writer directly after scene gdextension initialization fixes this, but I'm unsure if it's a clean solution or if the writer is selected directly after the render server is initialized for any specific reason.

mobile-bungalow avatar Aug 26 '24 21:08 mobile-bungalow

Moving the writer directly after scene gdextension initialization fixes this, but I'm unsure if it's a clean solution or if the writer is selected directly after the render server is initialized for any specific reason.

Can you explain this problem more?

fire avatar Sep 03 '24 17:09 fire

It's likely the same as in https://github.com/godotengine/godot/pull/91374... Wrong order of things being initialized causes the registration to fail. The change likely fixes this, but it's in main.cpp so it's scary to touch and hard to ensure it doesn't break anything.

RedMser avatar Sep 03 '24 17:09 RedMser

Can you explain this problem more?

Sure. As it stands to use a movie writer you need to instantiate it, then call MovieWriter::add_writer, this inserts it into a static table. The problem is that this static table is searched for the writer before the writer can be initialized. The lowest initialization level where you can construct a MovieWriter is INITIALIZATION_LEVEL_SCENE.

I recognize that touching main is modifying a very hot, and essential code path. I would appreciate any help or alternative directions someone could take this. Other solutions I can think up don't preserve MovieWriter functionality as it was designed, i.e. adding API to allow the user to swap to another MovieWriter at recording time.

mobile-bungalow avatar Sep 03 '24 18:09 mobile-bungalow

All squashed, ready for CI to run.

mobile-bungalow avatar Apr 23 '25 14:04 mobile-bungalow

Thanks! Congratulations on your first merged contribution! 🎉

Repiteo avatar Apr 24 '25 14:04 Repiteo