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
2 changed files with 13 additions and 0 deletions
Showing only changes of commit 1b58fb484e - Show all commits

View File

@ -30,6 +30,7 @@ def find_context_brushstrokes(dummy):
bs = settings.context_brushstrokes.add() bs = settings.context_brushstrokes.add()
bs.name = ob.name bs.name = ob.name
bs.method = ob['BSBST_method'] bs.method = ob['BSBST_method']
bs.hide_viewport_base = ob.hide_get()
if name_prev == ob.name: if name_prev == ob.name:
idx = len(settings.context_brushstrokes)-1 idx = len(settings.context_brushstrokes)-1
if not settings.context_brushstrokes: if not settings.context_brushstrokes:
@ -79,6 +80,16 @@ def set_brushstroke_name(self, value):
flow_ob.name = flow_name flow_ob.name = flow_name
flow_ob.data.name = flow_name flow_ob.data.name = flow_name
def get_hide_viewport_base(self):
return self["hide_viewport_base"]
def set_hide_viewport_base(self, value):
self["hide_viewport_base"] = value
ob = bpy.data.objects.get(self.name)
if not ob:
return
ob.hide_set(value)
def get_active_context_brushstrokes_index(self): def get_active_context_brushstrokes_index(self):
if not self.get('active_context_brushstrokes_index'): if not self.get('active_context_brushstrokes_index'):
return 0 return 0
@ -137,6 +148,7 @@ class BSBST_modifier_info(bpy.types.PropertyGroup):
class BSBST_context_brushstrokes(bpy.types.PropertyGroup): class BSBST_context_brushstrokes(bpy.types.PropertyGroup):
name: bpy.props.StringProperty(default='', get=get_brushstroke_name, set=set_brushstroke_name) name: bpy.props.StringProperty(default='', get=get_brushstroke_name, set=set_brushstroke_name)
method: bpy.props.StringProperty(default='') method: bpy.props.StringProperty(default='')
hide_viewport_base: bpy.props.BoolProperty(default=False, get=get_hide_viewport_base, set=set_hide_viewport_base)
class BSBST_Settings(bpy.types.PropertyGroup): class BSBST_Settings(bpy.types.PropertyGroup):
attach_to_active_selection: bpy.props.BoolProperty(default=True) attach_to_active_selection: bpy.props.BoolProperty(default=True)

View File

@ -121,6 +121,7 @@ class BSBST_UL_brushstroke_objects(bpy.types.UIList):
bs_ob = bpy.data.objects.get(item.name) bs_ob = bpy.data.objects.get(item.name)
if not bs_ob: if not bs_ob:
return return
row.prop(context_brushstroke, 'hide_viewport_base', icon_only=True, emboss=False, icon='HIDE_ON' if context_brushstroke.hide_viewport_base else 'HIDE_OFF')
row.prop(bs_ob, 'hide_viewport', icon_only=True, emboss=False) row.prop(bs_ob, 'hide_viewport', icon_only=True, emboss=False)
row.prop(bs_ob, 'hide_render', icon_only=True, emboss=False) row.prop(bs_ob, 'hide_render', icon_only=True, emboss=False)
else: else: