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 28 additions and 5 deletions
Showing only changes of commit b017796ab0 - Show all commits

View File

@ -124,10 +124,31 @@ def draw_panel_ui_recursive(panel, panel_name, mod, items, display_mode, hide_pa
col.active = not (mod_info.hide_ui or hide_panel)
col.prop(s, 'hide_ui', icon_only=True, icon='UNPINNED' if s.hide_ui else 'PINNED', emboss=False)
def draw_material_settings(layout, material):
layout.prop(material.node_tree.nodes['Opacity'].outputs[0], 'default_value', text='Opacity')
layout.prop(material.node_tree.nodes['Use Strength'], 'mute', text='Use Brush Strength', invert_checkbox=True)
layout.prop(material.node_tree.nodes['Color Variation'].inputs[0], 'default_value', text='Color Variation')
def draw_material_settings(layout, material, surface_object=None):
# draw color options
box = layout.box()
box.prop(material.node_tree.nodes['Color Attribute'], 'mute', text='Use Brush Color', invert_checkbox=True)
if material.node_tree.nodes['Color Attribute'].mute:
row = box.row(align=True)
if material.node_tree.nodes['Color Texture'].mute:
row.prop(material.node_tree.nodes['Color'].outputs[0], 'default_value', text ='')
else:
col = row.column()
col.template_node_inputs(material.node_tree.nodes['Image Texture'])
row.prop(material.node_tree.nodes['Color Texture'], 'mute', icon_only=True, invert_checkbox=True, icon='IMAGE')
if not material.node_tree.nodes['Color Texture'].mute:
if not surface_object:
box.prop(material.node_tree.nodes['UV Map'], 'uv_map', icon='UV')
else:
box.prop_search(material.node_tree.nodes['UV Map'], 'uv_map', surface_object.data, 'uv_layers', icon='UV')
box.prop(material.node_tree.nodes['Color Variation'].inputs[0], 'default_value', text='Color Variation')
# draw opacity options
box = layout.box()
box.prop(material.node_tree.nodes['Use Strength'], 'mute', text='Use Brush Strength', invert_checkbox=True)
box.prop(material.node_tree.nodes['Opacity'].outputs[0], 'default_value', text='Opacity')
# draw BSDF options
layout.prop(material.node_tree.nodes['Principled BSDF'].inputs[1], 'default_value', text='Metallic')
layout.prop(material.node_tree.nodes['Principled BSDF'].inputs[2], 'default_value', text='Roughness')
layout.prop(material.node_tree.nodes['Bump'], 'mute', text='Bump', invert_checkbox=True)
@ -136,12 +157,14 @@ def draw_material_settings(layout, material):
row.active = False
row.prop(material.node_tree.nodes['Bump'].inputs[0], 'default_value', text='Bump Strength')
# draw brush style options
brush_header, brush_panel = layout.panel('brush_panel', default_closed = True)
brush_header.label(text='Brush Style', icon='BRUSHES_ALL')
if brush_panel:
brush_panel.prop(material, 'brush_style', text='', icon='BRUSHES_ALL')
brush_panel.template_node_inputs(material.node_tree.nodes['Brush Curve'])
# draw effects options
effects_header, effects_panel = layout.panel('effects_panel', default_closed = True)
effects_header.label(text='Effects', icon='SHADERFX')
if effects_panel:
@ -321,7 +344,7 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
if settings.context_material:
if getattr(settings.context_material, '["BSBST"]', False):
draw_material_settings(material_panel, settings.context_material)
draw_material_settings(material_panel, settings.context_material, surface_object=surface_object)
elif settings.view_tab == 'MODIFIERS':
if style_object:
for mod in style_object.modifiers: