Changeset View
Changeset View
Standalone View
Standalone View
tests/python/view_layer/test_active_collection.py
- This file was moved from tests/python/render_layer/test_active_collection.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 test_active_collection(self): | def test_active_collection(self): | ||||
| """ | """ | ||||
| See if active collection index is working | See if active collection index is working | ||||
| layer.collections.active_index works recursively | layer.collections.active_index works recursively | ||||
| """ | """ | ||||
| import bpy | import bpy | ||||
| import os | import os | ||||
| ROOT = self.get_root() | ROOT = self.get_root() | ||||
| filepath_layers = os.path.join(ROOT, 'layers.blend') | filepath_layers = os.path.join(ROOT, 'layers.blend') | ||||
| # open file | # open file | ||||
| bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers) | bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers) | ||||
| self.rename_collections() | self.rename_collections() | ||||
| # create sub-collections | # create sub-collections | ||||
| three_b = bpy.data.objects.get('T.3b') | three_b = bpy.data.objects.get('T.3b') | ||||
| three_c = bpy.data.objects.get('T.3c') | three_c = bpy.data.objects.get('T.3c') | ||||
| scene = bpy.context.scene | scene = bpy.context.scene | ||||
| 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') | ||||
| subzero.objects.link(three_b) | subzero.objects.link(three_b) | ||||
| scorpion.objects.link(three_c) | scorpion.objects.link(three_c) | ||||
| layer = scene.render_layers.new('Fresh new Layer') | layer = scene.view_layers.new('Fresh new Layer') | ||||
| layer.collections.link(subzero) | layer.collections.link(subzero) | ||||
| lookup = [ | lookup = [ | ||||
| 'Master Collection', | 'Master Collection', | ||||
| '1', | '1', | ||||
| 'sub-zero', | 'sub-zero', | ||||
| 'scorpion', | 'scorpion', | ||||
| '2', | '2', | ||||
| Show All 21 Lines | |||||