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
3 changed files with 12 additions and 6 deletions
Showing only changes of commit 81d1d461b1 - Show all commits

View File

@ -451,7 +451,6 @@ class BSBST_OT_select_surface(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
def set_brushstrokes_deformable(bs_ob, deformable): def set_brushstrokes_deformable(bs_ob, deformable):
flow_ob = utils.get_flow_object(bs_ob) flow_ob = utils.get_flow_object(bs_ob)
for mod in bs_ob.modifiers: for mod in bs_ob.modifiers:
@ -465,6 +464,8 @@ def set_brushstrokes_deformable(bs_ob, deformable):
mod['Socket_27'] = deformable mod['Socket_27'] = deformable
elif mod.node_group.name == '.brushstroke_tools.surface_draw': elif mod.node_group.name == '.brushstroke_tools.surface_draw':
mod['Socket_15'] = deformable mod['Socket_15'] = deformable
mod.node_group.interface_update(bpy.context)
utils.set_deformable(bs_ob, deformable) utils.set_deformable(bs_ob, deformable)
if not flow_ob: if not flow_ob:
return return
@ -480,7 +481,7 @@ class BSBST_OT_switch_deformable(bpy.types.Operator):
deformable: bpy.props.BoolProperty( default=True, deformable: bpy.props.BoolProperty( default=True,
name="Deformable",) name="Deformable",)
switch_all: bpy.props.BoolProperty( default=True, switch_all: bpy.props.BoolProperty( default=False,
name="All Brushstrokes", name="All Brushstrokes",
description="Switch all Brushstroke Layers of Current Surface Object.") description="Switch all Brushstroke Layers of Current Surface Object.")
@ -501,7 +502,7 @@ class BSBST_OT_switch_deformable(bpy.types.Operator):
return {"CANCELLED"} return {"CANCELLED"}
for ob in bs_objects: for ob in bs_objects:
set_brushstrokes_deformable(ob, self.switch_all) set_brushstrokes_deformable(ob, self.deformable)
context.view_layer.depsgraph.update() context.view_layer.depsgraph.update()

View File

@ -241,11 +241,12 @@ class BSBST_Settings(bpy.types.PropertyGroup):
('BRUSHSTROKES', 'Brushstrokes', 'Specify the style of the currently active brushstrokes', 'BRUSH_DATA', 1), ('BRUSHSTROKES', 'Brushstrokes', 'Specify the style of the currently active brushstrokes', 'BRUSH_DATA', 1),
('AUTO', 'Auto', 'Specify the style of either the active brushstrokes or the preset depending on the context', 'AUTO', 2), ('AUTO', 'Auto', 'Specify the style of either the active brushstrokes or the preset depending on the context', 'AUTO', 2),
]) ])
view_tab: bpy.props.EnumProperty(default='MODIFIERS', view_tab: bpy.props.EnumProperty(default='SHAPE',
name='Context', name='Context',
items= [ items= [
('MODIFIERS', 'Modifiers', 'View Modifiers Settings', 'MODIFIER', 0), ('SHAPE', 'Shape', 'View Modifiers Settings', 'MODIFIER', 0),
('MATERIAL', 'Material', 'View Material Settings', 'MATERIAL', 1), ('MATERIAL', 'Material', 'View Material Settings', 'MATERIAL', 1),
('SETTINGS', 'Settings', 'View Additional Settings', 'PREFERENCES', 2),
]) ])
try: try:

View File

@ -348,7 +348,7 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
if settings.context_material: if settings.context_material:
if getattr(settings.context_material, '["BSBST"]', False): if getattr(settings.context_material, '["BSBST"]', False):
draw_material_settings(material_panel, settings.context_material, surface_object=surface_object) draw_material_settings(material_panel, settings.context_material, surface_object=surface_object)
elif settings.view_tab == 'MODIFIERS': elif settings.view_tab == 'SHAPE':
if style_object: if style_object:
for mod in style_object.modifiers: for mod in style_object.modifiers:
mod_info = mod.id_data.modifier_info.get(mod.name) mod_info = mod.id_data.modifier_info.get(mod.name)
@ -394,6 +394,10 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
# expose add modifier operator for preset context # expose add modifier operator for preset context
if is_preset: if is_preset:
style_panel.operator('brushstroke_tools.preset_add_mod', icon='ADD') style_panel.operator('brushstroke_tools.preset_add_mod', icon='ADD')
elif settings.view_tab == 'SETTINGS':
deform = utils.get_deformable(style_object)
op = style_panel.operator('brushstroke_tools.switch_deformable', text='Deforming Surface', depress=deform, icon='MOD_SIMPLEDEFORM')
op.deformable = not deform
class BSBST_MT_PIE_brushstroke_data_marking(bpy.types.Menu): class BSBST_MT_PIE_brushstroke_data_marking(bpy.types.Menu):
bl_idname= "BSBST_MT_PIE_brushstroke_data_marking" bl_idname= "BSBST_MT_PIE_brushstroke_data_marking"