From b19f9d947336438194b2695b2fd74dd3ea9ac28c Mon Sep 17 00:00:00 2001 From: pullusb Date: Tue, 4 Apr 2023 11:41:18 +0200 Subject: [PATCH] preview gen in autobuild 1.3.1 - added: preview generation in autobuild --- CHANGELOG.md | 4 ++++ OP_auto_build.py | 11 ++++++++++- OP_merge_layers.py | 10 +++++----- __init__.py | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f03a9e..d049097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/OP_auto_build.py b/OP_auto_build.py index 7220a4f..e7110e3 100644 --- a/OP_auto_build.py +++ b/OP_auto_build.py @@ -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: diff --git a/OP_merge_layers.py b/OP_merge_layers.py index 7ed4d3e..7c60bd5 100644 --- a/OP_merge_layers.py +++ b/OP_merge_layers.py @@ -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): diff --git a/__init__.py b/__init__.py index f21e445..2e9a8a4 100644 --- a/__init__.py +++ b/__init__.py @@ -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": "",