Brushstroke Tools: Initial Version #328
@ -272,6 +272,43 @@ class BSBST_OT_delete_brushstrokes(bpy.types.Operator):
|
|||||||
settings.edit_toggle = edit_toggle
|
settings.edit_toggle = edit_toggle
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
class BSBST_OT_duplicate_brushstrokes(bpy.types.Operator):
|
||||||
|
"""
|
||||||
|
Duplicate the active context brushstrokes
|
||||||
|
"""
|
||||||
|
bl_idname = "brushstroke_tools.duplicate_brushstrokes"
|
||||||
|
bl_label = "Duplicate Brushstrokes"
|
||||||
|
bl_description = "Duplicate the active context brushstrokes"
|
||||||
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
settings = context.scene.BSBST_settings
|
||||||
|
return bool(settings.context_brushstrokes)
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
settings = context.scene.BSBST_settings
|
||||||
|
|
||||||
|
bs_ob = utils.get_active_context_brushstrokes_object(context)
|
||||||
|
if not bs_ob:
|
||||||
|
settings.edit_toggle = edit_toggle
|
||||||
|
return {"CANCELLED"}
|
||||||
|
|
||||||
|
flow_object = utils.get_flow_object(bs_ob)
|
||||||
|
|
||||||
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
|
|
||||||
|
bpy.context.view_layer.objects.active = bs_ob
|
||||||
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
|
for ob in bpy.data.objects:
|
||||||
|
ob.select_set(False)
|
||||||
|
bs_ob.select_set(True)
|
||||||
|
if flow_object and not settings.reuse_flow:
|
||||||
|
flow_object.select_set(True)
|
||||||
|
bpy.ops.object.duplicate_move()
|
||||||
|
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
class BSBST_OT_select_surface(bpy.types.Operator):
|
class BSBST_OT_select_surface(bpy.types.Operator):
|
||||||
"""
|
"""
|
||||||
Select the surface object for the active context brushstrokes.
|
Select the surface object for the active context brushstrokes.
|
||||||
@ -612,6 +649,7 @@ classes = [
|
|||||||
BSBST_OT_new_brushstrokes,
|
BSBST_OT_new_brushstrokes,
|
||||||
BSBST_OT_edit_brushstrokes,
|
BSBST_OT_edit_brushstrokes,
|
||||||
BSBST_OT_delete_brushstrokes,
|
BSBST_OT_delete_brushstrokes,
|
||||||
|
BSBST_OT_duplicate_brushstrokes,
|
||||||
BSBST_OT_select_surface,
|
BSBST_OT_select_surface,
|
||||||
BSBST_OT_init_preset,
|
BSBST_OT_init_preset,
|
||||||
BSBST_OT_make_preset,
|
BSBST_OT_make_preset,
|
||||||
|
@ -262,7 +262,7 @@ class BSBST_Settings(bpy.types.PropertyGroup):
|
|||||||
description="Show advanced UI options to customize exposed parameters")
|
description="Show advanced UI options to customize exposed parameters")
|
||||||
reuse_flow: bpy.props.BoolProperty(default=False,
|
reuse_flow: bpy.props.BoolProperty(default=False,
|
||||||
name='Re-use Flow Object',
|
name='Re-use Flow Object',
|
||||||
description="Re-use flow object from active brushstrokes if applicable")
|
description="Re-use flow object from active brushstrokes when creating new brushstrokes")
|
||||||
edit_toggle: bpy.props.BoolProperty(default=True,
|
edit_toggle: bpy.props.BoolProperty(default=True,
|
||||||
name='Edit Active Brushstrokes',
|
name='Edit Active Brushstrokes',
|
||||||
description="Jump into the corresponding edit mode when selecting/creating a brushstrokes layer")
|
description="Jump into the corresponding edit mode when selecting/creating a brushstrokes layer")
|
||||||
|
@ -278,9 +278,10 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
|
|||||||
if not is_preset and len(settings.context_brushstrokes)>0:
|
if not is_preset and len(settings.context_brushstrokes)>0:
|
||||||
row = style_panel.row()
|
row = style_panel.row()
|
||||||
row.template_list("BSBST_UL_brushstroke_objects", "", settings, "context_brushstrokes",
|
row.template_list("BSBST_UL_brushstroke_objects", "", settings, "context_brushstrokes",
|
||||||
settings, "active_context_brushstrokes_index", rows=1, maxrows=5, sort_lock=True)
|
settings, "active_context_brushstrokes_index", rows=3, maxrows=5, sort_lock=True)
|
||||||
column = row.column(align=True)
|
column = row.column(align=True)
|
||||||
column.operator('brushstroke_tools.delete_brushstrokes', text='', icon='TRASH')
|
column.operator('brushstroke_tools.delete_brushstrokes', text='', icon='TRASH')
|
||||||
|
column.operator('brushstroke_tools.duplicate_brushstrokes', text='', icon='DUPLICATE')
|
||||||
|
|
||||||
row = style_panel.row()
|
row = style_panel.row()
|
||||||
row_edit = row.row(align=True)
|
row_edit = row.row(align=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user