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 c736ac8e12 - Show all commits

View File

@ -42,7 +42,9 @@ def find_context_brushstrokes(dummy):
if context.object: if context.object:
for i, bs in enumerate(settings.context_brushstrokes): for i, bs in enumerate(settings.context_brushstrokes):
if bs.name == context.object.name: if bs.name == context.object.name:
settings.silent_switch = True
settings.active_context_brushstrokes_index = i settings.active_context_brushstrokes_index = i
settings.silent_switch = False
elif len_prev == len(settings.context_brushstrokes): elif len_prev == len(settings.context_brushstrokes):
settings.active_context_brushstrokes_index = idx settings.active_context_brushstrokes_index = idx
@ -143,10 +145,12 @@ def set_active_context_brushstrokes_index(self, value):
if 'BSBST_material' in settings.preset_object.keys(): if 'BSBST_material' in settings.preset_object.keys():
settings.context_material = settings.preset_object['BSBST_material'] settings.context_material = settings.preset_object['BSBST_material']
prev = self.get('active_context_brushstrokes_index') prev = self.get('active_context_brushstrokes_index')
self["active_context_brushstrokes_index"] = value if prev == abs(value):
if prev == value:
return return
self["active_context_brushstrokes_index"] = abs(value)
bs_ob = bpy.data.objects.get(self.context_brushstrokes[value].name) bs_ob = bpy.data.objects.get(self.context_brushstrokes[value].name)
if settings.silent_switch:
return
if not bs_ob: if not bs_ob:
return return
view_layer = bpy.context.view_layer view_layer = bpy.context.view_layer
@ -276,6 +280,8 @@ class BSBST_Settings(bpy.types.PropertyGroup):
name='Estimate Dimensions', name='Estimate Dimensions',
description="Estimate the length, width and distribution density of the brush strokes based on the bounding box to provide a reasonable starting point regardless of scale") description="Estimate the length, width and distribution density of the brush strokes based on the bounding box to provide a reasonable starting point regardless of scale")
silent_switch: bpy.props.BoolProperty(default=False)
classes = [ classes = [
BSBST_socket_info, BSBST_socket_info,
BSBST_modifier_info, BSBST_modifier_info,