[Bf-python] Non-blocking OpenGL animation rendering.

Adhi Hargo cadmus.sw at gmail.com
Wed May 29 03:25:36 CEST 2013


Thanks, Campbell. Stopped mucking with threads, timers and whatnot
when I read that. I have two issues that led to a further question:

1. I just realized that passing "INVOKE_DEFAULT" runs the render job
on a separate thread, what I want in the first place. But I
temporarily change some render settings, and it's restored way too
early, even before the render job began. Delaying with time.sleep
doesn't work. I need some way to poll the render.opengl() operator,
anything to delay execution of post-render code.

2. My current solution to get non-blocking render + temporary render
setting is creating a Blender subprocess (using subprocess.Popen) to
render the file. Ugly, but it works. The problem is, user still can't
cancel the render, because though the subprocess itself can be
terminated, its render thread just gets severed from the process and
won't die before render finishes.

Basically I just need to know, is there's some way to communicate with
a running render thread or operator, from Python code?

Thank you in advance for any help. The code I'm working on is here:
http://git.io/O3JqoQ


On 5/27/13, Campbell Barton <ideasman42 at gmail.com> wrote:
> No, there is no way to do this currently.
>
> And running operators from a thread isnt supported (as you already found)
>
> The reason is cycles and blender-internal make a copy of the data and
> operate on it, where as opengl render is just rendering the viewport
> to an offscreen buffer which makes it more tricky to do at the same
> time as the user interacting with the same view -without getting into
> problematic conflicts.

-- 
- Adhi Hargo



More information about the Bf-python mailing list