[Bf-blender-cvs] [77f92b8cb73] master: Update for Depsgraph API changes

Philipp Oeser noreply at git.blender.org
Fri May 17 12:41:39 CEST 2019


Commit: 77f92b8cb73c0d46838749aae7836c60cff09db9
Author: Philipp Oeser
Date:   Fri May 17 11:51:38 2019 +0200
Branches: master
https://developer.blender.org/rB77f92b8cb73c0d46838749aae7836c60cff09db9

Update for Depsgraph API changes

Reviewers: sergey

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

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

M	release/scripts/modules/bpy_extras/object_utils.py
M	release/scripts/startup/bl_operators/object_align.py

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

diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index 3a751a7b907..749b6eb111c 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -141,7 +141,7 @@ def object_data_add(context, obdata, operator=None, name=None):
         bpy.ops.object.mode_set(mode='OBJECT')
 
         obj_act.select_set(True)
-        scene.update()  # apply location
+        layer.update()  # apply location
         # layer.objects.active = obj_new
 
         # Match up UV layers, this is needed so adding an object with UV's
diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py
index b18f49e614c..f5053701cce 100644
--- a/release/scripts/startup/bl_operators/object_align.py
+++ b/release/scripts/startup/bl_operators/object_align.py
@@ -71,8 +71,8 @@ def worldspace_bounds_from_object_data(depsgraph, obj):
     matrix_world = obj.matrix_world.copy()
 
     # Initialize the variables with the last vertex
-
-    me = obj.to_mesh(depsgraph=depsgraph, apply_modifiers=True)
+    ob_eval = obj.evaluated_get(depsgraph)
+    me = ob_eval.to_mesh()
     verts = me.vertices
 
     val = matrix_world @ (verts[-1].co if verts else Vector((0.0, 0.0, 0.0)))
@@ -114,7 +114,7 @@ def worldspace_bounds_from_object_data(depsgraph, obj):
         if val > up:
             up = val
 
-    bpy.data.meshes.remove(me)
+    ob_eval.to_mesh_clear()
 
     return Vector((left, front, up)), Vector((right, back, down))
 
@@ -127,7 +127,7 @@ def align_objects(context,
                   relative_to,
                   bb_quality):
 
-    depsgraph = context.depsgraph
+    depsgraph = context.evaluated_depsgraph_get()
     scene = context.scene
 
     cursor = scene.cursor.location
@@ -135,7 +135,7 @@ def align_objects(context,
     # We are accessing runtime data such as evaluated bounding box, so we need to
     # be sure it is properly updated and valid (bounding box might be lost on operator
     # redo).
-    scene.update()
+    context.view_layer.update()
 
     Left_Front_Up_SEL = [0.0, 0.0, 0.0]
     Right_Back_Down_SEL = [0.0, 0.0, 0.0]



More information about the Bf-blender-cvs mailing list