Fix T57892: Align Objects in Blender 2.8 Alpha 2 last Builds.

Needed some update for API changes...
This commit is contained in:
Bastien Montagne 2018-11-20 22:14:00 +01:00
parent b7ee0912a7
commit fb4c2ed1a9
Notes: blender-bot 2023-02-14 10:09:24 +01:00
Referenced by issue #57892, Align Objects in Blender 2.8 Alpha 2 last Builds
1 changed files with 5 additions and 4 deletions

View File

@ -66,13 +66,13 @@ def worldspace_bounds_from_object_bounds(bb_world):
return (Vector((left, front, up)), Vector((right, back, down)))
def worldspace_bounds_from_object_data(scene, obj):
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(scene=scene, apply_modifiers=True, settings='PREVIEW')
me = obj.to_mesh(depsgraph=depsgraph, apply_modifiers=True)
verts = me.vertices
val = matrix_world @ (verts[-1].co if verts else Vector((0.0, 0.0, 0.0)))
@ -127,6 +127,7 @@ def align_objects(context,
relative_to,
bb_quality):
depsgraph = context.depsgraph
scene = context.scene
space = context.space_data
@ -155,7 +156,7 @@ def align_objects(context,
for obj, bb_world in objects:
if bb_quality and obj.type == 'MESH':
GBB = worldspace_bounds_from_object_data(scene, obj)
GBB = worldspace_bounds_from_object_data(depsgraph, obj)
else:
GBB = worldspace_bounds_from_object_bounds(bb_world)
@ -219,7 +220,7 @@ def align_objects(context,
bb_world = [matrix_world @ Vector(v[:]) for v in obj.bound_box]
if bb_quality and obj.type == 'MESH':
GBB = worldspace_bounds_from_object_data(scene, obj)
GBB = worldspace_bounds_from_object_data(depsgraph, obj)
else:
GBB = worldspace_bounds_from_object_bounds(bb_world)