tweak startup, add multi layer merge

1.3.4

- added: multi object merge
- changed: little tweak on GP render startup
main
pullusb 2023-06-07 17:31:38 +02:00
parent 04d6349d1c
commit bc5a046bec
6 changed files with 23 additions and 6 deletions

View File

@ -14,6 +14,11 @@ Activate / deactivate layer opacity according to prefix
Activate / deactivate all masks using MA layers
-->
1.3.4
- added: multi object merge
- changed: little tweak on GP render startup
1.3.3
- fixed: problem evaluating broken modifier target

View File

@ -247,11 +247,17 @@ class GPEXP_OT_merge_viewlayers_to_active(bpy.types.Operator):
def poll(cls, context):
return context.object and context.object.type == 'GPENCIL'
multi_object_merge : bpy.props.BoolProperty(default=False, options={'SKIP_SAVE'})
def execute(self, context):
ob = bpy.context.object
# layers = [l for l in ob.data.layers if l.select and not l.hide]
ob = context.object
act = ob.data.layers.active
layers = [l for l in ob.data.layers if l.select and l != act]
if self.multi_object_merge:
layers = [l for ob in context.selected_objects if ob.type == 'GPENCIL' for l in ob.data.layers if l.select and l != act]
else:
layers = [l for l in ob.data.layers if l.select and l != act]
## Tested in func
# rd_scn = bpy.data.scenes.get('Render')

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, 3),
"version": (1, 3, 4),
"blender": (2, 93, 0),
"location": "View3D",
"warning": "",

5
fn.py
View File

@ -413,7 +413,10 @@ def get_frames_bbox(node_tree):
## -- nodes helper functions
def merge_gplayer_viewlayers(ob, act=None, layers=None):
def merge_gplayer_viewlayers(ob=None, act=None, layers=None):
'''ob is not needed if active and layers are passed'''
if ob is None:
ob = bpy.context.object
if act is None:
act = ob.data.layers.active
if layers is None:

5
ui.py
View File

@ -206,7 +206,10 @@ class GPEXP_PT_gp_dopesheet_ui(Panel):
ct = len([l for l in context.object.data.layers if l.select])
txt = f'Merge {ct} layers'
# merge layers from dopesheet
row.operator('gp.merge_viewlayers_to_active', text=txt, icon='SELECT_EXTEND')
row.operator('gp.merge_viewlayers_to_active', text=txt, icon='SELECT_EXTEND').multi_object_merge = True
ct = len([l for ob in context.selected_objects if ob.type == 'GPENCIL' for l in ob.data.layers if l.select])
txt = f'Multi: {ct} layers'
row.operator('gp.merge_viewlayers_to_active', text=txt, icon='SELECT_EXTEND').multi_object_merge = True
row.enabled= ct > 1
col.operator('gpexp.auto_merge_adjacent_prefix', icon='SELECT_EXTEND')