I am working on a plugin in which I want to step through the timeline and render each frame, capturing the render output in a custom RenderHandler class in order to “do something special” with it before saving.
I see no way to use a custom RenderHandler class when using the RenderManager, so it seems I need to (and I have code that does) set up render options, find the renderer, instantiate my custom render handler, and step the scene from frame to frame calling the renderer with the desired camera, options, and render handler.
The problem I am stuck on is collision/smoothing. When I advance the frame (dzScene->setTime(..)) there are typically some clothing items that need to be collided/smoothed with the figures they are fit to. If I just advance the frame and call the render, this does not happen (and/or does not happen “soon enough”) and the output from the render is pre-collision e.g. with pokethrough that the collision processing does eliminate.
A couple of seconds after the render progress dialog starts showing progress on a given frame, the viewport updates to show the clothing correctly. It seems that I need to invoke and/or wait out the collision cycles before (?) invoking the render. I’ve tried yielding and/or sleeping and/or checking DzBackgroundProgress::isActive() between advancing the time and invoking Render->render(...) but had no impact on the problem.
Does anyone know what I can do in a plugin to invoke and/or wait out the collision / smoothing cycle for e.g. clothing after advancing the current time in the scene?
And/or have any example of using a custom RenderHandler?