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 8b562e0a79 - Show all commits

View File

@ -79,6 +79,23 @@ def set_brushstroke_name(self, value):
return return
def get_active_context_brushstrokes_index(self):
return self["active_context_brushstrokes_index"]
def set_active_context_brushstrokes_index(self, value):
prev = self.get('active_context_brushstrokes_index')
self["active_context_brushstrokes_index"] = value
if prev == value:
return
bpy.ops.object.mode_set(mode='OBJECT')
bs_ob = bpy.data.objects.get(self.context_brushstrokes[value].name)
if not bs_ob:
return
bpy.context.view_layer.objects.active = bs_ob
for ob in bpy.data.objects:
ob.select_set(False)
bs_ob.select_set(True)
class BSBST_link_context_setting(bpy.types.PropertyGroup): class BSBST_link_context_setting(bpy.types.PropertyGroup):
name: bpy.props.StringProperty(default='') name: bpy.props.StringProperty(default='')
link_context: bpy.props.BoolProperty(default=False, name='Link to Context') link_context: bpy.props.BoolProperty(default=False, name='Link to Context')
@ -126,7 +143,10 @@ class BSBST_Settings(bpy.types.PropertyGroup):
('CURVES', 'Curves', 'Use hair curves (Full Support)', 'CURVES_DATA', 1), ('CURVES', 'Curves', 'Use hair curves (Full Support)', 'CURVES_DATA', 1),
]) ])
context_brushstrokes: bpy.props.CollectionProperty(type=BSBST_context_brushstrokes) context_brushstrokes: bpy.props.CollectionProperty(type=BSBST_context_brushstrokes)
active_context_brushstrokes_index: bpy.props.IntProperty(default = 0, update=update_active_brushstrokes) active_context_brushstrokes_index: bpy.props.IntProperty( default = 0,
update=update_active_brushstrokes,
get=get_active_context_brushstrokes_index,
set=set_active_context_brushstrokes_index)
classes = [ classes = [
BSBST_link_context_setting, BSBST_link_context_setting,