Brushstroke Tools: Initial Version #328
@ -573,7 +573,7 @@ def set_brushstrokes_animated(bs_ob, animated):
|
||||
if animated:
|
||||
if not mod:
|
||||
mod = ob.modifiers.new('Animation', 'NODES')
|
||||
mod.node_group = bpy.data.node_groups['.brushstroke_tools.animation']
|
||||
mod.node_group = utils.ensure_node_group('.brushstroke_tools.animation')
|
||||
|
||||
mod_info = ob.modifier_info.get(mod.name)
|
||||
if not mod_info:
|
||||
|
@ -304,12 +304,14 @@ def import_brushstroke_material():
|
||||
else:
|
||||
return bpy.data.materials.get(name)
|
||||
|
||||
def ensure_node_group(name, path):
|
||||
def ensure_node_group(name, path=''):
|
||||
ng = bpy.data.node_groups.get(name)
|
||||
if ng:
|
||||
return ng
|
||||
|
||||
addon_prefs = bpy.context.preferences.addons[__package__].preferences
|
||||
if not path:
|
||||
path=f'{get_resource_directory()}/brushstroke_tools-resources.blend'
|
||||
|
||||
with bpy.data.libraries.load(path, link=addon_prefs.import_method=='LINK', relative=addon_prefs.import_relative_path) as (data_src, data_dst):
|
||||
data_dst.node_groups = [name]
|
||||
|
Loading…
Reference in New Issue
Block a user