2026-02-16
This commit is contained in:
@@ -42,15 +42,19 @@ def find_layer_collection(layer_collection, collection_name):
|
||||
|
||||
def append_brush(file_name, brushname=None, link=False, fake_user=True):
|
||||
"""append a brush"""
|
||||
brushes_before = bpy.data.brushes[:]
|
||||
with bpy.data.libraries.load(file_name, link=link, relative=True) as (
|
||||
data_from,
|
||||
data_to,
|
||||
):
|
||||
for m in data_from.brushes:
|
||||
if m == brushname or brushname is None:
|
||||
if brushname is None or m.strip() == brushname.strip():
|
||||
data_to.brushes = [m]
|
||||
brushname = m
|
||||
brush = bpy.data.brushes[brushname]
|
||||
for b in bpy.data.brushes:
|
||||
if b not in brushes_before:
|
||||
brush = b
|
||||
break
|
||||
brush.use_fake_user = fake_user
|
||||
return brush
|
||||
|
||||
@@ -93,8 +97,7 @@ def append_nodegroup(
|
||||
data_to,
|
||||
):
|
||||
for g in data_from.node_groups:
|
||||
print(g)
|
||||
if g == nodegroupname or nodegroupname is None:
|
||||
if nodegroupname is None or g.strip() == nodegroupname.strip():
|
||||
data_to.node_groups = [g]
|
||||
nodegroupname = g
|
||||
nodegroup = bpy.data.node_groups[nodegroupname]
|
||||
@@ -281,7 +284,7 @@ def append_material(file_name, matname=None, link=False, fake_user=True):
|
||||
):
|
||||
found = False
|
||||
for m in data_from.materials:
|
||||
if m == matname or matname is None:
|
||||
if matname is None or m.strip() == matname.strip():
|
||||
data_to.materials = [m]
|
||||
matname = m
|
||||
found = True
|
||||
@@ -319,7 +322,7 @@ def append_scene(file_name, scenename=None, link=False, fake_user=False):
|
||||
data_to,
|
||||
):
|
||||
for s in data_from.scenes:
|
||||
if s == scenename or scenename is None:
|
||||
if scenename is None or s.strip() == scenename.strip():
|
||||
data_to.scenes = [s]
|
||||
scenename = s
|
||||
scene = bpy.data.scenes[scenename]
|
||||
@@ -448,7 +451,7 @@ def link_collection(
|
||||
data_to,
|
||||
):
|
||||
for col in data_from.collections:
|
||||
if col == kwargs["name"]:
|
||||
if col.strip() == kwargs["name"].strip():
|
||||
data_to.collections = [col]
|
||||
|
||||
rotation = (0, 0, 0)
|
||||
|
||||
Reference in New Issue
Block a user