diff --git a/CHANGELOG.md b/CHANGELOG.md index 0663442..d08ce76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/OP_merge_layers.py b/OP_merge_layers.py index 52628e2..8f61b57 100644 --- a/OP_merge_layers.py +++ b/OP_merge_layers.py @@ -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') diff --git a/__init__.py b/__init__.py index 311f6ec..380f83e 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, 3), + "version": (1, 3, 4), "blender": (2, 93, 0), "location": "View3D", "warning": "", diff --git a/app_templates/GP_Render/startup.blend b/app_templates/GP_Render/startup.blend index ce86047..042b184 100644 Binary files a/app_templates/GP_Render/startup.blend and b/app_templates/GP_Render/startup.blend differ diff --git a/fn.py b/fn.py index e7a42c3..217ec14 100644 --- a/fn.py +++ b/fn.py @@ -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: diff --git a/ui.py b/ui.py index 10ec309..b612fc0 100644 --- a/ui.py +++ b/ui.py @@ -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')