Brushstroke Tools: Initial Version #328
@ -248,6 +248,36 @@ class BSBST_OT_delete_brushstrokes(bpy.types.Operator):
|
||||
settings.edit_toggle = edit_toggle
|
||||
return {'FINISHED'}
|
||||
|
||||
class BSBST_OT_select_surface(bpy.types.Operator):
|
||||
"""
|
||||
Select the surface object for the active context brushstrokes.
|
||||
"""
|
||||
bl_idname = "brushstroke_tools.select_surface"
|
||||
bl_label = "Select Surface"
|
||||
bl_description = "Select the surface object for 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):
|
||||
bs_ob = utils.get_active_context_brushstrokes_object(context)
|
||||
if not bs_ob:
|
||||
return {"CANCELLED"}
|
||||
surface_object = getattr(bs_ob, '["BSBST_surface_object"]', None)
|
||||
if not surface_object:
|
||||
return {"CANCELLED"}
|
||||
|
||||
bpy.context.view_layer.objects.active = surface_object
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
for ob in bpy.data.objects:
|
||||
ob.select_set(False)
|
||||
surface_object.select_set(True)
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
class BSBST_OT_init_preset(bpy.types.Operator):
|
||||
"""
|
||||
Initialize the preset to define a modifier stack applied to new brushstrokess.
|
||||
@ -535,6 +565,7 @@ classes = [
|
||||
BSBST_OT_new_brushstrokes,
|
||||
BSBST_OT_edit_brushstrokes,
|
||||
BSBST_OT_delete_brushstrokes,
|
||||
BSBST_OT_select_surface,
|
||||
BSBST_OT_init_preset,
|
||||
BSBST_OT_make_preset,
|
||||
BSBST_OT_preset_add_mod,
|
||||
|
@ -225,6 +225,7 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
|
||||
if not is_preset and len(settings.context_brushstrokes)>0:
|
||||
row = style_panel.row()
|
||||
row_edit = row.row(align=True)
|
||||
row_edit.operator('brushstroke_tools.select_surface', icon='OUTLINER_OB_SURFACE', text='')
|
||||
row_edit.operator('brushstroke_tools.edit_brushstrokes', icon='GREASEPENCIL')
|
||||
row_edit.prop(settings, 'edit_toggle', icon='RESTRICT_SELECT_OFF' if settings.edit_toggle else 'RESTRICT_SELECT_ON', icon_only=True)
|
||||
row.operator('brushstroke_tools.delete_brushstrokes', text='', icon='TRASH')
|
||||
|
Loading…
Reference in New Issue
Block a user