Add Copy material to layer
3.3.0 - added: `Move Material To Layer` has now option to copy instead of moving in pop-up menu.gpv2 v3.3.0
parent
19e26f8cee
commit
c02b890915
|
@ -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
|
||||
|
|
|
@ -29,10 +29,14 @@ class GPTB_OT_move_material_to_layer(Operator) :
|
|||
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):
|
||||
return context.object and context.object.type == 'GPENCIL'
|
||||
|
@ -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,6 +140,7 @@ class GPTB_OT_move_material_to_layer(Operator) :
|
|||
|
||||
# print('Removing frames') # Dbg
|
||||
## Remove from source frame (f)
|
||||
if not self.copy:
|
||||
for s in reversed(stroke_to_delete):
|
||||
f.strokes.remove(s)
|
||||
|
||||
|
@ -148,6 +157,9 @@ class GPTB_OT_move_material_to_layer(Operator) :
|
|||
total += fct
|
||||
|
||||
report_type = 'INFO' if total else 'WARNING'
|
||||
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'}
|
||||
|
||||
|
|
|
@ -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": "",
|
||||
|
|
Loading…
Reference in New Issue