Brushstroke Tools: Initial Version #328
@ -127,56 +127,95 @@ def draw_panel_ui_recursive(panel, panel_name, mod, items, display_mode, hide_pa
|
|||||||
def draw_material_settings(layout, material, surface_object=None):
|
def draw_material_settings(layout, material, surface_object=None):
|
||||||
layout.prop(material, 'diffuse_color', text='Viewport Color')
|
layout.prop(material, 'diffuse_color', text='Viewport Color')
|
||||||
# draw color options
|
# draw color options
|
||||||
|
try:
|
||||||
|
n1 = material.node_tree.nodes['Color Attribute']
|
||||||
|
n2 = material.node_tree.nodes['Color Texture']
|
||||||
|
n3 = material.node_tree.nodes['Color']
|
||||||
|
n4 = material.node_tree.nodes['Image Texture']
|
||||||
|
n5 = material.node_tree.nodes['UV Map']
|
||||||
|
n6 = material.node_tree.nodes['Color Variation']
|
||||||
|
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
box.prop(material.node_tree.nodes['Color Attribute'], 'mute', text='Use Brush Color', invert_checkbox=True)
|
box.prop(n1, 'mute', text='Use Brush Color', invert_checkbox=True)
|
||||||
if material.node_tree.nodes['Color Attribute'].mute:
|
if n1.mute:
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
if material.node_tree.nodes['Color Texture'].mute:
|
if n2.mute:
|
||||||
row.prop(material.node_tree.nodes['Color'].outputs[0], 'default_value', text ='')
|
row.prop(n3.outputs[0], 'default_value', text ='')
|
||||||
else:
|
else:
|
||||||
col = row.column()
|
col = row.column()
|
||||||
col.template_node_inputs(material.node_tree.nodes['Image Texture'])
|
col.template_node_inputs(n4)
|
||||||
row.prop(material.node_tree.nodes['Color Texture'], 'mute', icon_only=True, invert_checkbox=True, icon='IMAGE')
|
row.prop(n2, 'mute', icon_only=True, invert_checkbox=True, icon='IMAGE')
|
||||||
if not material.node_tree.nodes['Color Texture'].mute:
|
if not n2.mute:
|
||||||
if not surface_object:
|
if not surface_object:
|
||||||
box.prop(material.node_tree.nodes['UV Map'], 'uv_map', icon='UV')
|
box.prop(n5, 'uv_map', icon='UV')
|
||||||
else:
|
else:
|
||||||
box.prop_search(material.node_tree.nodes['UV Map'], 'uv_map', surface_object.data, 'uv_layers', icon='UV')
|
box.prop_search(n5, 'uv_map', surface_object.data, 'uv_layers', icon='UV')
|
||||||
box.prop(material.node_tree.nodes['Color Variation'].inputs[0], 'default_value', text='Color Variation')
|
box.prop(n6.inputs[0], 'default_value', text='Color Variation')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# draw opacity options
|
# draw opacity options
|
||||||
|
try:
|
||||||
|
n1 = material.node_tree.nodes['Use Strength']
|
||||||
|
n2 = material.node_tree.nodes['Opacity']
|
||||||
|
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
box.prop(material.node_tree.nodes['Use Strength'], 'mute', text='Use Brush Strength', invert_checkbox=True)
|
box.prop(n1, 'mute', text='Use Brush Strength', invert_checkbox=True)
|
||||||
box.prop(material.node_tree.nodes['Opacity'].inputs[0], 'default_value', text='Opacity')
|
box.prop(n2.inputs[0], 'default_value', text='Opacity')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# draw BSDF options
|
# draw BSDF options
|
||||||
|
try:
|
||||||
|
n1 = material.node_tree.nodes['Principled BSDF']
|
||||||
|
n2 = material.node_tree.nodes['Bump']
|
||||||
|
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
box.prop(material.node_tree.nodes['Principled BSDF'].inputs[1], 'default_value', text='Metallic')
|
box.prop(n1.inputs[1], 'default_value', text='Metallic')
|
||||||
box.prop(material.node_tree.nodes['Principled BSDF'].inputs[2], 'default_value', text='Roughness')
|
box.prop(n1.inputs[2], 'default_value', text='Roughness')
|
||||||
box.prop(material.node_tree.nodes['Bump'], 'mute', text='Bump', invert_checkbox=True)
|
box.prop(n2, 'mute', text='Bump', invert_checkbox=True)
|
||||||
row = box.row()
|
row = box.row()
|
||||||
if material.node_tree.nodes['Bump'].mute:
|
if n2.mute:
|
||||||
row.active = False
|
row.active = False
|
||||||
row.prop(material.node_tree.nodes['Bump'].inputs[0], 'default_value', text='Bump Strength')
|
row.prop(n2.inputs[0], 'default_value', text='Bump Strength')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# draw translucency options
|
# draw translucency options
|
||||||
|
try:
|
||||||
|
n1 = material.node_tree.nodes['Translucency Add']
|
||||||
|
n2 = material.node_tree.nodes['Translucency Strength']
|
||||||
|
n3 = material.node_tree.nodes['Translucency Tint']
|
||||||
|
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
box.prop(material.node_tree.nodes['Translucency Add'], 'mute', text='Translucency', invert_checkbox=True)
|
box.prop(n1, 'mute', text='Translucency', invert_checkbox=True)
|
||||||
box.prop(material.node_tree.nodes['Translucency Strength'].inputs[0], 'default_value', text='Translucency Strength')
|
box.prop(n2.inputs[0], 'default_value', text='Translucency Strength')
|
||||||
box.prop(material.node_tree.nodes['Translucency Tint'].inputs[7], 'default_value', text='Translucency Tint')
|
box.prop(n3.inputs[7], 'default_value', text='Translucency Tint')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# draw brush style options
|
# draw brush style options
|
||||||
|
try:
|
||||||
|
n1 = material.node_tree.nodes['Brush Curve']
|
||||||
|
|
||||||
brush_header, brush_panel = layout.panel('brush_panel', default_closed = True)
|
brush_header, brush_panel = layout.panel('brush_panel', default_closed = True)
|
||||||
brush_header.label(text='Brush Style', icon='BRUSHES_ALL')
|
brush_header.label(text='Brush Style', icon='BRUSHES_ALL')
|
||||||
if brush_panel:
|
if brush_panel:
|
||||||
brush_panel.prop(material, 'brush_style', text='', icon='BRUSHES_ALL')
|
brush_panel.prop(material, 'brush_style', text='', icon='BRUSHES_ALL')
|
||||||
brush_panel.template_node_inputs(material.node_tree.nodes['Brush Curve'])
|
brush_panel.template_node_inputs(n1)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# draw effects options
|
# draw effects options
|
||||||
|
try:
|
||||||
|
n1 = material.node_tree.nodes['Effects In']
|
||||||
|
|
||||||
effects_header, effects_panel = layout.panel('effects_panel', default_closed = True)
|
effects_header, effects_panel = layout.panel('effects_panel', default_closed = True)
|
||||||
effects_header.label(text='Effects', icon='SHADERFX')
|
effects_header.label(text='Effects', icon='SHADERFX')
|
||||||
if effects_panel:
|
if effects_panel:
|
||||||
draw_effect_panel_recursive(effects_panel, material, material.node_tree.nodes['Effects In'])
|
draw_effect_panel_recursive(effects_panel, material, n1)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def draw_effect_panel_recursive(effects_panel, material, prev_node):
|
def draw_effect_panel_recursive(effects_panel, material, prev_node):
|
||||||
if not prev_node:
|
if not prev_node:
|
||||||
|
Loading…
Reference in New Issue
Block a user