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
4 changed files with 22 additions and 8 deletions
Showing only changes of commit 38e4e61cf6 - Show all commits

View File

@ -102,7 +102,7 @@ class BSBST_OT_post_process_brushstroke(bpy.types.Operator):
def invoke(self, context, event): def invoke(self, context, event):
utils.ensure_resources() utils.ensure_resources()
self.gp = None self.gp = None
self.ng_process = bpy.data.node_groups['.brushstroke_tools.processing'] self.ng_process = bpy.data.node_groups['.brushstroke_tools.draw_processing']
return self.execute(context) return self.execute(context)
def register_custom_draw_macro(): def register_custom_draw_macro():

View File

@ -46,7 +46,7 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
brushstrokes_object['BSBST_version'] = utils.addon_version brushstrokes_object['BSBST_version'] = utils.addon_version
return brushstrokes_object return brushstrokes_object
def new_flow_object(self, context, name): def new_flow_object(self, context, name, surface_object):
settings = context.scene.BSBST_settings settings = context.scene.BSBST_settings
if settings.curve_mode == 'GP': if settings.curve_mode == 'GP':
bpy.ops.object.grease_pencil_add(type='EMPTY') bpy.ops.object.grease_pencil_add(type='EMPTY')
@ -72,6 +72,20 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
] ]
for vis in visibility_options: for vis in visibility_options:
setattr(flow_object, vis, False) setattr(flow_object, vis, False)
## add pre-processing modifier
mod = flow_object.modifiers.new('Pre-Processing', 'NODES')
mod.node_group = bpy.data.node_groups['.brushstroke_tools.pre_processing']
mod_info = flow_object.modifier_info.add()
mod_info.name = mod.name
utils.mark_socket_context_type(mod_info, 'Socket_2', 'SURFACE_OBJECT')
mod['Socket_2'] = surface_object
mod['Socket_3'] = False
#utils.set_deformable()
return flow_object return flow_object
def execute(self, context): def execute(self, context):
@ -99,7 +113,7 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
if 'BSBST_flow_object' in bs.keys(): if 'BSBST_flow_object' in bs.keys():
flow_object = bs['BSBST_flow_object'] flow_object = bs['BSBST_flow_object']
if not flow_object: if not flow_object:
flow_object = self.new_flow_object(context, utils.flow_name(name)) flow_object = self.new_flow_object(context, utils.flow_name(name), surface_object)
# attach surface object pointer # attach surface object pointer
if surface_object: if surface_object:
@ -518,9 +532,9 @@ class BSBST_OT_init_preset(bpy.types.Operator):
preset_object = settings.preset_object preset_object = settings.preset_object
# add modifiers # add modifiers
## deformation ## add pre-processing modifier
mod = preset_object.modifiers.new('Deformation', 'NODES') mod = preset_object.modifiers.new('Pre-Processing', 'NODES')
mod.node_group = bpy.data.node_groups['.brushstroke_tools.deformation'] mod.node_group = bpy.data.node_groups['.brushstroke_tools.pre_processing']
mod_info = settings.preset_object.modifier_info.get(mod.name) mod_info = settings.preset_object.modifier_info.get(mod.name)
if not mod_info: if not mod_info:

View File

@ -4,8 +4,8 @@ from bpy.app.handlers import persistent
import math, shutil, errno import math, shutil, errno
ng_list = [ ng_list = [
".brushstroke_tools.processing", ".brushstroke_tools.draw_processing",
".brushstroke_tools.deformation", ".brushstroke_tools.pre_processing",
".brushstroke_tools.surface_fill", ".brushstroke_tools.surface_fill",
".brushstroke_tools.surface_draw", ".brushstroke_tools.surface_draw",
".brushstroke_tools.geometry_input", ".brushstroke_tools.geometry_input",