re-commit temp workaround [#35920], this still fails for OSX retina display,
[blender-staging.git] / release / scripts / startup / bl_operators / object_align.py
index dd052c36ade46e9ea483bfd8af3b60666c1345be..e843209da3cd76d5a707ea7364632b9a724e26ac 100644 (file)
@@ -114,31 +114,32 @@ def GlobalBB_HQ(obj):
     return Vector((left, front, up)), Vector((right, back, down))
 
 
     return Vector((left, front, up)), Vector((right, back, down))
 
 
-def align_objects(align_x,
+def align_objects(context,
+                  align_x,
                   align_y,
                   align_z,
                   align_mode,
                   relative_to,
                   bb_quality):
 
                   align_y,
                   align_z,
                   align_mode,
                   relative_to,
                   bb_quality):
 
-    cursor = bpy.context.scene.cursor_location
+    cursor = context.scene.cursor_location
 
     Left_Front_Up_SEL = [0.0, 0.0, 0.0]
     Right_Back_Down_SEL = [0.0, 0.0, 0.0]
 
     flag_first = True
 
 
     Left_Front_Up_SEL = [0.0, 0.0, 0.0]
     Right_Back_Down_SEL = [0.0, 0.0, 0.0]
 
     flag_first = True
 
-    objs = []
+    objects = []
 
 
-    for obj in bpy.context.selected_objects:
+    for obj in context.selected_objects:
         matrix_world = obj.matrix_world.copy()
         bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
         matrix_world = obj.matrix_world.copy()
         bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
-        objs.append((obj, bb_world))
+        objects.append((obj, bb_world))
 
 
-    if not objs:
+    if not objects:
         return False
 
         return False
 
-    for obj, bb_world in objs:
+    for obj, bb_world in objects:
 
         if bb_quality and obj.type == 'MESH':
             GBB = GlobalBB_HQ(obj)
 
         if bb_quality and obj.type == 'MESH':
             GBB = GlobalBB_HQ(obj)
@@ -150,7 +151,7 @@ def align_objects(align_x,
 
         # Active Center
 
 
         # Active Center
 
-        if obj == bpy.context.active_object:
+        if obj == context.active_object:
 
             center_active_x = (Left_Front_Up[0] + Right_Back_Down[0]) / 2.0
             center_active_y = (Left_Front_Up[1] + Right_Back_Down[1]) / 2.0
 
             center_active_x = (Left_Front_Up[0] + Right_Back_Down[0]) / 2.0
             center_active_y = (Left_Front_Up[1] + Right_Back_Down[1]) / 2.0
@@ -200,7 +201,7 @@ def align_objects(align_x,
 
     # Main Loop
 
 
     # Main Loop
 
-    for obj, bb_world in objs:
+    for obj, bb_world in objects:
         matrix_world = obj.matrix_world.copy()
         bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
 
         matrix_world = obj.matrix_world.copy()
         bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
 
@@ -341,7 +342,7 @@ from bpy.props import EnumProperty, BoolProperty
 
 
 class AlignObjects(Operator):
 
 
 class AlignObjects(Operator):
-    '''Align Objects'''
+    """Align Objects"""
     bl_idname = "object.align"
     bl_label = "Align Objects"
     bl_options = {'REGISTER', 'UNDO'}
     bl_idname = "object.align"
     bl_label = "Align Objects"
     bl_options = {'REGISTER', 'UNDO'}
@@ -386,7 +387,8 @@ class AlignObjects(Operator):
 
     def execute(self, context):
         align_axis = self.align_axis
 
     def execute(self, context):
         align_axis = self.align_axis
-        ret = align_objects('X' in align_axis,
+        ret = align_objects(context,
+                            'X' in align_axis,
                             'Y' in align_axis,
                             'Z' in align_axis,
                             self.align_mode,
                             'Y' in align_axis,
                             'Z' in align_axis,
                             self.align_mode,