Brushstroke Tools: Initial Version #328

Merged
Simon Thommes merged 229 commits from SimonThommes/blender-studio-tools:brushstroke_tools-initial-version into main 2024-11-06 15:03:47 +01:00
Showing only changes of commit 4f5fd36e23 - Show all commits

View File

@ -295,7 +295,8 @@ class BSBST_OT_delete_brushstrokes(bpy.types.Operator):
flow_object = utils.get_flow_object(bs_ob) flow_object = utils.get_flow_object(bs_ob)
if context.active_object: if context.active_object:
bpy.ops.object.mode_set(mode='OBJECT') if context.mode != 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')
bpy.data.objects.remove(bs_ob) bpy.data.objects.remove(bs_ob)
settings.active_context_brushstrokes_index = max(0, settings.active_context_brushstrokes_index-1) settings.active_context_brushstrokes_index = max(0, settings.active_context_brushstrokes_index-1)
@ -340,10 +341,12 @@ class BSBST_OT_duplicate_brushstrokes(bpy.types.Operator):
flow_object = utils.get_flow_object(bs_ob) flow_object = utils.get_flow_object(bs_ob)
bpy.ops.object.mode_set(mode='OBJECT') if context.mode != 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')
bpy.context.view_layer.objects.active = bs_ob bpy.context.view_layer.objects.active = bs_ob
bpy.ops.object.mode_set(mode='OBJECT') if context.mode != 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')
for ob in bpy.data.objects: for ob in bpy.data.objects:
ob.select_set(False) ob.select_set(False)
bs_ob.select_set(True) bs_ob.select_set(True)
@ -409,7 +412,8 @@ class BSBST_OT_copy_brushstrokes(bpy.types.Operator):
if not bs_objects: if not bs_objects:
return {"CANCELLED"} return {"CANCELLED"}
bpy.ops.object.mode_set(mode='OBJECT') if context.mode != 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')
for surface_object in surface_objects: for surface_object in surface_objects:
for ob in bpy.data.objects: for ob in bpy.data.objects:
ob.select_set(False) ob.select_set(False)