Brushstroke Tools: Initial Version #328
Binary file not shown.
@ -166,6 +166,25 @@ def set_active_context_brushstrokes_index(self, value):
|
||||
if 'BSBST_material' in bs_ob.keys():
|
||||
settings.context_material = bs_ob['BSBST_material']
|
||||
|
||||
def get_brush_style(self):
|
||||
name = self.node_tree.nodes['Brush Style'].node_tree.name
|
||||
return '.'.join(name.split('.')[1:])
|
||||
|
||||
def set_brush_style(self, value):
|
||||
ng = bpy.data.node_groups.get(f'BSBST-brushstroke.{value}')
|
||||
self.node_tree.nodes['Brush Style'].node_tree = ng
|
||||
self["brush_style"] = value
|
||||
|
||||
def get_brush_style_items(self, context, edit_text):
|
||||
items = []
|
||||
for ng in bpy.data.node_groups:
|
||||
if not ng.type == 'SHADER':
|
||||
continue
|
||||
if not ng.name.startswith('BSBST-brushstroke.'):
|
||||
continue
|
||||
items += [('.'.join(ng.name.split('.')[1:]), ng.name)]
|
||||
return items
|
||||
|
||||
def link_context_type_items(self, context):
|
||||
items = [
|
||||
('SURFACE_OBJECT', 'Surface Object', 'Link socket preset to context surface object', 'OUTLINER_OB_SURFACE', 1),\
|
||||
@ -218,7 +237,7 @@ class BSBST_Settings(bpy.types.PropertyGroup):
|
||||
('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),
|
||||
])
|
||||
|
||||
|
||||
try:
|
||||
gpv3 = bpy.context.preferences.experimental.use_grease_pencil_version3
|
||||
except:
|
||||
@ -263,6 +282,7 @@ def register():
|
||||
bpy.utils.register_class(c)
|
||||
bpy.types.Scene.BSBST_settings = bpy.props.PointerProperty(type=BSBST_Settings)
|
||||
bpy.types.Object.modifier_info = bpy.props.CollectionProperty(type=BSBST_modifier_info)
|
||||
bpy.types.Material.brush_style = bpy.props.StringProperty(get=get_brush_style, set=set_brush_style, search=get_brush_style_items, search_options={'SORT'})
|
||||
|
||||
bpy.app.handlers.depsgraph_update_post.append(find_context_brushstrokes)
|
||||
|
||||
|
@ -125,12 +125,23 @@ def draw_panel_ui_recursive(panel, panel_name, mod, items, display_mode, hide_pa
|
||||
col.prop(s, 'hide_ui', icon_only=True, icon='UNPINNED' if s.hide_ui else 'PINNED', emboss=False)
|
||||
|
||||
def draw_material_settings(layout, material):
|
||||
settings = bpy.context.scene.BSBST_settings
|
||||
|
||||
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')
|
||||
layout.prop(material.node_tree.nodes['Bump'], 'mute', text='Bump', invert_checkbox=True)
|
||||
layout.prop(material.node_tree.nodes['Bump'].inputs[0], 'default_value', text='Bump Strength')
|
||||
|
||||
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_search(material.node_tree.nodes['Brush Style'], 'node_tree', settings, 'styles', icon='BRUSHES_ALL')
|
||||
#brush_panel.template_node_inputs(material.node_tree.nodes['Brush Style'])
|
||||
brush_panel.prop(material, 'brush_style')
|
||||
brush_panel.template_node_inputs(material.node_tree.nodes['Brush Curve'])
|
||||
|
||||
effects_header, effects_panel = layout.panel('effects_panel', default_closed = True)
|
||||
effects_header.label(text='Effects', icon='SHADERFX')
|
||||
|
Loading…
Reference in New Issue
Block a user