diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-05-17 12:51:38 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-05-17 13:38:05 +0300 |
commit | 77f92b8cb73c0d46838749aae7836c60cff09db9 (patch) | |
tree | 8e6dffaddb57a3d20b1f9e5f84f92115bcf4944e | |
parent | 39a29d843e6b58a873abf6555fad06c55c336cae (diff) |
Update for Depsgraph API changes
Reviewers: sergey
Differential Revision: https://developer.blender.org/D4881
-rw-r--r-- | release/scripts/modules/bpy_extras/object_utils.py | 2 | ||||
-rw-r--r-- | release/scripts/startup/bl_operators/object_align.py | 10 |
2 files changed, 6 insertions, 6 deletions
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] |