Changeset View
Changeset View
Standalone View
Standalone View
tests/python/view_layer/test_layer_linking.py
- This file was moved from tests/python/render_layer/test_layer_linking.py.
| # ############################################################ | # ############################################################ | ||||
| # Importing - Same For All Render Layer Tests | # Importing - Same For All Render Layer Tests | ||||
| # ############################################################ | # ############################################################ | ||||
| import unittest | import unittest | ||||
| import os | import os | ||||
| import sys | import sys | ||||
| from render_layer_common import * | from view_layer_common import * | ||||
| # ############################################################ | # ############################################################ | ||||
| # Testing | # Testing | ||||
| # ############################################################ | # ############################################################ | ||||
| class UnitTesting(RenderLayerTesting): | class UnitTesting(ViewLayerTesting): | ||||
| def do_layer_linking(self, filepath_json, link_mode): | def do_layer_linking(self, filepath_json, link_mode): | ||||
| import bpy | import bpy | ||||
| import os | import os | ||||
| import tempfile | import tempfile | ||||
| import filecmp | import filecmp | ||||
| ROOT = self.get_root() | ROOT = self.get_root() | ||||
| with tempfile.TemporaryDirectory() as dirpath: | with tempfile.TemporaryDirectory() as dirpath: | ||||
| Show All 12 Lines | def do_layer_linking(self, filepath_json, link_mode): | ||||
| subzero = scene.master_collection.collections['1'].collections.new('sub-zero') | subzero = scene.master_collection.collections['1'].collections.new('sub-zero') | ||||
| scorpion = subzero.collections.new('scorpion') | scorpion = subzero.collections.new('scorpion') | ||||
| # test linking sync | # test linking sync | ||||
| subzero.objects.link(three_b) | subzero.objects.link(three_b) | ||||
| scorpion.objects.link(three_c) | scorpion.objects.link(three_c) | ||||
| # test unlinking sync | # test unlinking sync | ||||
| layer = scene.render_layers.new('Fresh new Layer') | layer = scene.view_layers.new('Fresh new Layer') | ||||
| if link_mode in {'COLLECTION_LINK', 'COLLECTION_UNLINK'}: | if link_mode in {'COLLECTION_LINK', 'COLLECTION_UNLINK'}: | ||||
| layer.collections.link(subzero) | layer.collections.link(subzero) | ||||
| if link_mode == 'COLLECTION_UNLINK': | if link_mode == 'COLLECTION_UNLINK': | ||||
| initial_collection = layer.collections['Master Collection'] | initial_collection = layer.collections['Master Collection'] | ||||
| layer.collections.unlink(initial_collection) | layer.collections.unlink(initial_collection) | ||||
| ▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines | |||||