diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d5db1..8815163 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +3.3.0 + +- added: `Move Material To Layer` has now option to copy instead of moving in pop-up menu. + 3.2.0 - added: UI settings to show GP tool settings placement and orientation diff --git a/OP_material_move_to_layer.py b/OP_material_move_to_layer.py index 701c622..03addb1 100644 --- a/OP_material_move_to_layer.py +++ b/OP_material_move_to_layer.py @@ -28,10 +28,14 @@ class GPTB_OT_move_material_to_layer(Operator) : bl_label = 'Move Material To Layer' bl_description = 'Move active material to an existing or new layer' bl_options = {"REGISTER", "UNDO", "INTERNAL"} - layer_name : bpy.props.StringProperty( name='Layer Name', default='', options={'SKIP_SAVE'}) + + copy : bpy.props.BoolProperty( + name='Copy to layer', default=False, + description='Copy strokes to layer instead of moving', + options={'SKIP_SAVE'}) @classmethod def poll(cls, context): @@ -53,7 +57,9 @@ class GPTB_OT_move_material_to_layer(Operator) : def draw(self, context): layout = self.layout # layout.operator_context = "INVOKE_DEFAULT" - layout.label(text=f'Move material "{self.mat_name}" to layer:', icon='MATERIAL') + layout.prop(self, 'copy', text='Copy Strokes') + action_label = 'Copy' if self.copy else 'Move' + layout.label(text=f'{action_label} material "{self.mat_name}" to layer:', icon='MATERIAL') col = layout.column() col.prop(self, 'layer_name', text='', icon='ADD') @@ -66,7 +72,9 @@ class GPTB_OT_move_material_to_layer(Operator) : icon = 'GREASEPENCIL' if l == context.object.data.layers.active else 'BLANK1' row = col.row() row.alignment = 'LEFT' - col.operator('gp.move_material_to_layer', text=l.info, icon=icon, emboss=False).layer_name = l.info + op = col.operator('gp.move_material_to_layer', text=l.info, icon=icon, emboss=False) + op.layer_name = l.info + op.copy = self.copy def execute(self, context): if not self.layer_name: @@ -132,8 +140,9 @@ class GPTB_OT_move_material_to_layer(Operator) : # print('Removing frames') # Dbg ## Remove from source frame (f) - for s in reversed(stroke_to_delete): - f.strokes.remove(s) + if not self.copy: + for s in reversed(stroke_to_delete): + f.strokes.remove(s) ## ? Remove frame if layer is empty ? -> probably not, will show previous frame @@ -148,7 +157,10 @@ class GPTB_OT_move_material_to_layer(Operator) : total += fct report_type = 'INFO' if total else 'WARNING' - self.report({report_type}, f'Moved {total} frames accross {oct} object(s)') + if self.copy: + self.report({report_type}, f'Copied {total} frames accross {oct} object(s)') + else: + self.report({report_type}, f'Moved {total} frames accross {oct} object(s)') return {'FINISHED'} diff --git a/__init__.py b/__init__.py index 7dac113..59b3dbb 100755 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ bl_info = { "name": "GP toolbox", "description": "Tool set for Grease Pencil in animation production", "author": "Samuel Bernou, Christophe Seux", -"version": (3, 2, 0), +"version": (3, 3, 0), "blender": (4, 0, 0), "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "",