Brushstroke Tools: Initial Version #328
@ -2,7 +2,7 @@ import bpy
|
||||
from . import utils
|
||||
|
||||
class BSBST_OT_new_brushstrokes(bpy.types.Operator):
|
||||
""" Create new object according to type.
|
||||
""" Create new object according to method and type.
|
||||
Link to correct collection.
|
||||
Attach to selection context if applicable.
|
||||
Assign selected modifier setup. Enter correct context for editing.
|
||||
@ -134,7 +134,8 @@ class BSBST_OT_init_preset(bpy.types.Operator):
|
||||
settings = context.scene.BSBST_settings
|
||||
|
||||
utils.ensure_resources()
|
||||
preset_object = bpy.data.objects.new('BSBST_PRESET', bpy.data.hair_curves.new('BSBST_PRESET'))
|
||||
preset_name = f'BSBST-PRESET_{settings.brushstroke_method}'
|
||||
preset_object = bpy.data.objects.new(preset_name, bpy.data.hair_curves.new(preset_name))
|
||||
settings.preset_object = preset_object
|
||||
|
||||
# add modifiers
|
||||
@ -172,7 +173,8 @@ class BSBST_OT_make_preset(bpy.types.Operator):
|
||||
settings = context.scene.BSBST_settings
|
||||
|
||||
if not settings.preset_object:
|
||||
settings.preset_object = bpy.data.objects.new('BSBST_PRESET', bpy.data.hair_curves.new('BSBST_PRESET'))
|
||||
preset_name = f'BSBST-PRESET_{settings.brushstroke_method}'
|
||||
settings.preset_object = bpy.data.objects.new(preset_name, bpy.data.hair_curves.new(preset_name))
|
||||
else:
|
||||
for mod in settings.preset_object.modifiers[:]:
|
||||
settings.preset_object.modifiers.remove(mod)
|
||||
|
@ -1,5 +1,11 @@
|
||||
import bpy
|
||||
|
||||
def update_brushstroke_method(self, context):
|
||||
settings = context.scene.BSBST_settings
|
||||
preset_name = f'BSBST-PRESET_{settings.brushstroke_method}'
|
||||
preset_object = bpy.data.objects.get(preset_name)
|
||||
settings.preset_object = preset_object
|
||||
return
|
||||
class BSBST_link_context_setting(bpy.types.PropertyGroup):
|
||||
name: bpy.props.StringProperty(default='')
|
||||
link_context: bpy.props.BoolProperty(default=False)
|
||||
@ -13,7 +19,7 @@ class BSBST_Settings(bpy.types.PropertyGroup):
|
||||
preset_object: bpy.props.PointerProperty(type=bpy.types.Object, name="Preset Object")
|
||||
preset_material: bpy.props.PointerProperty(type=bpy.types.Material, name="Preset Material")
|
||||
assign_materials: bpy.props.BoolProperty(name='Assign Modifier Materials', default=True)
|
||||
brushstroke_method: bpy.props.EnumProperty(default='SURFACE_FILL',
|
||||
brushstroke_method: bpy.props.EnumProperty(default='SURFACE_FILL', update=update_brushstroke_method,
|
||||
items= [('SURFACE_FILL', 'Fill', 'Use surface fill method for new brushstroke object', 'OUTLINER_OB_FORCE_FIELD', 0),\
|
||||
('SURFACE_DRAW', 'Draw', 'Use surface draw method for new brushstroke object', 'OUTLINER_DATA_GP_LAYER', 1),
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user