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 e79fe4220b - Show all commits

View File

@ -787,7 +787,7 @@ class BSBST_OT_make_preset(bpy.types.Operator):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return utils.is_brushstrokes_object(context.object) return bool(utils.get_active_context_brushstrokes_object(context))
def execute(self, context): def execute(self, context):
@ -801,8 +801,11 @@ class BSBST_OT_make_preset(bpy.types.Operator):
settings.preset_object.modifiers.remove(mod) settings.preset_object.modifiers.remove(mod)
# transfer brushstrokes modifiers to preset # transfer brushstrokes modifiers to preset
for mod in context.object.modifiers: bs_ob = utils.get_active_context_brushstrokes_object(context)
utils.transfer_modifier(mod.name, settings.preset_object, context.object) if not bs_ob:
return {"CANCELLED"}
for mod in bs_ob.modifiers:
utils.transfer_modifier(mod.name, settings.preset_object, bs_ob)
utils.refresh_preset(None) utils.refresh_preset(None)
for mod in settings.preset_object.modifiers: for mod in settings.preset_object.modifiers:
@ -816,7 +819,7 @@ class BSBST_OT_make_preset(bpy.types.Operator):
if not settings.preset_object.modifier_info[mod.name].socket_info[v.identifier]: if not settings.preset_object.modifier_info[mod.name].socket_info[v.identifier]:
continue continue
if type(v) == bpy.types.NodeTreeInterfaceSocketObject: if type(v) == bpy.types.NodeTreeInterfaceSocketObject:
if context.object['BSBST_surface_object']==mod[v.identifier]: if bs_ob['BSBST_surface_object']==mod[v.identifier]:
mod[v.identifier] = None mod[v.identifier] = None
settings.preset_object.modifier_info[mod.name].socket_info[v.identifier].link_context = True settings.preset_object.modifier_info[mod.name].socket_info[v.identifier].link_context = True
elif type(v) == bpy.types.NodeTreeInterfaceSocketMaterial: elif type(v) == bpy.types.NodeTreeInterfaceSocketMaterial: