Page 2 of 4
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 7:50 pm
by Sharlybg
This what i've done BYOB :
Code: Select all
if LuxCoreDisplaySettings.paused:
if not engine.session.IsInPause():
engine.session.Pause()
utils_render.update_status_msg(stats, engine, depsgraph.scene, config, time_until_film_refresh=0)
engine.framebuffer.draw(engine, engine.session, depsgraph.scene, render_stopped=False)
engine.update_stats("", "Paused")
engine.session.GetFilm().SaveOutputs()
else:
if engine.session.IsInPause():
engine.session.Resume()
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 8:00 pm
by Sharlybg
the code display isn't respect indentation but it is roughly the change
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 8:00 pm
by CodeHD
after the line "import os", add the following command:
this will show you the directory where the file is saved in the Blender system console.
EDIT: for me on windows this is:
C:\Program Files\Blender Foundation\blender-2.81a-windows64
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 8:09 pm
by CodeHD
I've tested this, but Lux doesn't write an exr, only png, even when I set the output file type in the scene tab to exr
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 8:26 pm
by CodeHD
here you go, this works for me:
Code: Select all
if LuxCoreDisplaySettings.paused:
if not engine.session.IsInPause():
engine.session.Pause()
utils_render.update_status_msg(stats, engine, depsgraph.scene, config, time_until_film_refresh=0)
engine.framebuffer.draw(engine, engine.session, depsgraph.scene, render_stopped=False)
engine.update_stats("", "Paused")
import os
from datetime import datetime
from ..bin import pyluxcore
dummypath = os.getcwd()
dummyfile = os.path.join(dummypath, '{}.exr'.format(datetime.now().strftime('%Y-%m-%d-%H-%M-%S')))
engine.session.GetFilm().SaveOutput(dummyfile, pyluxcore.FilmOutputType.RGB_IMAGEPIPELINE, pyluxcore.Properties())
else:
if engine.session.IsInPause():
engine.session.Resume()
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 8:27 pm
by B.Y.O.B.
CodeHD wrote: ↑Mon Apr 06, 2020 8:00 pm
EDIT: for me on windows this is:
C:\Program Files\Blender Foundation\blender-2.81a-windows64
My bad, I had started Blender from the BlendLuxCore project directory on Linux, which is why the CWD (current working directory) was there for me.
Saving outputs does not work on Windows on my end because it tries to write to a directory where you need admin write permissions (i.e. the Blender installation folder).
So either you have to change the CWD before saving the outputs, or use the function Dade mentioned, which accepts a filepath (but you need to know the output type and/or name, I think).
Here's code that's more into the direction of what you want (probably):
Code: Select all
import os
from datetime import datetime
os.chdir(r"D:\my_renders")
current_dir = os.getcwd()
print("The files are in", current_dir)
engine.session.GetFilm().SaveOutputs()
date_string = datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
for filename in os.listdir(current_dir):
basename, extension = os.path.splitext(filename)
if extension.lower() in {"png", "exr"}:
os.rename(filename, basename + "_" + date_string + extension)
edit: if you want the imagepipeline outputs to be exr instead of png, you can remove "RGB_IMAGEPIPELINE" and "RGBA_IMAGEPIPELINE" here:
https://github.com/LuxCoreRender/BlendL ... ovs.py#L11
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 8:46 pm
by CodeHD
Here is another updated option, which uses the output directory in the scene tab. Lots of code to choose from now
Only problem I observe here is that the filename extension you write overrides the file format setting made below. You might want to get the setting consistent and check if it outputs what you expect. I.e., BYOB was right here:
B.Y.O.B. wrote: ↑Mon Apr 06, 2020 8:27 pm
... or use the function Dade mentioned, which accepts a filepath (but you need to know the output type and/or name, I think).
Code: Select all
if LuxCoreDisplaySettings.paused:
if not engine.session.IsInPause():
engine.session.Pause()
utils_render.update_status_msg(stats, engine, depsgraph.scene, config, time_until_film_refresh=0)
engine.framebuffer.draw(engine, engine.session, depsgraph.scene, render_stopped=False)
engine.update_stats("", "Paused")
import os
from datetime import datetime
from ..bin import pyluxcore
import bpy
dummyfile = bpy.context.scene.render.filepath
dummyfile = bpy.path.abspath(dummyfile)
dummyext = dummyfile.split('.')[-1]
dummyfile = os.path.join(os.path.dirname(dummyfile), '{}'.format(datetime.now().strftime('%Y-%m-%d-%H-%M-%S')) +'.'+dummyext )
engine.session.GetFilm().SaveOutput(dummyfile, pyluxcore.FilmOutputType.RGB_IMAGEPIPELINE, pyluxcore.Properties())
else:
if engine.session.IsInPause():
engine.session.Resume()
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 9:41 pm
by Sharlybg
Can you share your python file. I mean the modified ( "" final.py""")
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 9:49 pm
by CodeHD
Sure
Re: BlendLuxCore: Save image while render is paused
Posted: Mon Apr 06, 2020 10:16 pm
by Sharlybg
CodeHD wrote: ↑Mon Apr 06, 2020 9:49 pmSure
Woahou it work
just need to reupload the file ""exr"" so i get all the color management stuff applied. It just need now an automatic ""EXR"" reload and save as a specified (jpg/png) extension to be user friendly. Sorry if i'm a bit bothering you. just want to include that in the light group tutorial. It make it so usefull and perfect
Thanks already for that.