preview gen in autobuild

1.3.1

- added: preview generation in autobuild
main
pullusb 2023-04-04 11:41:18 +02:00
parent c58654a7e1
commit b19f9d9473
4 changed files with 20 additions and 7 deletions

View File

@ -14,6 +14,10 @@ Activate / deactivate layer opacity according to prefix
Activate / deactivate all masks using MA layers
-->
1.3.1
- added: preview generation in autobuild
1.3.0
- added: Preview with a combined alpha over of all render layer available

View File

@ -4,7 +4,7 @@ from pathlib import Path
from . import gen_vlayer, fn
def batch_setup_render_scene(context=None, render_scn=None):
def batch_setup_render_scene(context=None, render_scn=None, preview=True):
'''A series of setup actions for Render scene:
- renumber fileout
- Clean compo Tree
@ -111,6 +111,8 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
\n- Swap to bg cam'
)
add_preview : bpy.props.BoolProperty(name='Add Preview', default=True,
description='Create preview with stacked alpha over on render layers')
def invoke(self, context, event):
# return self.execute(context)
@ -138,6 +140,7 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
col.prop(self, 'group_all_adjacent_layer_type')
col.prop(self, 'change_to_gp_workspace')
col.prop(self, 'batch_setup_render_scene')
col.prop(self, 'add_preview')
# layout.prop(self, 'clear_unused_view_layers')
@ -267,6 +270,12 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
## Batch setup render scene
batch_setup_render_scene(render_scn=render_scn)
## create preview
if self.add_preview:
from .OP_merge_layers import merge_compositor_preview
merge_compositor_preview(scene=render_scn)
## No need for timer anymore !
# if batch_setup_render_scene:
# if self.timer > 0:

View File

@ -115,14 +115,14 @@ def merge_layers(rlayers, obname=None, active=None, disconnect=True, color=None)
return ng, out
def merge_compositor_preview(context=None, clear=False):
def merge_compositor_preview(scene=None, clear=False):
'''Merge all active render layer with alpha over.location[0]+450, ng.location[1]+50), width=600)
Create a dedicated node group and connect to compositor output
return tuple(merge nodegroup, compositor out)
'''
context = context or bpy.context
node_tree = context.scene.node_tree
scene = scene or bpy.context.scene
node_tree = scene.node_tree
nodes = node_tree.nodes
links = node_tree.links
@ -224,7 +224,7 @@ def merge_compositor_preview(context=None, clear=False):
composite_out.use_alpha = True
links.new(ng.outputs[0], composite_out.inputs[0])
im_settings = context.scene.render.image_settings
im_settings = scene.render.image_settings
# im_settings.file_format = 'JPEG'
# im_settings.color_mode = 'RGB'
# im_settings.quality = 0
@ -279,7 +279,7 @@ class GPEXP_OT_merge_preview_ouput(bpy.types.Operator):
clear : bpy.props.BoolProperty(default=False, options={'SKIP_SAVE'})
def execute(self, context):
merge_compositor_preview(context=context, clear=self.clear)
merge_compositor_preview(scene=context.scene, clear=self.clear)
return {"FINISHED"}
class GPEXP_OT_auto_merge_adjacent_prefix(bpy.types.Operator):

View File

@ -2,7 +2,7 @@ bl_info = {
"name": "GP Render",
"description": "Organise export of gp layers through compositor output",
"author": "Samuel Bernou",
"version": (1, 3, 0),
"version": (1, 3, 1),
"blender": (2, 93, 0),
"location": "View3D",
"warning": "",