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
Showing only changes of commit 6c32f126ca - Show all commits

View File

@ -129,6 +129,9 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
if flow_object: if flow_object:
flow_object.parent = surface_object flow_object.parent = surface_object
if not settings.preset_object:
bpy.ops.brushstroke_tools.init_preset()
# assign preset material # assign preset material
preset_material = getattr(settings.preset_object, '["BSBST_material"]', None) preset_material = getattr(settings.preset_object, '["BSBST_material"]', None)
@ -139,10 +142,7 @@ class BSBST_OT_new_brushstrokes(bpy.types.Operator):
bpy.ops.object.material_slot_add() bpy.ops.object.material_slot_add()
brushstrokes_object.material_slots[0].material = preset_material brushstrokes_object.material_slots[0].material = preset_material
settings.context_material = preset_material settings.context_material = preset_material
brushstrokes_object['BSBST_material'] = preset_material brushstrokes_object['BSBST_material'] = settings.context_material
if not settings.preset_object:
bpy.ops.brushstroke_tools.init_preset()
# transfer preset modifiers to new brushstrokes TODO: refactor to deduplicate # transfer preset modifiers to new brushstrokes TODO: refactor to deduplicate
for mod in settings.preset_object.modifiers: for mod in settings.preset_object.modifiers:
@ -780,7 +780,7 @@ class BSBST_OT_init_preset(bpy.types.Operator):
mat = bpy.data.materials.get('Brush Material') mat = bpy.data.materials.get('Brush Material')
if not mat: if not mat:
mat = utils.import_brushstroke_material() mat = utils.import_brushstroke_material()
settings.context_material = bpy.data.materials['Brush Material'] settings.context_material = mat
preset_object['BSBST_material'] = settings.context_material preset_object['BSBST_material'] = settings.context_material
return {"FINISHED"} return {"FINISHED"}