Posted: Sat Oct 24, 2009 7:59 pm
Joined: 24 Jul 2007
Posts: 9
Greetings,
I've just gotten started playing around with controlling rendering via python, and starting to dig into the python API. I'm writing a program in java that wraps blender command line calls to render a scene, tweaking specifics via a python script i pass as an argument.
I would like the ability to cancel the render programatically. I know in the GUI I can just hit Esc, but how to do this with code? Can it be done via python? My original attempt was via the Java process destroy method, but that wasn't stopping the render process (blender is launching children processes so the java handle is for a dead parent?...)
I'm new to python so I hope you'll forgive my ignorance, but the difficulty as I see it now is any script I pass to blender is executed immediately, whereas if I want to signal a render cancel, I would need some sort of hook, or mechanism to signal the running blender process to quit the render? I have no idea how to do that, or perhaps I'm hitting this from the wrong angle...
Any help appreciated!
Posted: Mon Nov 02, 2009 3:48 am
Joined: 07 Aug 2009
Posts: 10
| samuraidanieru wrote: |
Greetings,
I've just gotten started playing around with controlling rendering via python, and starting to dig into the python API. I'm writing a program in java that wraps blender command line calls to render a scene, tweaking specifics via a python script i pass as an argument.
I would like the ability to cancel the render programatically. I know in the GUI I can just hit Esc, but how to do this with code? Can it be done via python? My original attempt was via the Java process destroy method, but that wasn't stopping the render process (blender is launching children processes so the java handle is for a dead parent?...)
I'm new to python so I hope you'll forgive my ignorance, but the difficulty as I see it now is any script I pass to blender is executed immediately, whereas if I want to signal a render cancel, I would need some sort of hook, or mechanism to signal the running blender process to quit the render? I have no idea how to do that, or perhaps I'm hitting this from the wrong angle...
Any help appreciated! |
I am also trying to integrate Blender as my render pipeline. I think your request can be solved by call a method of some of those classes, such as Blender, Scene, etc. Which you can find their method by Python API reference.
Sorry i cann't tell that function directly, I am a novice in blender, too.
Posted: Thu Nov 05, 2009 9:02 pm
Joined: 24 Jul 2007
Posts: 9
thanks for the reply jackystock.
yep, I looked in the same direction; the Render.RenderData class has several different methods for manipulating the render, including the actual method to start the render, aptly named 'render()'. I didn't however find anything to cancel a render job...maybe I'm looking in the wrong place. But even if I did find it, the question is as near as I can tell:
Is it possible for an external process to call blender python methods during blender runtime?
Of course I can pass all the commands to be executed immediately upon startup via the command line, but what about during? This is what I have no idea about how to do. It seems like the blender process would need to provide some mechanism for the external process to call the methods. I know that when using the GUI, you can invoke python methods during runtime, but I imagine that's all handled by internal events. Maybe someone involved in blender dev could comment on this?
Posted: Fri Nov 06, 2009 3:59 pm
Joined: 13 Jun 2009
Posts: 3
| samuraidanieru wrote: |
thanks for the reply jackystock.
yep, I looked in the same direction; the Render.RenderData class has several different methods for manipulating the render, including the actual method to start the render, aptly named 'render()'. I didn't however find anything to cancel a render job...maybe I'm looking in the wrong place. But even if I did find it, the question is as near as I can tell:
Is it possible for an external process to call blender python methods during blender runtime?
Of course I can pass all the commands to be executed immediately upon startup via the command line, but what about during? This is what I have no idea about how to do. It seems like the blender process would need to provide some mechanism for the external process to call the methods. I know that when using the GUI, you can invoke python methods during runtime, but I imagine that's all handled by internal events. Maybe someone involved in blender dev could comment on this? |
Hi, because the keyboard shortcuts will be scriptable, that means that there must be a call for the Esc button, ie) you must be able to assign it to a different key. So when that it is implemeted you could look to see which call it makes.
Im sorry that that doesnt give you the answer that you want straight away.
Posted: Fri Nov 06, 2009 9:19 pm
Joined: 24 Jul 2007
Posts: 9
hi mandoragon,
that's a possible approach i hadn't thought about. I wonder if the 'framework' for keyboard events (for lack of a better title) is 'on' and listening if I start blender from the command line without the GUI? hmmm... also you mentioned, when it's implemented: I haven't looked, but this is not current functionality but will be in the future? possibly 2.5?