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:
authorDalai Felinto <dfelinto@gmail.com>2017-04-03 19:42:01 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-04-03 19:47:50 +0300
commita78e97b206b188f3da050888fa8c61b0f237902a (patch)
treed37c9f1adc04ceb8e6a8f665e90d5a4fa720d2c8
parentd31c4c56668fe16096637f5f3697f1573096ebeb (diff)
Layer/Depsgraph: Update depsgraph for new objects
-rw-r--r--source/blender/editors/object/object_add.c3
-rw-r--r--tests/python/render_layer/CMakeLists.txt3
-rw-r--r--tests/python/render_layer/render_layer_common.py36
-rw-r--r--tests/python/render_layer/test_evaluation_visibility_g.py36
-rw-r--r--tests/python/render_layer/test_evaluation_visibility_h.py36
-rw-r--r--tests/python/render_layer/test_evaluation_visibility_i.py36
6 files changed, 150 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index ce43f321ec9..adfd213ff3e 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -444,6 +444,9 @@ Object *ED_object_add_type(
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
+ /* TODO(sergey): Use proper flag for tagging here. */
+ DAG_id_tag_update(&scene->id, 0);
+
return ob;
}
diff --git a/tests/python/render_layer/CMakeLists.txt b/tests/python/render_layer/CMakeLists.txt
index 962c1f7da36..a6e159f2f96 100644
--- a/tests/python/render_layer/CMakeLists.txt
+++ b/tests/python/render_layer/CMakeLists.txt
@@ -64,6 +64,9 @@ RENDER_LAYER_TEST(evaluation_visibility_c)
RENDER_LAYER_TEST(evaluation_visibility_d)
RENDER_LAYER_TEST(evaluation_visibility_e)
RENDER_LAYER_TEST(evaluation_visibility_f)
+RENDER_LAYER_TEST(evaluation_visibility_g)
+RENDER_LAYER_TEST(evaluation_visibility_h)
+RENDER_LAYER_TEST(evaluation_visibility_i)
RENDER_LAYER_TEST(evaluation_selectability_a)
RENDER_LAYER_TEST(evaluation_selectability_b)
RENDER_LAYER_TEST(evaluation_selectability_c)
diff --git a/tests/python/render_layer/render_layer_common.py b/tests/python/render_layer/render_layer_common.py
index abf0296a5c7..e1785dbd084 100644
--- a/tests/python/render_layer/render_layer_common.py
+++ b/tests/python/render_layer/render_layer_common.py
@@ -443,6 +443,42 @@ class RenderLayerTesting(unittest.TestCase):
),
"Scene dump files differ")
+ def do_visibility_object_add(self, add_mode):
+ import bpy
+
+ scene = bpy.context.scene
+
+ # delete all objects of the file
+ for ob in bpy.data.objects:
+ bpy.data.objects.remove(ob, do_unlink=True)
+
+ # real test
+ layer = scene.render_layers.new('Visibility Test')
+ layer.collections.unlink(layer.collections[0])
+ scene.render_layers.active = layer
+
+ scene_collection = scene.master_collection.collections.new("Collection")
+ layer.collections.link(scene_collection)
+
+ bpy.context.scene.update() # update depsgraph
+
+ self.assertEqual(len(bpy.data.objects), 0)
+
+ # add new objects
+ if add_mode == 'EMPTY':
+ bpy.ops.object.add() # 'Empty'
+
+ elif add_mode == 'CYLINDER':
+ bpy.ops.mesh.primitive_cylinder_add() # 'Cylinder'
+
+ elif add_mode == 'TORUS':
+ bpy.ops.mesh.primitive_torus_add() # 'Torus'
+
+ self.assertEqual(len(bpy.data.objects), 1)
+
+ new_ob = bpy.data.objects[0]
+ self.assertTrue(new_ob.visible_get(), "Object should be visible")
+
def cleanup_tree(self):
"""
Remove any existent layer and collections,
diff --git a/tests/python/render_layer/test_evaluation_visibility_g.py b/tests/python/render_layer/test_evaluation_visibility_g.py
new file mode 100644
index 00000000000..434ec86707e
--- /dev/null
+++ b/tests/python/render_layer/test_evaluation_visibility_g.py
@@ -0,0 +1,36 @@
+# ############################################################
+# Importing - Same For All Render Layer Tests
+# ############################################################
+
+import unittest
+import os
+import sys
+
+sys.path.append(os.path.dirname(__file__))
+from render_layer_common import *
+
+
+# ############################################################
+# Testing
+# ############################################################
+
+class UnitTesting(RenderLayerTesting):
+ def test_visibility_empty(self):
+ """
+ See if the depsgraph evaluation is correct
+ """
+ self.do_visibility_object_add('EMPTY')
+
+
+# ############################################################
+# 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()
diff --git a/tests/python/render_layer/test_evaluation_visibility_h.py b/tests/python/render_layer/test_evaluation_visibility_h.py
new file mode 100644
index 00000000000..05b77e72842
--- /dev/null
+++ b/tests/python/render_layer/test_evaluation_visibility_h.py
@@ -0,0 +1,36 @@
+# ############################################################
+# Importing - Same For All Render Layer Tests
+# ############################################################
+
+import unittest
+import os
+import sys
+
+sys.path.append(os.path.dirname(__file__))
+from render_layer_common import *
+
+
+# ############################################################
+# Testing
+# ############################################################
+
+class UnitTesting(RenderLayerTesting):
+ def test_visibility_cylinder(self):
+ """
+ See if the depsgraph evaluation is correct
+ """
+ self.do_visibility_object_add('CYLINDER')
+
+
+# ############################################################
+# 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()
diff --git a/tests/python/render_layer/test_evaluation_visibility_i.py b/tests/python/render_layer/test_evaluation_visibility_i.py
new file mode 100644
index 00000000000..5bc379e3a74
--- /dev/null
+++ b/tests/python/render_layer/test_evaluation_visibility_i.py
@@ -0,0 +1,36 @@
+# ############################################################
+# Importing - Same For All Render Layer Tests
+# ############################################################
+
+import unittest
+import os
+import sys
+
+sys.path.append(os.path.dirname(__file__))
+from render_layer_common import *
+
+
+# ############################################################
+# Testing
+# ############################################################
+
+class UnitTesting(RenderLayerTesting):
+ def test_visibility_torus(self):
+ """
+ See if the depsgraph evaluation is correct
+ """
+ self.do_visibility_object_add('TORUS')
+
+
+# ############################################################
+# 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()