diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-15 10:05:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-15 10:05:02 +0300 |
commit | ca7f826c6f1812d38cd3a6985b5fc8de6e9de78c (patch) | |
tree | 878cdf3252cf23c3ef519aaf98e4a4a8d6770724 /release | |
parent | b8b8669b282da70f4db2a89203adee014a98b204 (diff) | |
parent | 58ba89b5bec5a2b7b74ef93fe18f0a3811cb48db (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/object_align.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py index 8669c2ddbd6..03b0d4f04a2 100644 --- a/release/scripts/startup/bl_operators/object_align.py +++ b/release/scripts/startup/bl_operators/object_align.py @@ -24,7 +24,7 @@ from bpy.types import Operator from mathutils import Vector -def GlobalBB_LQ(bb_world): +def worldspace_bounds_from_object_bounds(bb_world): # Initialize the variables with the 8th vertex left, right, front, back, down, up = ( @@ -66,7 +66,7 @@ def GlobalBB_LQ(bb_world): return (Vector((left, front, up)), Vector((right, back, down))) -def GlobalBB_HQ(scene, obj): +def worldspace_bounds_from_object_data(scene, obj): matrix_world = obj.matrix_world.copy() @@ -75,20 +75,20 @@ def GlobalBB_HQ(scene, obj): me = obj.to_mesh(scene=scene, apply_modifiers=True, settings='PREVIEW') verts = me.vertices - val = matrix_world * verts[-1].co + val = matrix_world * (verts[-1].co if verts else Vector((0.0, 0.0, 0.0))) - left, right, front, back, down, up = (val[0], - val[0], - val[1], - val[1], - val[2], - val[2], - ) + left, right, front, back, down, up = ( + val[0], + val[0], + val[1], + val[1], + val[2], + val[2], + ) # Test against all other verts - for i in range(len(verts) - 1): - - vco = matrix_world * verts[i].co + for v in verts: + vco = matrix_world * v.co # X Range val = vco[0] @@ -155,9 +155,9 @@ def align_objects(context, for obj, bb_world in objects: if bb_quality and obj.type == 'MESH': - GBB = GlobalBB_HQ(scene, obj) + GBB = worldspace_bounds_from_object_data(scene, obj) else: - GBB = GlobalBB_LQ(bb_world) + GBB = worldspace_bounds_from_object_bounds(bb_world) Left_Front_Up = GBB[0] Right_Back_Down = GBB[1] @@ -219,9 +219,9 @@ def align_objects(context, bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box] if bb_quality and obj.type == 'MESH': - GBB = GlobalBB_HQ(scene, obj) + GBB = worldspace_bounds_from_object_data(scene, obj) else: - GBB = GlobalBB_LQ(bb_world) + GBB = worldspace_bounds_from_object_bounds(bb_world) Left_Front_Up = GBB[0] Right_Back_Down = GBB[1] |