3D Pie menu: Support pivotbottom for selected objects #105105
@ -59,19 +59,20 @@ class PIE_OT_PivotBottom(Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
|
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
|
||||||
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
|
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
|
||||||
o = context.active_object
|
|
||||||
init = 0
|
init = 0
|
||||||
|
|||||||
for x in o.data.vertices:
|
for ob in context.selected_objects:
|
||||||
if init == 0:
|
for x in ob.data.vertices:
|
||||||
a = x.co.z
|
if init == 0:
|
||||||
init = 1
|
a = x.co.z
|
||||||
elif x.co.z < a:
|
init = 1
|
||||||
a = x.co.z
|
elif x.co.z < a:
|
||||||
|
a = x.co.z
|
||||||
|
|
||||||
for x in o.data.vertices:
|
for x in ob.data.vertices:
|
||||||
x.co.z -= a
|
x.co.z -= a
|
||||||
|
|
||||||
o.location.z += a
|
ob.location.z += a
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user
init = 0 needs to move into the objects loop