Brushstroke Tools: Initial Version #328
@ -225,6 +225,7 @@ class BSBST_OT_delete_brushstrokes(bpy.types.Operator):
|
||||
active_bs = settings.context_brushstrokes[settings.active_context_brushstrokes_index]
|
||||
bs_ob = bpy.data.objects.get(active_bs.name)
|
||||
if not bs_ob:
|
||||
settings.edit_toggle = edit_toggle
|
||||
return {"CANCELLED"}
|
||||
|
||||
flow_object = utils.get_flow_object(bs_ob)
|
||||
@ -234,6 +235,7 @@ class BSBST_OT_delete_brushstrokes(bpy.types.Operator):
|
||||
settings.active_context_brushstrokes_index = max(0, settings.active_context_brushstrokes_index-1)
|
||||
|
||||
if not flow_object:
|
||||
settings.edit_toggle = edit_toggle
|
||||
return {"FINISHED"}
|
||||
|
||||
# delete controller objects
|
||||
|
@ -6,6 +6,9 @@ from bpy.app.handlers import persistent
|
||||
def find_context_brushstrokes(dummy):
|
||||
context = bpy.context
|
||||
settings = context.scene.BSBST_settings
|
||||
|
||||
edit_toggle = settings.edit_toggle
|
||||
settings.edit_toggle = False
|
||||
len_prev = len(settings.context_brushstrokes)
|
||||
name_prev = settings.context_brushstrokes[settings.active_context_brushstrokes_index].name if len_prev else ''
|
||||
idx = settings.active_context_brushstrokes_index
|
||||
@ -34,6 +37,7 @@ def find_context_brushstrokes(dummy):
|
||||
if name_prev == ob.name:
|
||||
idx = len(settings.context_brushstrokes)-1
|
||||
SimonThommes marked this conversation as resolved
Outdated
|
||||
if not settings.context_brushstrokes:
|
||||
settings.edit_toggle = edit_toggle
|
||||
return
|
||||
if context.object:
|
||||
for i, bs in enumerate(settings.context_brushstrokes):
|
||||
@ -43,6 +47,7 @@ def find_context_brushstrokes(dummy):
|
||||
settings.active_context_brushstrokes_index = idx
|
||||
|
||||
settings.active_context_brushstrokes_index = max(min(settings.active_context_brushstrokes_index, len(settings.context_brushstrokes)-1), 0)
|
||||
settings.edit_toggle = edit_toggle
|
||||
|
||||
def update_active_brushstrokes(self, context):
|
||||
settings = context.scene.BSBST_settings
|
||||
|
Loading…
Reference in New Issue
Block a user
Generally, the code would be easier to read if line lengths were more limited. E.g. for Blender we have a 120 line length limit. That also makes it easier to have two files open next to each other. Such limits can be enforced automatically with auto-formatters like
autopep8
(what we currently use in Blender) or e.g.black
.