Fix multiscene ops and batch script generation

0.6.0:

- feat: button to generate a background rendering script to batch multi-scene
- fix: exposed checkbox to change scene AA settings, should be on except if there are NG_merges. (auto-off when using merge nodes buttons)
- fix: default generated scene have native AA
- fix: adding layers from object in other scene use active scene (stop always rerouting to 'Render' scene)
This commit is contained in:
Pullusb
2021-10-25 16:02:11 +02:00
parent d3871dcc88
commit 7b79542c6a
9 changed files with 224 additions and 78 deletions
+15 -10
View File
@@ -44,7 +44,7 @@ class GPEXP_OT_add_layer_to_render(bpy.types.Operator):
return {"FINISHED"}
def export_gp_objects(oblist, exclude_list=[]):
def export_gp_objects(oblist, exclude_list=[], scene=None):
# Skip layer containing element in excluyde list
if not isinstance(oblist, list):
oblist = [oblist]
@@ -54,10 +54,10 @@ def export_gp_objects(oblist, exclude_list=[]):
# if l.hide:
# continue
if l.hide or any(x + '_' in l.info for x in exclude_list): # exclude hided ?
l.viewlayer_render = fn.get_view_layer('exclude').name # assign "exclude"
l.viewlayer_render = fn.get_view_layer('exclude', scene=scene).name # assign "exclude"
continue
_vl, _cp = gen_vlayer.get_set_viewlayer_from_gp(ob, l) # scene=fn.get_render_scene())
_vl, _cp = gen_vlayer.get_set_viewlayer_from_gp(ob, l, scene=scene) # scene=fn.get_render_scene())
## send operator with mode ALL or SELECTED to batch build
@@ -75,17 +75,22 @@ class GPEXP_OT_add_objects_to_render(bpy.types.Operator):
def execute(self, context):
# create render scene
fn.get_render_scene()
if context.scene.name == 'Scene':
scn = fn.get_render_scene()
else:
scn = context.scene
excludes = [] # ['MA', 'IN'] # Get list dynamically
if self.mode == 'SELECTED':
export_gp_objects([o for o in context.selected_objects if o.type == 'GPENCIL'], exclude_list=excludes) # excludes
export_gp_objects([o for o in context.selected_objects if o.type == 'GPENCIL'], exclude_list=excludes, scene=scn)
elif self.mode == 'ALL':
scn = bpy.data.scenes.get('Scene')
if not scn:
self.report({'ERROR'}, 'Could not found default scene')
return {"CANCELLED"}
export_gp_objects([o for o in scn.objects if o.type == 'GPENCIL' and not o.hide_get()], exclude_list=excludes) # excludes
# scn = bpy.data.scenes.get('Scene')
# if not scn:
# self.report({'ERROR'}, 'Could not found default scene')
# return {"CANCELLED"}
export_gp_objects([o for o in scn.objects if o.type == 'GPENCIL' and not o.hide_get()], exclude_list=excludes, scene=scn)
return {"FINISHED"}