3
$\begingroup$

Sorry for the title, I don't know how to better explain my "problem".

In a nutshell: I would like to open from terminal or win prompt a blender file and see it render on the screen the same way it does when you hit f12, I mean seeing the tiles rendering on screen. The result has to be a windowed UV/Image editor with no bars and menus (did it before as you can see i the code below I called it 'viewport') that let you see the progress of rendering.

Here's my terminal command:

blender /path/to/file.blend -S scene_name -W -p 200 200 800 600 -P /path/to/script.py

Here my script.py content:

import bpy

bpy.context.window.screen = bpy.data.screens['viewport'] bpy.ops.render.render(animation=False, write_still=True, use_viewport=True, scene="scene_name")

the -S argument is redundant I think, but this isn't a problem.

I need your help, you pros! :-)

$\endgroup$
  • 1
    $\begingroup$ as a result of the script I made I get a hourglass and the screen locked until the rendering is finished. After that It opens the Blender Window I want in the 'viewport' screen but with no render result at all. $\endgroup$ – tarzanello666 Apr 26 '18 at 23:51
  • $\begingroup$ not able to test it at the moment but did find bpy.ops.render.view_show() Toggle show render view $\endgroup$ – rob Apr 27 '18 at 13:40
  • $\begingroup$ Thanks Rob!Ok, now I know it's a context problem, to solve by using override and I don't know how. $\endgroup$ – tarzanello666 Apr 29 '18 at 15:57
1
$\begingroup$

Ok I manage to solve my problem adding some line to my python script. This is the result:

import bpy
bpy.data.screens['viewport'].scene = bpy.data.scenes['scene']
bpy.context.window.screen = bpy.data.screens['viewport']
bpy.context.screen.scene = bpy.data.scenes['scene']
bpy.ops.render.render('INVOKE_DEFAULT', animation=False, write_still=True, use_viewport=False, scene="scene")

This makes me see the tiles rendering the correct scene and at the end it save the image in the dir specified in the render settings tab.

Now I've come across other issue but this is another story.

Thank you guys!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.