BlendLuxCore: Save image while render is paused

Discussion related to the LuxCore functionality, implementations and API.
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

BlendLuxCore: Save image while render is paused

Post by Sharlybg »

BYOB please can you help me ? I want to know if blender api allow to save a render while being in pause ?
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. »

Blender API probably not, but LuxCore allows it.
However, it will lack Blender's color management (filmic etc.) and compositing.
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: BlendLuxCore Development

Post by Sharlybg »

B.Y.O.B. wrote: Mon Apr 06, 2020 6:32 pm Blender API probably not, but LuxCore allows it.
However, it will lack Blender's color management (filmic etc.) and compositing.
You mean image will be saved as Exr. So we can just reload them automatically and save to jpg so they get the ajustment applied.

But anyway step by step. Can we have the first stage of save while rendering.
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. »

Sharlybg wrote: Mon Apr 06, 2020 6:50 pm But anyway step by step. Can we have the first stage of save while rendering.
After this line, you can insert

Code: Select all

engine.session.GetFilm().SaveOutputs()
This will save the outputs to your BlendLuxCore installation directory every time you pause the render.
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: BlendLuxCore: Save image while render is paused

Post by Sharlybg »

Thank you so much :D

What if i want it to be the blendfile folder to be the automatic output ? :mrgreen:

I hope the file will not be rewrite each time i hit pause. So i can keep each image file.
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore: Save image while render is paused

Post by B.Y.O.B. »

Sharlybg wrote: Mon Apr 06, 2020 7:13 pm What if i want it to be the blendfile folder to be the automatic output ?
I'm not sure if the LuxCore API offers a way to pass a filepath to SaveOutputs(), this is a question for Dade.
Sharlybg wrote: Mon Apr 06, 2020 7:13 pm I hope the file will not be rewrite each time i hit pause. So i can keep each image file.
You have to rename the images or move them somewhere else if you want to prevent them from being overwritten.
User avatar
alpistinho
Developer
Developer
Posts: 198
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: BlendLuxCore: Save image while render is paused

Post by alpistinho »

You have to rename the images or move them somewhere else if you want to prevent them from being overwritten.
I guess you could probably do something like:

Code: Select all

import os
from datetime import datetime
os.rename('a.exr', '{}.exr'.format(datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
Just change a.exr to the name Luxcore saves the file.
You may also want to put the absolute path instead of the relative
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: BlendLuxCore: Save image while render is paused

Post by Dade »

B.Y.O.B. wrote: Mon Apr 06, 2020 7:23 pm
Sharlybg wrote: Mon Apr 06, 2020 7:13 pm What if i want it to be the blendfile folder to be the automatic output ?
I'm not sure if the LuxCore API offers a way to pass a filepath to SaveOutputs(), this is a question for Dade.
There is the "SaveOutput()" for that but Alpistinho's solution is simpler.
Support LuxCoreRender project with salts and bounties
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: BlendLuxCore: Save image while render is paused

Post by Sharlybg »

The first code line by BYOB seem to not give me any result. there is no file saved and i have to search in all folder as i don't know wich exact folder get the file. but a quick search "exr" inside addon folder show nothing.

Alpistinho can you upload you're working modified final.py file so i can overwritte mine and be sure instruction are the same ?

I'm a bit overhelming.
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
alpistinho
Developer
Developer
Posts: 198
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: BlendLuxCore: Save image while render is paused

Post by alpistinho »

Sharlybg wrote: Mon Apr 06, 2020 7:45 pm The first code line by BYOB seem to not give me any result. there is no file saved and i have to search in all folder as i don't know wich exact folder get the file. but a quick search "exr" inside addon folder show nothing.

Alpistinho can you upload you're working modified final.py file so i can overwritte mine and be sure instruction are the same ?

I'm a bit overhelming.
I hadn't even seen the code before, but I came up with that:

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")
                
                # Our crappy patch here 
                engine.session.GetFilm().SaveOutputs()
                import os
		from datetime import datetime
		os.rename('a.exr', '{}.exr'.format(datetime.now().strftime('%Y-%m-%d-%H-%M-%S')))            
Support LuxCoreRender project with salts and bounties
Post Reply