From 33e8db94b1e7df2bd7fdbf15b96368c8d16d3b4e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 4 Jun 2019 14:36:53 +0200 Subject: Fix (unreported) missing updates in scripts/docs after `scene.update()` removal. This should really have been done together with API changes, simple usage of grep does the trick to catch most places needing updates. --- tests/python/view_layer/test_background_set.py | 6 +++--- tests/python/view_layer/test_evaluation_selectability_a.py | 2 +- tests/python/view_layer/test_evaluation_selectability_b.py | 4 ++-- tests/python/view_layer/test_evaluation_selectability_c.py | 2 +- tests/python/view_layer/test_evaluation_selectability_d.py | 4 ++-- tests/python/view_layer/test_evaluation_selectability_e.py | 2 +- tests/python/view_layer/test_evaluation_selectability_f.py | 4 ++-- tests/python/view_layer/test_evaluation_visibility_a.py | 2 +- tests/python/view_layer/test_evaluation_visibility_b.py | 2 +- tests/python/view_layer/test_evaluation_visibility_c.py | 2 +- tests/python/view_layer/test_evaluation_visibility_d.py | 2 +- tests/python/view_layer/test_evaluation_visibility_e.py | 2 +- tests/python/view_layer/test_evaluation_visibility_f.py | 2 +- tests/python/view_layer/test_evaluation_visibility_j.py | 4 ++-- tests/python/view_layer/test_group_a.py | 2 +- tests/python/view_layer/test_group_b.py | 4 ++-- tests/python/view_layer/test_group_c.py | 4 ++-- tests/python/view_layer/test_group_e.py | 6 +++--- tests/python/view_layer/test_make_single_user.py | 2 +- tests/python/view_layer/test_scene_collection_delete.py | 2 +- tests/python/view_layer/test_scene_copy_f.py | 3 ++- tests/python/view_layer/view_layer_common.py | 7 +++---- 22 files changed, 35 insertions(+), 35 deletions(-) (limited to 'tests') diff --git a/tests/python/view_layer/test_background_set.py b/tests/python/view_layer/test_background_set.py index a26229d53a9..f522f425920 100644 --- a/tests/python/view_layer/test_background_set.py +++ b/tests/python/view_layer/test_background_set.py @@ -25,7 +25,7 @@ class UnitTesting(ViewLayerTesting): bpy.context.window.scene = main_scene # Update depsgraph. - main_scene.update() + bpy.context.view_layer.update() # Safety check, there should be no objects in thew newly created scene. self.assertEqual(0, len(bpy.context.depsgraph.objects)) @@ -35,7 +35,7 @@ class UnitTesting(ViewLayerTesting): background_scene.objects[0].parent = background_scene.objects[1] # Update depsgraph. - main_scene.update() + bpy.context.view_layer.update() # Test if objects were properly added to depsgraph. self.assertEqual(3, len(bpy.context.depsgraph.objects)) @@ -50,7 +50,7 @@ class UnitTesting(ViewLayerTesting): main_scene.background_set = None # Update depsgraph. - main_scene.update() + bpy.context.view_layer.update() self.assertEqual(0, len(bpy.context.depsgraph.objects)) diff --git a/tests/python/view_layer/test_evaluation_selectability_a.py b/tests/python/view_layer/test_evaluation_selectability_a.py index eaed40869c3..16ad38d1d7e 100644 --- a/tests/python/view_layer/test_evaluation_selectability_a.py +++ b/tests/python/view_layer/test_evaluation_selectability_a.py @@ -37,7 +37,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_kid = layer.collections.link(scene_collection_kid) layer_collection_mom.enabled = False - bpy.context.scene.update() # update depsgraph + bpy.context.view_layer.update() # update depsgraph cube.select_set(True) self.assertTrue(cube.visible_get(), "Cube should be visible") diff --git a/tests/python/view_layer/test_evaluation_selectability_b.py b/tests/python/view_layer/test_evaluation_selectability_b.py index 584011c672c..3828d2013ff 100644 --- a/tests/python/view_layer/test_evaluation_selectability_b.py +++ b/tests/python/view_layer/test_evaluation_selectability_b.py @@ -35,13 +35,13 @@ class UnitTesting(ViewLayerTesting): layer_collection_mom = layer.collections.link(scene_collection_mom) layer_collection_kid = layer.collections.link(scene_collection_kid) - bpy.context.scene.update() # update depsgraph + bpy.context.view_layer.update() # update depsgraph cube.select_set(True) layer_collection_mom.collections[layer_collection_kid.name].enabled = False layer_collection_kid.enabled = False - bpy.context.scene.update() # update depsgraph + bpy.context.view_layer.update() # update depsgraph self.assertFalse(cube.visible_get(), "Cube should be invisible") self.assertFalse(cube.select_get(), "Cube should be unselected") diff --git a/tests/python/view_layer/test_evaluation_selectability_c.py b/tests/python/view_layer/test_evaluation_selectability_c.py index 3eecaa06aeb..91c1c75c1f9 100644 --- a/tests/python/view_layer/test_evaluation_selectability_c.py +++ b/tests/python/view_layer/test_evaluation_selectability_c.py @@ -37,7 +37,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_kid = layer.collections.link(scene_collection_kid) layer_collection_mom.enabled = True - bpy.context.scene.update() # update depsgraph + layer.update() # update depsgraph cube.select_set(True) self.assertTrue(cube.visible_get(), "Cube should be visible") diff --git a/tests/python/view_layer/test_evaluation_selectability_d.py b/tests/python/view_layer/test_evaluation_selectability_d.py index c645551c5ed..bab3ad8c35a 100644 --- a/tests/python/view_layer/test_evaluation_selectability_d.py +++ b/tests/python/view_layer/test_evaluation_selectability_d.py @@ -37,12 +37,12 @@ class UnitTesting(ViewLayerTesting): layer_collection_kid = layer.collections.link(scene_collection_kid) layer_collection_mom.enabled = True - bpy.context.scene.update() # update depsgraph + bpy.context.view_layer.update() # update depsgraph cube.select_set(True) layer_collection_mom.collections[layer_collection_kid.name].selectable = False - bpy.context.scene.update() # update depsgraph + bpy.context.view_layer.update() # update depsgraph self.assertTrue(cube.visible_get(), "Cube should be visible") self.assertTrue(cube.select_get(), "Cube should be selected") diff --git a/tests/python/view_layer/test_evaluation_selectability_e.py b/tests/python/view_layer/test_evaluation_selectability_e.py index e2f0e911bbe..ff75bdcddfe 100644 --- a/tests/python/view_layer/test_evaluation_selectability_e.py +++ b/tests/python/view_layer/test_evaluation_selectability_e.py @@ -41,7 +41,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_mom.collections[layer_collection_kid.name].selectable = False layer_collection_kid.enabled = False - bpy.context.scene.update() # update depsgraph + layer.update() # update depsgraph self.assertTrue(cube.visible_get(), "Cube should be visible") self.assertFalse(cube.select_get(), "Cube should be unselected") diff --git a/tests/python/view_layer/test_evaluation_selectability_f.py b/tests/python/view_layer/test_evaluation_selectability_f.py index a902dd1dada..16aa86a0c2a 100644 --- a/tests/python/view_layer/test_evaluation_selectability_f.py +++ b/tests/python/view_layer/test_evaluation_selectability_f.py @@ -23,14 +23,14 @@ class UnitTesting(ViewLayerTesting): scene_collection = scene.master_collection.collections.new('collection') layer_collection = view_layer.collections.link(scene_collection) - bpy.context.scene.update() # update depsgraph + view_layer.update() # update depsgraph scene_collection.objects.link(cube) self.assertTrue(layer_collection.enabled) self.assertTrue(layer_collection.selectable) - bpy.context.scene.update() # update depsgraph + view_layer.update() # update depsgraph cube.select_set(True) self.assertTrue(cube.select_get()) diff --git a/tests/python/view_layer/test_evaluation_visibility_a.py b/tests/python/view_layer/test_evaluation_visibility_a.py index 666513fa85a..13c05c28744 100644 --- a/tests/python/view_layer/test_evaluation_visibility_a.py +++ b/tests/python/view_layer/test_evaluation_visibility_a.py @@ -40,7 +40,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_mom.enabled = False layer_collection_kid.enabled = True - bpy.context.scene.update() # update depsgraph + layer.update() # update depsgraph self.assertTrue(cube.visible_get(), "Object should be visible") diff --git a/tests/python/view_layer/test_evaluation_visibility_b.py b/tests/python/view_layer/test_evaluation_visibility_b.py index c24b7a73dab..88bf0808d1f 100644 --- a/tests/python/view_layer/test_evaluation_visibility_b.py +++ b/tests/python/view_layer/test_evaluation_visibility_b.py @@ -40,7 +40,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_mom.collections[layer_collection_kid.name].enabled = False layer_collection_kid.enabled = False - bpy.context.scene.update() # update depsgraph + layer.update() # update depsgraph self.assertFalse(cube.visible_get(), "Object should be invisible") diff --git a/tests/python/view_layer/test_evaluation_visibility_c.py b/tests/python/view_layer/test_evaluation_visibility_c.py index 5a8c6386265..e337a22e561 100644 --- a/tests/python/view_layer/test_evaluation_visibility_c.py +++ b/tests/python/view_layer/test_evaluation_visibility_c.py @@ -40,7 +40,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_mom.collections[layer_collection_kid.name].enabled = False layer_collection_kid.enabled = True - bpy.context.scene.update() # update depsgraph + layer.update() # update depsgraph self.assertTrue(cube.visible_get(), "Object should be visible") diff --git a/tests/python/view_layer/test_evaluation_visibility_d.py b/tests/python/view_layer/test_evaluation_visibility_d.py index 6a5f660edde..66145dd3048 100644 --- a/tests/python/view_layer/test_evaluation_visibility_d.py +++ b/tests/python/view_layer/test_evaluation_visibility_d.py @@ -37,7 +37,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_kid = layer.collections.link(scene_collection_kid) layer_collection_mom.enabled = True - bpy.context.scene.update() # update depsgraph + layer.update() # update depsgraph self.assertTrue(cube.visible_get(), "Object should be visible") diff --git a/tests/python/view_layer/test_evaluation_visibility_e.py b/tests/python/view_layer/test_evaluation_visibility_e.py index 16e08cfaba7..3c3ccb61d5c 100644 --- a/tests/python/view_layer/test_evaluation_visibility_e.py +++ b/tests/python/view_layer/test_evaluation_visibility_e.py @@ -40,7 +40,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_mom.enabled = True layer_collection_kid.enabled = False - bpy.context.scene.update() # update depsgraph + layer.update() # update depsgraph self.assertTrue(cube.visible_get(), "Object should be visible") diff --git a/tests/python/view_layer/test_evaluation_visibility_f.py b/tests/python/view_layer/test_evaluation_visibility_f.py index cf886786c5e..a4b9df1ab8c 100644 --- a/tests/python/view_layer/test_evaluation_visibility_f.py +++ b/tests/python/view_layer/test_evaluation_visibility_f.py @@ -41,7 +41,7 @@ class UnitTesting(ViewLayerTesting): layer_collection_mom.collections[layer_collection_kid.name].enabled = False layer_collection_kid.enabled = False - bpy.context.scene.update() # update depsgraph + layer.update() # update depsgraph self.assertTrue(cube.visible_get(), "Object should be visible") diff --git a/tests/python/view_layer/test_evaluation_visibility_j.py b/tests/python/view_layer/test_evaluation_visibility_j.py index 53810fe5599..d46da80ec08 100644 --- a/tests/python/view_layer/test_evaluation_visibility_j.py +++ b/tests/python/view_layer/test_evaluation_visibility_j.py @@ -39,7 +39,7 @@ class UnitTesting(ViewLayerTesting): self.assertTrue(layer_collection.enabled) # Update depsgraph. - scene.update() + bpy.context.view_layer.update() self.assertTrue(ob.visible_get()) @@ -47,7 +47,7 @@ class UnitTesting(ViewLayerTesting): self.assertFalse(layer_collection.enabled) # Update depsgraph. - scene.update() + bpy.context.view_layer.update() self.assertFalse(ob.visible_get()) diff --git a/tests/python/view_layer/test_group_a.py b/tests/python/view_layer/test_group_a.py index 6e1b83efbe5..47511d78be7 100644 --- a/tests/python/view_layer/test_group_a.py +++ b/tests/python/view_layer/test_group_a.py @@ -34,7 +34,7 @@ class UnitTesting(ViewLayerTesting): group = layer_collection.create_group() # update depsgraph - scene.update() + bpy.context.view_layer.update() # ############################################################ diff --git a/tests/python/view_layer/test_group_b.py b/tests/python/view_layer/test_group_b.py index 5d3a03b129b..ca99eb832e0 100644 --- a/tests/python/view_layer/test_group_b.py +++ b/tests/python/view_layer/test_group_b.py @@ -41,13 +41,13 @@ class UnitTesting(ViewLayerTesting): mom_layer_collection.selectable = True # update depsgraph - scene.update() + bpy.context.view_layer.update() # create group group = grandma_layer_collection.create_group() # update depsgraph - scene.update() + bpy.context.view_layer.update() # compare self.assertEqual(len(group.view_layer.collections), 1) diff --git a/tests/python/view_layer/test_group_c.py b/tests/python/view_layer/test_group_c.py index 69feab1a56e..5b477b86224 100644 --- a/tests/python/view_layer/test_group_c.py +++ b/tests/python/view_layer/test_group_c.py @@ -38,13 +38,13 @@ class UnitTesting(ViewLayerTesting): mom_layer_collection = grandma_layer_collection.collections[mom_scene_collection.name] # update depsgraph - scene.update() + bpy.context.view_layer.update() # create group group = mom_layer_collection.create_group() # update depsgraph - scene.update() + bpy.context.view_layer.update() # ############################################################ diff --git a/tests/python/view_layer/test_group_e.py b/tests/python/view_layer/test_group_e.py index 7385d94f1f4..09d94b33347 100644 --- a/tests/python/view_layer/test_group_e.py +++ b/tests/python/view_layer/test_group_e.py @@ -31,14 +31,14 @@ class UnitTesting(ViewLayerTesting): scene.view_layers.remove(v) # update depsgraph - scene.update() + view_layer.update() # create group group = bpy.data.groups.new("Switch") group.objects.link(ob) # update depsgraph - scene.update() + view_layer.update() # instance the group empty = bpy.data.objects.new("Empty", None) @@ -57,7 +57,7 @@ class UnitTesting(ViewLayerTesting): self.assertFalse(empty.select_get()) # update depsgraph - scene.update() + view_layer.update() # delete the original object bpy.ops.object.delete() diff --git a/tests/python/view_layer/test_make_single_user.py b/tests/python/view_layer/test_make_single_user.py index 973c191f22d..38bd524a82d 100644 --- a/tests/python/view_layer/test_make_single_user.py +++ b/tests/python/view_layer/test_make_single_user.py @@ -39,7 +39,7 @@ class UnitTesting(ViewLayerTesting): ob.select_set(True) # update depsgraph - scene.update() + view_layer.update() # test itself bpy.ops.object.make_single_user(object=True) diff --git a/tests/python/view_layer/test_scene_collection_delete.py b/tests/python/view_layer/test_scene_collection_delete.py index 58893810545..96ae122af8c 100644 --- a/tests/python/view_layer/test_scene_collection_delete.py +++ b/tests/python/view_layer/test_scene_collection_delete.py @@ -37,7 +37,7 @@ class UnitTesting(ViewLayerTesting): master_collection.collections.remove(collection_parent) # Update depsgraph. - scene.update() + bpy.context.view_layer.update() # ############################################################ diff --git a/tests/python/view_layer/test_scene_copy_f.py b/tests/python/view_layer/test_scene_copy_f.py index 13586a66f3d..6ea3058adc5 100644 --- a/tests/python/view_layer/test_scene_copy_f.py +++ b/tests/python/view_layer/test_scene_copy_f.py @@ -63,7 +63,8 @@ class UnitTesting(ViewLayerTesting): self.assertNotEqual(scene, new_scene) # update depsgrah - scene.update() # update depsgraph + for view_layer in scene.view_layers: + view_layer.update() # update depsgraph # compare scenes for h, layer in enumerate(scene.view_layers): diff --git a/tests/python/view_layer/view_layer_common.py b/tests/python/view_layer/view_layer_common.py index 709ef4afbfe..d570298f4a2 100644 --- a/tests/python/view_layer/view_layer_common.py +++ b/tests/python/view_layer/view_layer_common.py @@ -414,7 +414,7 @@ class ViewLayerTesting(unittest.TestCase): bpy.data.objects.remove(ob, do_unlink=True) elif del_mode == 'OPERATOR': - bpy.context.scene.update() # update depsgraph + bpy.context.view_layer.update() # update depsgraph bpy.ops.object.select_all(action='DESELECT') ob.select_set(True) self.assertTrue(ob.select_get()) @@ -455,7 +455,7 @@ class ViewLayerTesting(unittest.TestCase): scene_collection = scene.master_collection.collections.new("Collection") layer.collections.link(scene_collection) - bpy.context.scene.update() # update depsgraph + bpy.context.view_layer.update() # update depsgraph self.assertEqual(len(bpy.data.objects), 0) @@ -728,7 +728,7 @@ class Clay: self._object = bpy.data.objects.new('guinea pig', bpy.data.meshes.new('mesh')) # update depsgraph - self._scene.update() + self._layer.update() scene_collection_grandma = self._scene.master_collection.collections.new("Grandma") scene_collection_mom = scene_collection_grandma.collections.new("Mom") @@ -787,7 +787,6 @@ class Clay: """ ENGINE = 'BLENDER_CLAY' - self._scene.update() # update depsgraph self._layer.update() # flush depsgraph evaluation # change scene settings -- cgit v1.2.3