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 529b2b66c6 - Show all commits

View File

@ -124,6 +124,14 @@ 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.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) 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')
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')
class BSBST_UL_brushstroke_objects(bpy.types.UIList): class BSBST_UL_brushstroke_objects(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname): def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
settings = data settings = data
@ -248,18 +256,14 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
style_panel.operator("brushstroke_tools.init_preset", icon='MODIFIER') style_panel.operator("brushstroke_tools.init_preset", icon='MODIFIER')
else: else:
material_header, material_panel = style_panel.panel("brushstrokes_material", default_closed=False) material_header, material_panel = style_panel.panel("brushstrokes_material", default_closed=False)
material_header.label(text='Material') material_header.label(text='Material', icon='MATERIAL')
if material_panel: if material_panel:
material_row = material_panel.row(align=True) material_row = material_panel.row(align=True)
material_row.template_ID(settings, 'context_material') material_row.template_ID(settings, 'context_material')
if settings.context_material: if settings.context_material:
if getattr(settings.context_material, '["BSBST"]', False): if getattr(settings.context_material, '["BSBST"]', False):
material_panel.prop(settings.context_material.node_tree.nodes['Opacity'].outputs[0], 'default_value', text='Opacity') draw_material_settings(material_panel, settings.context_material)
material_panel.prop(settings.context_material.node_tree.nodes['Use Strength'], 'mute', text='Use Brush Strength', invert_checkbox=True)
material_panel.prop(settings.context_material.node_tree.nodes['Color Variation'].inputs[0], 'default_value', text='Color Variation')
material_panel.prop(settings.context_material.node_tree.nodes['Principled BSDF'].inputs[1], 'default_value', text='Metallic')
material_panel.prop(settings.context_material.node_tree.nodes['Principled BSDF'].inputs[2], 'default_value', text='Roughness')
if style_object: if style_object:
for mod in style_object.modifiers: for mod in style_object.modifiers: