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
path: root/tests
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-08-04 17:56:06 +0300
committerBastien Montagne <bastien@blender.org>2021-08-04 17:57:08 +0300
commit58ba75f9e3bfc4ff08dbd1f2ce269c65388dfcfd (patch)
tree9f814ffac35f261a248a0e402084d43e3ceec6c2 /tests
parenta8185d2d74d42389d881890897958c1223eb5cf1 (diff)
LibOverride RNA API: add removal of properties and operations.
This should complete the basics of RNA API for library overrides. Ref. T86656.
Diffstat (limited to 'tests')
-rw-r--r--tests/python/bl_blendfile_library_overrides.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/python/bl_blendfile_library_overrides.py b/tests/python/bl_blendfile_library_overrides.py
index 358f77d49ea..b44e4d48564 100644
--- a/tests/python/bl_blendfile_library_overrides.py
+++ b/tests/python/bl_blendfile_library_overrides.py
@@ -59,9 +59,9 @@ class TestLibraryOverrides(TestHelper, unittest.TestCase):
self.assertIsNone(local_id.data.override_library)
assert(len(local_id.override_library.properties) == 0)
+ ##### Generate an override property & operation automaticaly by editing the local override data.
local_id.location.y = 1.0
local_id.override_library.operations_update()
-
assert(len(local_id.override_library.properties) == 1)
override_prop = local_id.override_library.properties[0]
assert(override_prop.rna_path == "location")
@@ -71,11 +71,31 @@ class TestLibraryOverrides(TestHelper, unittest.TestCase):
# Setting location.y overridded all elements in the location array. -1 is a wildcard.
assert(override_operation.subitem_local_index == -1)
+ ##### Reset the override to its linked reference data.
local_id.override_library.reset()
-
assert(len(local_id.override_library.properties) == 0)
assert(local_id.location == local_id.override_library.reference.location)
+ ##### Generate an override property & operation manually using the API.
+ override_property = local_id.override_library.properties.add(rna_path="location")
+ override_property.operations.add(operation='REPLACE')
+
+ assert(len(local_id.override_library.properties) == 1)
+ override_prop = local_id.override_library.properties[0]
+ assert(override_prop.rna_path == "location")
+ assert(len(override_prop.operations) == 1)
+ override_operation = override_prop.operations[0]
+ assert(override_operation.operation == 'REPLACE')
+ # Setting location.y overridded all elements in the location array. -1 is a wildcard.
+ assert(override_operation.subitem_local_index == -1)
+
+ override_property = local_id.override_library.properties[0]
+ override_property.operations.remove(override_property.operations[0])
+ local_id.override_library.properties.remove(override_property)
+
+ assert(len(local_id.override_library.properties) == 0)
+
+ ##### Delete the override.
local_id_name = local_id.name
assert(bpy.data.objects.get((local_id_name, None), None) == local_id)
local_id.override_library.destroy()