Brushstroke Tools: Initial Version #328
@ -126,75 +126,83 @@ 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):
|
||||||
addon_prefs = bpy.context.preferences.addons[__package__].preferences
|
addon_prefs = bpy.context.preferences.addons[__package__].preferences
|
||||||
|
settings = bpy.context.scene.BSBST_settings
|
||||||
|
|
||||||
layout.prop(material, 'diffuse_color', text='Viewport Color')
|
material_row = layout.row(align=True)
|
||||||
# draw color options
|
material_row.template_ID(settings, 'context_material')
|
||||||
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()
|
material_header, material_panel = layout.panel("brushstrokes_material", default_closed=False)
|
||||||
box.prop(n1, 'mute', text='Use Brush Color', invert_checkbox=True)
|
material_header.label(text='Properties', icon='MATERIAL')
|
||||||
if n1.mute:
|
if material_panel:
|
||||||
row = box.row(align=True)
|
|
||||||
if n2.mute:
|
material_panel.prop(material, 'diffuse_color', text='Viewport Color')
|
||||||
row.prop(n3.outputs[0], 'default_value', text ='')
|
# draw color options
|
||||||
else:
|
try:
|
||||||
col = row.column()
|
n1 = material.node_tree.nodes['Color Attribute']
|
||||||
col.template_node_inputs(n4)
|
n2 = material.node_tree.nodes['Color Texture']
|
||||||
row.prop(n2, 'mute', icon_only=True, invert_checkbox=True, icon='IMAGE')
|
n3 = material.node_tree.nodes['Color']
|
||||||
if not n2.mute:
|
n4 = material.node_tree.nodes['Image Texture']
|
||||||
if not surface_object:
|
n5 = material.node_tree.nodes['UV Map']
|
||||||
box.prop(n5, 'uv_map', icon='UV')
|
n6 = material.node_tree.nodes['Color Variation']
|
||||||
|
|
||||||
|
box = material_panel.box()
|
||||||
|
box.prop(n1, 'mute', text='Use Brush Color', invert_checkbox=True)
|
||||||
|
if n1.mute:
|
||||||
|
row = box.row(align=True)
|
||||||
|
if n2.mute:
|
||||||
|
row.prop(n3.outputs[0], 'default_value', text ='')
|
||||||
else:
|
else:
|
||||||
box.prop_search(n5, 'uv_map', surface_object.data, 'uv_layers', icon='UV')
|
col = row.column()
|
||||||
box.prop(n6.inputs[0], 'default_value', text='Color Variation')
|
col.template_node_inputs(n4)
|
||||||
except:
|
row.prop(n2, 'mute', icon_only=True, invert_checkbox=True, icon='IMAGE')
|
||||||
pass
|
if not n2.mute:
|
||||||
|
if not surface_object:
|
||||||
|
box.prop(n5, 'uv_map', icon='UV')
|
||||||
|
else:
|
||||||
|
box.prop_search(n5, 'uv_map', surface_object.data, 'uv_layers', icon='UV')
|
||||||
|
box.prop(n6.inputs[0], 'default_value', text='Color Variation')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# draw opacity options
|
# draw opacity options
|
||||||
try:
|
try:
|
||||||
n1 = material.node_tree.nodes['Use Strength']
|
n1 = material.node_tree.nodes['Use Strength']
|
||||||
n2 = material.node_tree.nodes['Opacity']
|
n2 = material.node_tree.nodes['Opacity']
|
||||||
|
|
||||||
box = layout.box()
|
box = material_panel.box()
|
||||||
box.prop(n1, 'mute', text='Use Brush Strength', invert_checkbox=True)
|
box.prop(n1, 'mute', text='Use Brush Strength', invert_checkbox=True)
|
||||||
box.prop(n2.inputs[0], 'default_value', text='Opacity')
|
box.prop(n2.inputs[0], 'default_value', text='Opacity')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# draw BSDF options
|
# draw BSDF options
|
||||||
try:
|
try:
|
||||||
n1 = material.node_tree.nodes['Principled BSDF']
|
n1 = material.node_tree.nodes['Principled BSDF']
|
||||||
n2 = material.node_tree.nodes['Bump']
|
n2 = material.node_tree.nodes['Bump']
|
||||||
|
|
||||||
box = layout.box()
|
box = material_panel.box()
|
||||||
box.prop(n1.inputs[1], 'default_value', text='Metallic')
|
box.prop(n1.inputs[1], 'default_value', text='Metallic')
|
||||||
box.prop(n1.inputs[2], 'default_value', text='Roughness')
|
box.prop(n1.inputs[2], 'default_value', text='Roughness')
|
||||||
box.prop(n2, 'mute', text='Bump', invert_checkbox=True)
|
box.prop(n2, 'mute', text='Bump', invert_checkbox=True)
|
||||||
row = box.row()
|
row = box.row()
|
||||||
if n2.mute:
|
if n2.mute:
|
||||||
row.active = False
|
row.active = False
|
||||||
row.prop(n2.inputs[0], 'default_value', text='Bump Strength')
|
row.prop(n2.inputs[0], 'default_value', text='Bump Strength')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# draw translucency options
|
# draw translucency options
|
||||||
try:
|
try:
|
||||||
n1 = material.node_tree.nodes['Translucency Add']
|
n1 = material.node_tree.nodes['Translucency Add']
|
||||||
n2 = material.node_tree.nodes['Translucency Strength']
|
n2 = material.node_tree.nodes['Translucency Strength']
|
||||||
n3 = material.node_tree.nodes['Translucency Tint']
|
n3 = material.node_tree.nodes['Translucency Tint']
|
||||||
|
|
||||||
box = layout.box()
|
box = material_panel.box()
|
||||||
box.prop(n1, 'mute', text='Translucency', invert_checkbox=True)
|
box.prop(n1, 'mute', text='Translucency', invert_checkbox=True)
|
||||||
box.prop(n2.inputs[0], 'default_value', text='Translucency Strength')
|
box.prop(n2.inputs[0], 'default_value', text='Translucency Strength')
|
||||||
box.prop(n3.inputs[7], 'default_value', text='Translucency Tint')
|
box.prop(n3.inputs[7], 'default_value', text='Translucency Tint')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# draw brush style options
|
# draw brush style options
|
||||||
try:
|
try:
|
||||||
@ -395,15 +403,9 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
|
|||||||
if not settings.preset_object and is_preset:
|
if not settings.preset_object and is_preset:
|
||||||
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)
|
if settings.context_material:
|
||||||
material_header.label(text='Material', icon='MATERIAL')
|
if getattr(settings.context_material, '["BSBST"]', False):
|
||||||
if material_panel:
|
draw_material_settings(style_panel, settings.context_material, surface_object=surface_object)
|
||||||
material_row = material_panel.row(align=True)
|
|
||||||
material_row.template_ID(settings, 'context_material')
|
|
||||||
|
|
||||||
if settings.context_material:
|
|
||||||
if getattr(settings.context_material, '["BSBST"]', False):
|
|
||||||
draw_material_settings(material_panel, settings.context_material, surface_object=surface_object)
|
|
||||||
elif settings.view_tab == 'SHAPE':
|
elif settings.view_tab == 'SHAPE':
|
||||||
if style_object:
|
if style_object:
|
||||||
for mod in style_object.modifiers:
|
for mod in style_object.modifiers:
|
||||||
|
Loading…
Reference in New Issue
Block a user