Corrections for layers unittest based on design change

Example, imagine an object Cube in collections 1 and 2 where both
collections are nested to A. Now we set a "color" property as follow:

```
Scene -> GREEN
--
A     -> RED
↳ 1   -> BLUE
↳ 2   -> -
```

In this case the object will be RED, because of A↳ 2.

Now if we have:

```
Scene -> GREEN
--
A     -> RED
↳ 1   -> -
↳ 2   -> PINK
1     -> -
--

The object will be PINK because of A↳ 2.

Note that the (top level) collection 1 doesn't influence the object color
because there are no overrides on it. The scene render settings (GREEN
in this case) are only used as fallback if an override is not set at
all.
This commit is contained in:
Dalai Felinto 2017-04-19 17:43:55 +02:00
parent b5b0fc9c94
commit 53d59af364
5 changed files with 10 additions and 44 deletions

View File

@ -71,7 +71,6 @@ RENDER_LAYER_TEST(evaluation_render_settings_f)
RENDER_LAYER_TEST(evaluation_render_settings_g)
RENDER_LAYER_TEST(evaluation_render_settings_h)
RENDER_LAYER_TEST(evaluation_render_settings_i)
RENDER_LAYER_TEST(evaluation_render_settings_j)
RENDER_LAYER_TEST(evaluation_visibility_a)
RENDER_LAYER_TEST(evaluation_visibility_b)
RENDER_LAYER_TEST(evaluation_visibility_c)

View File

@ -740,6 +740,11 @@ class Clay:
while bpy.data.objects:
bpy.data.objects.remove(bpy.data.objects[0])
# remove all the other collections
while self._scene.master_collection.collections:
self._scene.master_collection.collections.remove(
self._scene.master_collection.collections[0])
layer = self._scene.render_layers.new('Evaluation Test')
layer.collections.unlink(layer.collections[0])
self._scene.render_layers.active = layer

View File

@ -18,11 +18,12 @@ class UnitTesting(RenderLayerTesting):
"""
See if the depsgraph evaluation is correct
"""
clay = Clay()
clay = Clay(extra_kid_layer=True)
self.assertEqual(clay.get('object', 'matcap_icon'), '01')
clay.set('mom', 'matcap_icon', '02')
self.assertEqual(clay.get('object', 'matcap_icon'), '02')
clay.set('kid', 'matcap_icon', '02')
clay.set('extra', 'matcap_icon', '04')
self.assertEqual(clay.get('object', 'matcap_icon'), '04')
# ############################################################

View File

@ -22,6 +22,7 @@ class UnitTesting(RenderLayerTesting):
self.assertEqual(clay.get('object', 'matcap_icon'), '01')
clay.set('mom', 'matcap_icon', '02')
self.assertEqual(clay.get('extra', 'matcap_icon'), '01')
self.assertEqual(clay.get('object', 'matcap_icon'), '02')

View File

@ -1,40 +0,0 @@
# ############################################################
# Importing - Same For All Render Layer Tests
# ############################################################
import unittest
import os
import sys
from render_layer_common import *
# ############################################################
# Testing
# ############################################################
class UnitTesting(RenderLayerTesting):
def test_render_settings(self):
"""
See if the depsgraph evaluation is correct
"""
clay = Clay(extra_kid_layer=True)
self.assertEqual(clay.get('object', 'matcap_icon'), '01')
clay.set('mom', 'matcap_icon', '02')
self.assertEqual(clay.get('extra', 'matcap_icon'), '01')
self.assertEqual(clay.get('object', 'matcap_icon'), '02')
# ############################################################
# Main - Same For All Render Layer Tests
# ############################################################
if __name__ == '__main__':
import sys
extra_arguments = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 2:] if "--" in sys.argv else [])
UnitTesting._extra_arguments = extra_arguments
unittest.main()