Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewport Render Animation breaks {serial} tag #7

Closed
Alumx opened this issue Jul 1, 2023 · 3 comments
Closed

Viewport Render Animation breaks {serial} tag #7

Alumx opened this issue Jul 1, 2023 · 3 comments
Labels
blocked Unable to address due to external limitations

Comments

@Alumx
Copy link

Alumx commented Jul 1, 2023

If you set Output to "//Output\test {serial}/" and render Viewport Animation, it'll fail to create a folder with appropriate number
image

Also Is it possible to auto-save viewport renders too?

@jeinselen
Copy link
Owner

Hey @Alumx!

Blender does not invoke the render_init and render_complete handlers when rendering the viewport. Short answer; from what I can tell, it's simply not possible to write a plugin that works natively with the render.opengl operator, only the render.render operator.

However, there may be some workarounds.

  1. Custom script

If you manually sequence the existing plugin functions with a python call to the render.opengl operator, it should behave enough like the Blender handler system to work. Blender will freeze during the entire operation, just like when triggering a standard render from the Python API. You'd also need to set up a script for each of the three viewport rendering options (image, animation, and keyframes).

import bpy
import VF_autosaveRender

VF_autosaveRender.autosave_render_start(bpy.context.scene)
bpy.ops.render.opengl(animation=True)
VF_autosaveRender.autosave_render(bpy.context.scene)
  1. Use Proxy Render

If you're only capturing camera viewpoints and just need a quick Workbench render shortcut, VF-BlenderProxyRender might do the trick. It uses the standard rendering system in Blender, but temporarily sets the engine to Workbench along with a few other settings, and works correctly with other plugins like VR_autosaveRender that depend on event handlers. As mentioned above, the Blender interface will freeze while rendering, but generally it's pretty fast (so long as your Workbench settings aren't crazy).

@jeinselen jeinselen added the blocked Unable to address due to external limitations label Jul 3, 2023
@jeinselen
Copy link
Owner

As of Blender 2.7.3, the autosave_render function has been renamed to autosave_render_end for better clarity.

Updated script to render a viewport image:

import bpy
import VF_autosaveRender

VF_autosaveRender.autosave_render_start(bpy.context.scene)
bpy.ops.render.opengl()
VF_autosaveRender.autosave_render_end(bpy.context.scene)

To render an animation: bpy.ops.render.opengl(animation=True)
To render keyframes: bpy.ops.render.opengl(animation=True, render_keyed_only=True)

Triggering a render from Python will freeze Blender as it waits for the operation to complete; the Python API is not thread-safe and I haven't found a way around this limitation.

@jeinselen
Copy link
Owner

Closing: Blender API limitation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Unable to address due to external limitations
Projects
None yet
Development

No branches or pull requests

2 participants