Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kim <pk15950@gmail.com>2021-10-03 06:22:05 +0300
committerPeter Kim <pk15950@gmail.com>2021-10-03 06:22:05 +0300
commit6fc81d6bca6424a1e44305df7cdc3598e03b00ba (patch)
treea66f17c5378f2a68f4c5d8b09f56687c3d9bf888 /tests/python/bl_blendfile_liblink.py
parent85e1f28fcaafd137a546bf192777b00f96851e80 (diff)
parentd3afe0c1265c9ebb53053de68f176b30f0132281 (diff)
Merge branch 'master' into xr-controller-supportxr-controller-support
Diffstat (limited to 'tests/python/bl_blendfile_liblink.py')
-rw-r--r--tests/python/bl_blendfile_liblink.py78
1 files changed, 71 insertions, 7 deletions
diff --git a/tests/python/bl_blendfile_liblink.py b/tests/python/bl_blendfile_liblink.py
index 992bf6b89d9..4545e0b846a 100644
--- a/tests/python/bl_blendfile_liblink.py
+++ b/tests/python/bl_blendfile_liblink.py
@@ -10,7 +10,7 @@ from bl_blendfile_utils import TestHelper
class TestBlendLibLinkHelper(TestHelper):
-
+
def __init__(self, args):
self.args = args
@@ -165,7 +165,7 @@ class TestBlendLibAppendBasic(TestBlendLibLinkHelper):
link_dir = os.path.join(output_lib_path, "Mesh")
bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
- instance_object_data=False, set_fake=False, use_recursive=False)
+ instance_object_data=False, set_fake=False, use_recursive=False, do_reuse_local_id=False)
assert(len(bpy.data.meshes) == 1)
assert(bpy.data.meshes[0].library is None)
@@ -179,7 +179,7 @@ class TestBlendLibAppendBasic(TestBlendLibLinkHelper):
link_dir = os.path.join(output_lib_path, "Mesh")
bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
- instance_object_data=True, set_fake=False, use_recursive=False)
+ instance_object_data=True, set_fake=False, use_recursive=False, do_reuse_local_id=False)
assert(len(bpy.data.meshes) == 1)
assert(bpy.data.meshes[0].library is None)
@@ -194,7 +194,7 @@ class TestBlendLibAppendBasic(TestBlendLibLinkHelper):
link_dir = os.path.join(output_lib_path, "Mesh")
bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
- instance_object_data=False, set_fake=True, use_recursive=False)
+ instance_object_data=False, set_fake=True, use_recursive=False, do_reuse_local_id=False)
assert(len(bpy.data.meshes) == 1)
assert(bpy.data.meshes[0].library is None)
@@ -208,7 +208,7 @@ class TestBlendLibAppendBasic(TestBlendLibLinkHelper):
link_dir = os.path.join(output_lib_path, "Object")
bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
- instance_object_data=False, set_fake=False, use_recursive=False)
+ instance_object_data=False, set_fake=False, use_recursive=False, do_reuse_local_id=False)
assert(len(bpy.data.meshes) == 1)
# This one fails currently, for unclear reasons.
@@ -224,7 +224,7 @@ class TestBlendLibAppendBasic(TestBlendLibLinkHelper):
link_dir = os.path.join(output_lib_path, "Object")
bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
- instance_object_data=False, set_fake=False, use_recursive=True)
+ instance_object_data=False, set_fake=False, use_recursive=True, do_reuse_local_id=False)
assert(len(bpy.data.meshes) == 1)
assert(bpy.data.meshes[0].library is None)
@@ -239,7 +239,7 @@ class TestBlendLibAppendBasic(TestBlendLibLinkHelper):
link_dir = os.path.join(output_lib_path, "Collection")
bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
- instance_object_data=False, set_fake=False, use_recursive=True)
+ instance_object_data=False, set_fake=False, use_recursive=True, do_reuse_local_id=False)
assert(bpy.data.meshes[0].library is None)
assert(bpy.data.meshes[0].users == 1)
@@ -251,9 +251,73 @@ class TestBlendLibAppendBasic(TestBlendLibLinkHelper):
assert(bpy.data.collections[0].users == 1)
+class TestBlendLibAppendReuseID(TestBlendLibLinkHelper):
+
+ def __init__(self, args):
+ self.args = args
+
+ def test_append(self):
+ output_dir = self.args.output_dir
+ output_lib_path = self.init_lib_data_basic()
+
+ # Append of a single Object, and then append it again.
+ self.reset_blender()
+
+ link_dir = os.path.join(output_lib_path, "Object")
+ bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
+ instance_object_data=False, set_fake=False, use_recursive=True, do_reuse_local_id=False)
+
+ assert(len(bpy.data.meshes) == 1)
+ assert(bpy.data.meshes[0].library is None)
+ assert(bpy.data.meshes[0].use_fake_user is False)
+ assert(bpy.data.meshes[0].users == 1)
+ assert(bpy.data.meshes[0].library_weak_reference is not None)
+ assert(bpy.data.meshes[0].library_weak_reference.filepath == output_lib_path)
+ assert(bpy.data.meshes[0].library_weak_reference.id_name == "MELibMesh")
+ assert(len(bpy.data.objects) == 1)
+ for ob in bpy.data.objects:
+ assert(ob.library is None)
+ assert(ob.library_weak_reference is None)
+ assert(len(bpy.data.collections) == 0) # Scene's master collection is not listed here
+
+ bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
+ instance_object_data=False, set_fake=False, use_recursive=True, do_reuse_local_id=True)
+
+ assert(len(bpy.data.meshes) == 1)
+ assert(bpy.data.meshes[0].library is None)
+ assert(bpy.data.meshes[0].use_fake_user is False)
+ assert(bpy.data.meshes[0].users == 2)
+ assert(bpy.data.meshes[0].library_weak_reference is not None)
+ assert(bpy.data.meshes[0].library_weak_reference.filepath == output_lib_path)
+ assert(bpy.data.meshes[0].library_weak_reference.id_name == "MELibMesh")
+ assert(len(bpy.data.objects) == 2)
+ for ob in bpy.data.objects:
+ assert(ob.library is None)
+ assert(ob.library_weak_reference is None)
+ assert(len(bpy.data.collections) == 0) # Scene's master collection is not listed here
+
+ bpy.ops.wm.append(directory=link_dir, filename="LibMesh",
+ instance_object_data=False, set_fake=False, use_recursive=True, do_reuse_local_id=False)
+
+ assert(len(bpy.data.meshes) == 2)
+ assert(bpy.data.meshes[0].library_weak_reference is None)
+ assert(bpy.data.meshes[1].library is None)
+ assert(bpy.data.meshes[1].use_fake_user is False)
+ assert(bpy.data.meshes[1].users == 1)
+ assert(bpy.data.meshes[1].library_weak_reference is not None)
+ assert(bpy.data.meshes[1].library_weak_reference.filepath == output_lib_path)
+ assert(bpy.data.meshes[1].library_weak_reference.id_name == "MELibMesh")
+ assert(len(bpy.data.objects) == 3)
+ for ob in bpy.data.objects:
+ assert(ob.library is None)
+ assert(ob.library_weak_reference is None)
+ assert(len(bpy.data.collections) == 0) # Scene's master collection is not listed here
+
+
TESTS = (
TestBlendLibLinkSaveLoadBasic,
TestBlendLibAppendBasic,
+ TestBlendLibAppendReuseID,
)