[Bf-extensions-cvs] [0409b81f] master: Update for Depsgraph API changes

Philipp Oeser noreply at git.blender.org
Fri May 17 15:58:33 CEST 2019


Commit: 0409b81f45445c2934ad223e430ca7d8970ae5f0
Author: Philipp Oeser
Date:   Fri May 17 15:39:43 2019 +0200
Branches: master
https://developer.blender.org/rBAC0409b81f45445c2934ad223e430ca7d8970ae5f0

Update for Depsgraph API changes

Reviewers: sergey

Differential Revision: https://developer.blender.org/D4885

===================================================================

M	add_dimension.py
M	cmu_mocap_browser/makehuman.py
M	io_scene_fpx/fpx_import.py
M	io_scene_fpx/fpx_ui.py
M	np_station/np_point_array.py
M	np_station/np_point_copy.py
M	np_station/np_point_instance.py
M	np_station/np_shader_brush.py
M	space_view3d_enhanced_3d_cursor.py

===================================================================

diff --git a/add_dimension.py b/add_dimension.py
index bd8f78fb..b716584f 100644
--- a/add_dimension.py
+++ b/add_dimension.py
@@ -1472,7 +1472,7 @@ def setBezierHandles(obj, mode = 'VECTOR'):
     bpy.ops.curve.select_all(action = 'SELECT')
     bpy.ops.curve.handle_type_set(type = mode)
     bpy.ops.object.mode_set(mode = 'OBJECT', toggle = True)
-    bpy.context.scene.update()
+    view_layer.update()
 
 ##------------------------------------------------------------
 #### Add units
@@ -1767,13 +1767,13 @@ def createCurve(vertArray, self, align_matrix):
         const =  DimensionCurve.constraints.new(type='CHILD_OF')
         const.target =  bpy.data.objects[self.Dimension_parent]
         const.inverse_matrix = bpy.data.objects[self.Dimension_parent].matrix_world.inverted()
-        bpy.context.scene.update()
+        bpy.context.view_layer.update()
 
     bpy.ops.object.select_all(action='DESELECT')
     DimensionCurve.select_set(True)
     DimensionText.select_set(True)
     bpy.context.view_layer.objects.active = DimensionCurve
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
 
     DimensionCurve["Dimension_Name"] = self.Dimension_Name
     DimensionCurve["Dimension_Type"] = self.Dimension_Type
@@ -2063,12 +2063,12 @@ def main(self, align_matrix):
 #### Delete dimension group
 def DimensionDelete(self, context):
 
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
     bpy.ops.object.mode_set(mode = 'OBJECT')
 
     bpy.ops.object.select_grouped(extend=True, type='CHILDREN_RECURSIVE')
     bpy.ops.object.delete()
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
 
     return
 
@@ -2653,7 +2653,7 @@ class Dimension(bpy.types.Operator):
         #go to object mode
         if bpy.ops.object.mode_set.poll():
             bpy.ops.object.mode_set(mode = 'OBJECT')
-            bpy.context.scene.update()
+            bpy.context.view_layer.update()
 
         # turn off undo
         undo = bpy.context.preferences.edit.use_global_undo
@@ -2670,7 +2670,7 @@ class Dimension(bpy.types.Operator):
 
     ##### INVOKE #####
     def invoke(self, context, event):
-        bpy.context.scene.update()
+        bpy.context.view_layer.update()
         if self.Dimension_Change:
             bpy.context.scene.cursor.location = self.Dimension_startlocation
         else:
diff --git a/cmu_mocap_browser/makehuman.py b/cmu_mocap_browser/makehuman.py
index 381d5981..4110f72b 100644
--- a/cmu_mocap_browser/makehuman.py
+++ b/cmu_mocap_browser/makehuman.py
@@ -215,7 +215,7 @@ class CMUMocapTransferer(bpy.types.Operator):
             self.dst.pose.bones[db].matrix = S * self.inverses[db]
             self.dst.pose.bones[db].keyframe_insert('rotation_quaternion', -1, frame, db)
             self.dst.pose.bones[db].keyframe_insert('location', -1, frame, db)
-            bpy.context.scene.update()  # recalculate constraints
+            bpy.context.view_layer.update()  # recalculate constraints
         # get locrot of fk bones and locally set them
         # ... TODO
 #        bpy.ops.anim.keyframe_insert_menu(type='BUILTIN_KSI_LocRot')
diff --git a/io_scene_fpx/fpx_import.py b/io_scene_fpx/fpx_import.py
index e7212e34..409198c1 100644
--- a/io_scene_fpx/fpx_import.py
+++ b/io_scene_fpx/fpx_import.py
@@ -1419,7 +1419,7 @@ class FptImporter():
 
         blender_object.select_set(True)
         self.__view_layer.objects.active = blender_object
-        self.__scene.update()
+        self.__view_layer.update()
         if ops.object.convert.poll():
             ops.object.convert()
 
@@ -1649,7 +1649,7 @@ class FptImporter():
             cu.texspace_size = Vector((self.__table_width / 2.0, self.__table_length / 2.0, 0))
         else:
             cu.use_auto_texspace = False
-            self.__scene.update()
+            self.__view_layer.update()
             cu.texspace_location = Vector(obj.bound_box[0]) + (obj.dimensions / 2.0)
             cu.texspace_size = Vector(obj.dimensions / 2.0)
 
@@ -1819,7 +1819,7 @@ class FptImporter():
             cu.texspace_size = Vector((self.__table_width / 2.0, self.__table_length / 2.0, 0))
         else:
             cu.use_auto_texspace = False
-            self.__scene.update()
+            self.__view_layer.update()
             cu.texspace_location = Vector(obj.bound_box[0]) + (obj.dimensions / 2.0)
             cu.texspace_size = Vector(obj.dimensions / 2.0)
 
@@ -1873,14 +1873,14 @@ class FptImporter():
                 cu.texspace_size = Vector((self.__table_width / 2.0, self.__table_length / 2.0, 0))
             else:
                 cu.use_auto_texspace = False
-                self.__scene.update()
+                self.__view_layer.update()
                 cu.texspace_location = Vector(obj.bound_box[0]) + (obj.dimensions / 2.0)
                 cu.texspace_size = Vector(obj.dimensions / 2.0)
         else:
             self.append_texture_material(obj, DEFAULT_LAMP_TEXTURE, light_on=True)
             cu.use_auto_texspace = False
             #obj.update_from_editmode()
-            self.__scene.update()
+            self.__view_layer.update()
             cu.texspace_location = Vector(obj.bound_box[0]) + (obj.dimensions / 2.0)
             size = max(obj.dimensions)
             cu.texspace_size = (size, size, 0)
@@ -1919,14 +1919,14 @@ class FptImporter():
                 cu.texspace_size = Vector((self.__table_width / 2.0, self.__table_length / 2.0, 0))
             else:
                 cu.use_auto_texspace = False
-                self.__scene.update()
+                self.__view_layer.update()
                 cu.texspace_location = Vector(obj.bound_box[0]) + (obj.dimensions / 2.0)
                 cu.texspace_size = Vector(obj.dimensions / 2.0)
         else:
             self.append_texture_material(obj, DEFAULT_LAMP_TEXTURE, light_on=True)
             cu.use_auto_texspace = False
             #obj.update_from_editmode()
-            self.__scene.update()
+            self.__view_layer.update()
             cu.texspace_location = Vector(obj.bound_box[0]) + (obj.dimensions / 2.0)
             size = max(obj.dimensions)
             cu.texspace_size = (size, size, 0)
@@ -3159,7 +3159,7 @@ def adjust_position(blender_context, blender_scene, fpx_model, fpx_model_type=No
     if blender_location:
         blender_view_layer.objects.active = blender_parent
         blender_view_layer.objects.active.location = blender_location
-        blender_scene.update()
+        blender_view_layer.update()
 
 def remove_material(blender_context):
     if not blender_context.active_object:
diff --git a/io_scene_fpx/fpx_ui.py b/io_scene_fpx/fpx_ui.py
index 50e8a591..6fb63e17 100644
--- a/io_scene_fpx/fpx_ui.py
+++ b/io_scene_fpx/fpx_ui.py
@@ -391,7 +391,8 @@ class FpmImportOperator(Operator, ImportHelper):
 
         for scene in blender_context.blend_data.scenes:
             scene.layers = (True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)
-            scene.update()
+            for view_layer in scene.view_layers:
+                view_layer.update()
 
         return {"FINISHED"}
 
@@ -602,7 +603,8 @@ class FplImportOperator(Operator, ImportHelper):
 
         for scene in blender_context.blend_data.scenes:
             scene.layers = (True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)
-            scene.update()
+            for view_layer in scene.view_layers:
+                view_layer.update()
 
         return {"FINISHED"}
 
@@ -914,7 +916,8 @@ class FptImportOperator(Operator, ImportHelper):
 
         for scene in blender_context.blend_data.scenes:
             scene.layers = (True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)
-            scene.update()
+            for view_layer in scene.view_layers:
+                view_layer.update()
 
         return {"FINISHED"}
 
diff --git a/np_station/np_point_array.py b/np_station/np_point_array.py
index 8d12a3db..b708b643 100644
--- a/np_station/np_point_array.py
+++ b/np_station/np_point_array.py
@@ -740,7 +740,7 @@ class NPPAArrayTranslate(bpy.types.Operator):
                 ardict[ob][2] = count
             NP020PA.fit_type = ar.fit_type
             NP020PA.count = count
-            bpy.context.scene.update()
+            bpy.context.view_layer.update()
 
         elif event.ctrl and event.type == 'WHEELDOWNMOUSE' or event.type == 'DOWN_ARROW' and event.value == 'PRESS':
             for ob in arob:
@@ -761,7 +761,7 @@ class NPPAArrayTranslate(bpy.types.Operator):
                 ardict[ob][2] = count
             NP020PA.fit_type = ar.fit_type
             NP020PA.count = count
-            bpy.context.scene.update()
+            bpy.context.view_layer.update()
 
         elif event.type in ('RET', 'NUMPAD_ENTER') and event.value == 'PRESS':
             bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
diff --git a/np_station/np_point_copy.py b/np_station/np_point_copy.py
index 969c0ccf..b082ed02 100644
--- a/np_station/np_point_copy.py
+++ b/np_station/np_point_copy.py
@@ -819,7 +819,7 @@ class NPPCArrayTranslate(bpy.types.Operator):
                 ardict[ob][2] = count
             NP020PC.fit_type = ar.fit_type
             NP020PC.count = count
-            bpy.context.scene.update()
+            bpy.context.view_layer.update()
 
         elif event.ctrl and event.type == 'WHEELDOWNMOUSE' or event.type == 'DOWN_ARROW' and event.value == 'PRESS':
             for ob in arob:
@@ -840,7 +840,7 @@ class NPPCArrayTranslate(bpy.types.Operator):
                 ardict[ob][2] = count
             NP020PC.fit_type = ar.fit_type
             NP020PC.count = count
-            bpy.context.scene.update()
+            bpy.context.view_layer.update()
 
         elif event.type in ('RET', 'NUMPAD_ENTER') and event.value == 'PRESS':
             bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
diff --git a/np_station/np_point_instance.py b/np_station/np_point_instance.py
index 715b7540..cb4921ba 100644
--- a

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list