Brushstroke Tools: Initial Version #328
@ -263,6 +263,101 @@ def draw_effect_panel_recursive(effects_panel, material, prev_node):
|
|||||||
|
|
||||||
draw_effect_panel_recursive(effects_panel, material, node)
|
draw_effect_panel_recursive(effects_panel, material, node)
|
||||||
|
|
||||||
|
def draw_advanced_settings(layout, settings):
|
||||||
|
new_advanced_header, new_advanced_panel = layout.panel("new_advanced", default_closed=True)
|
||||||
|
new_advanced_header.label(text='Advanced')
|
||||||
|
if new_advanced_panel:
|
||||||
|
new_advanced_panel.row().prop(settings, 'curve_mode', expand=True)
|
||||||
|
if settings.curve_mode in ['CURVE', 'GP']:
|
||||||
|
new_advanced_panel.label(text='Curve mode does not support drawing on deformed geometry', icon='ERROR')
|
||||||
|
|
||||||
|
new_advanced_panel.prop(settings, 'animated')
|
||||||
|
new_advanced_panel.prop(settings, 'deforming_surface')
|
||||||
|
new_advanced_panel.prop(settings, 'assign_materials')
|
||||||
|
new_advanced_panel.prop(settings, 'reuse_flow')
|
||||||
|
new_advanced_panel.prop(settings, 'estimate_dimensions')
|
||||||
|
new_advanced_panel.prop(settings, 'style_context')
|
||||||
|
new_advanced_panel.operator('brushstroke_tools.render_setup')
|
||||||
|
|
||||||
|
def draw_shape_properties(layout, settings, style_object, is_preset, display_mode):
|
||||||
|
if not style_object:
|
||||||
|
return
|
||||||
|
for mod in style_object.modifiers:
|
||||||
|
mod_info = mod.id_data.modifier_info.get(mod.name)
|
||||||
|
if not mod_info:
|
||||||
|
continue
|
||||||
|
if display_mode == 0:
|
||||||
|
if mod_info.hide_ui:
|
||||||
|
continue
|
||||||
|
|
||||||
|
mod_header, mod_panel = layout.panel(mod.name, default_closed = mod_info.default_closed)
|
||||||
|
row = mod_header.row(align=True)
|
||||||
|
row.label(text='', icon='GEOMETRY_NODES')
|
||||||
|
row.prop(mod_info, 'name', text='', emboss=False)
|
||||||
|
|
||||||
|
if display_mode != 0:
|
||||||
|
mod_header.prop(mod_info, 'hide_ui', icon_only=True, icon='UNPINNED' if mod_info.hide_ui else 'PINNED', emboss=False)
|
||||||
|
if is_preset:
|
||||||
|
op = row.operator('brushstroke_tools.preset_remove_mod', text='', icon='X')
|
||||||
|
else:
|
||||||
|
op = row.operator('object.modifier_remove', text='', icon='X')
|
||||||
|
# TODO Implement operator to remove modifier on brushstroke object, even when not active
|
||||||
|
op.modifier = mod.name
|
||||||
|
|
||||||
|
if not mod_panel:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not mod.type == 'NODES':
|
||||||
|
mod_panel.label(text="Only 'Nodes' modifiers supported")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# show settings for nodes modifiers
|
||||||
|
if mod.show_group_selector:
|
||||||
|
mod_panel.prop(mod, 'node_group')
|
||||||
|
if not mod.node_group:
|
||||||
|
continue
|
||||||
|
|
||||||
|
draw_panel_ui_recursive(mod_panel,
|
||||||
|
'',
|
||||||
|
mod,
|
||||||
|
mod.node_group.interface.items_tree.items(),
|
||||||
|
display_mode)
|
||||||
|
|
||||||
|
draw_mod_warnings(layout, mod)
|
||||||
|
|
||||||
|
def draw_material_properties(layout, settings, surface_object):
|
||||||
|
if settings.context_material:
|
||||||
|
draw_material_settings(layout, settings.context_material, surface_object=surface_object)
|
||||||
|
else:
|
||||||
|
material_row = layout.row(align=True)
|
||||||
|
material_row.template_ID(settings, 'context_material', new='brushstroke_tools.new_material')
|
||||||
|
|
||||||
|
def draw_settings_properties(layout, settings, style_object):
|
||||||
|
deform = utils.get_deformable(style_object)
|
||||||
|
op = layout.operator('brushstroke_tools.switch_deformable', text='Deforming Surface', depress=deform, icon='MOD_SIMPLEDEFORM')
|
||||||
|
op.deformable = not deform
|
||||||
|
|
||||||
|
anim = utils.get_animated(style_object)
|
||||||
|
op = layout.operator('brushstroke_tools.switch_animated', text='Animated Strokes', depress=anim, icon='GP_MULTIFRAME_EDITING')
|
||||||
|
op.animated = not anim
|
||||||
|
|
||||||
|
layout.prop(style_object, 'visible_shadow', icon='LIGHT', emboss=True)
|
||||||
|
|
||||||
|
def draw_properties_panel(layout, settings, style_object, surface_object, is_preset, display_mode):
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(settings, 'view_tab', expand=True)
|
||||||
|
|
||||||
|
if settings.view_tab == 'MATERIAL':
|
||||||
|
draw_material_properties(layout, settings, surface_object)
|
||||||
|
elif settings.view_tab == 'SHAPE':
|
||||||
|
draw_shape_properties(layout, settings, style_object, is_preset, display_mode)
|
||||||
|
|
||||||
|
# expose add modifier operator for preset context
|
||||||
|
if is_preset:
|
||||||
|
layout.operator('brushstroke_tools.preset_add_mod', icon='ADD')
|
||||||
|
elif settings.view_tab == 'SETTINGS':
|
||||||
|
draw_settings_properties(layout, settings, style_object)
|
||||||
|
|
||||||
def draw_mod_warnings(layout, mod):
|
def draw_mod_warnings(layout, mod):
|
||||||
if utils.compare_versions(bpy.app.version, (4,3,0)) < 0:
|
if utils.compare_versions(bpy.app.version, (4,3,0)) < 0:
|
||||||
return
|
return
|
||||||
@ -342,20 +437,7 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
|
|||||||
op = row.operator("brushstroke_tools.new_brushstrokes", text='Draw', icon='LINE_DATA')
|
op = row.operator("brushstroke_tools.new_brushstrokes", text='Draw', icon='LINE_DATA')
|
||||||
op.method = 'SURFACE_DRAW'
|
op.method = 'SURFACE_DRAW'
|
||||||
|
|
||||||
new_advanced_header, new_advanced_panel = layout.panel("new_advanced", default_closed=True)
|
draw_advanced_settings(layout, settings)
|
||||||
new_advanced_header.label(text='Advanced')
|
|
||||||
if new_advanced_panel:
|
|
||||||
new_advanced_panel.row().prop(settings, 'curve_mode', expand=True)
|
|
||||||
if settings.curve_mode in ['CURVE', 'GP']:
|
|
||||||
new_advanced_panel.label(text='Curve mode does not support drawing on deformed geometry', icon='ERROR')
|
|
||||||
|
|
||||||
new_advanced_panel.prop(settings, 'animated')
|
|
||||||
new_advanced_panel.prop(settings, 'deforming_surface')
|
|
||||||
new_advanced_panel.prop(settings, 'assign_materials')
|
|
||||||
new_advanced_panel.prop(settings, 'reuse_flow')
|
|
||||||
new_advanced_panel.prop(settings, 'estimate_dimensions')
|
|
||||||
new_advanced_panel.prop(settings, 'style_context')
|
|
||||||
new_advanced_panel.operator('brushstroke_tools.render_setup')
|
|
||||||
|
|
||||||
# identify style context
|
# identify style context
|
||||||
style_object = context.object if settings.style_context=='BRUSHSTROKES' else settings.preset_object
|
style_object = context.object if settings.style_context=='BRUSHSTROKES' else settings.preset_object
|
||||||
@ -407,77 +489,11 @@ class BSBST_PT_brushstroke_tools_panel(bpy.types.Panel):
|
|||||||
row_edit.operator('brushstroke_tools.edit_brushstrokes', icon='GREASEPENCIL', text = text)
|
row_edit.operator('brushstroke_tools.edit_brushstrokes', icon='GREASEPENCIL', text = text)
|
||||||
row_edit.prop(settings, 'edit_toggle', icon='RESTRICT_SELECT_OFF' if settings.edit_toggle else 'RESTRICT_SELECT_ON', icon_only=True)
|
row_edit.prop(settings, 'edit_toggle', icon='RESTRICT_SELECT_OFF' if settings.edit_toggle else 'RESTRICT_SELECT_ON', icon_only=True)
|
||||||
|
|
||||||
row = style_panel.row(align=True)
|
|
||||||
row.prop(settings, 'view_tab', expand=True)
|
|
||||||
|
|
||||||
if settings.view_tab == 'MATERIAL':
|
|
||||||
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')
|
layout.operator("brushstroke_tools.init_preset", icon='MODIFIER')
|
||||||
else:
|
else:
|
||||||
if settings.context_material:
|
draw_properties_panel(style_panel, settings, style_object, surface_object, is_preset, display_mode)
|
||||||
draw_material_settings(style_panel, settings.context_material, surface_object=surface_object)
|
|
||||||
else:
|
|
||||||
material_row = style_panel.row(align=True)
|
|
||||||
material_row.template_ID(settings, 'context_material', new='brushstroke_tools.new_material')
|
|
||||||
|
|
||||||
elif settings.view_tab == 'SHAPE':
|
|
||||||
if style_object:
|
|
||||||
for mod in style_object.modifiers:
|
|
||||||
mod_info = mod.id_data.modifier_info.get(mod.name)
|
|
||||||
if not mod_info:
|
|
||||||
continue
|
|
||||||
if display_mode == 0:
|
|
||||||
if mod_info.hide_ui:
|
|
||||||
continue
|
|
||||||
|
|
||||||
mod_header, mod_panel = style_panel.panel(mod.name, default_closed = mod_info.default_closed)
|
|
||||||
row = mod_header.row(align=True)
|
|
||||||
row.label(text='', icon='GEOMETRY_NODES')
|
|
||||||
row.prop(mod_info, 'name', text='', emboss=False)
|
|
||||||
|
|
||||||
if display_mode != 0:
|
|
||||||
mod_header.prop(mod_info, 'hide_ui', icon_only=True, icon='UNPINNED' if mod_info.hide_ui else 'PINNED', emboss=False)
|
|
||||||
if is_preset:
|
|
||||||
op = row.operator('brushstroke_tools.preset_remove_mod', text='', icon='X')
|
|
||||||
else:
|
|
||||||
op = row.operator('object.modifier_remove', text='', icon='X')
|
|
||||||
# TODO Implement operator to remove modifier on brushstroke object, even when not active
|
|
||||||
op.modifier = mod.name
|
|
||||||
|
|
||||||
if not mod_panel:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not mod.type == 'NODES':
|
|
||||||
mod_panel.label(text="Only 'Nodes' modifiers supported")
|
|
||||||
continue
|
|
||||||
|
|
||||||
# show settings for nodes modifiers
|
|
||||||
if mod.show_group_selector:
|
|
||||||
mod_panel.prop(mod, 'node_group')
|
|
||||||
if not mod.node_group:
|
|
||||||
continue
|
|
||||||
|
|
||||||
draw_panel_ui_recursive(mod_panel,
|
|
||||||
'',
|
|
||||||
mod,
|
|
||||||
mod.node_group.interface.items_tree.items(),
|
|
||||||
display_mode)
|
|
||||||
|
|
||||||
draw_mod_warnings(style_panel, mod)
|
|
||||||
|
|
||||||
# expose add modifier operator for preset context
|
|
||||||
if is_preset:
|
|
||||||
style_panel.operator('brushstroke_tools.preset_add_mod', icon='ADD')
|
|
||||||
elif settings.view_tab == 'SETTINGS':
|
|
||||||
deform = utils.get_deformable(style_object)
|
|
||||||
op = style_panel.operator('brushstroke_tools.switch_deformable', text='Deforming Surface', depress=deform, icon='MOD_SIMPLEDEFORM')
|
|
||||||
op.deformable = not deform
|
|
||||||
|
|
||||||
anim = utils.get_animated(style_object)
|
|
||||||
op = style_panel.operator('brushstroke_tools.switch_animated', text='Animated Strokes', depress=anim, icon='GP_MULTIFRAME_EDITING')
|
|
||||||
op.animated = not anim
|
|
||||||
|
|
||||||
style_panel.prop(style_object, 'visible_shadow', icon='LIGHT', emboss=True)
|
|
||||||
|
|
||||||
class BSBST_MT_PIE_brushstroke_data_marking(bpy.types.Menu):
|
class BSBST_MT_PIE_brushstroke_data_marking(bpy.types.Menu):
|
||||||
bl_idname= "BSBST_MT_PIE_brushstroke_data_marking"
|
bl_idname= "BSBST_MT_PIE_brushstroke_data_marking"
|
||||||
|
Loading…
Reference in New Issue
Block a user