[Tutor] sorting objects with embedded data

michaelbaker@operamail.com michaelbaker@operamail.com
Tue, 15 Aug 2000 10:36:07 -0700

I'm using python with blender (http://www.blender.nl) - an amazing freeware
3d modeling and animation package. I'm trying to sort a bunch of objects
based on their positions in the Z axis direction. 



# each cube object contains coordinate data accessible through 3 
# methods? LocX, LocY, LocZ - these correspond to the x, y and 
# z axes respectively. Here's what I've got:


for a in cubes:


# this returns a sorted list of z coordinate values - great, but I 
# need to access the x and y coordinate data based on the sorted z 
# data - now I need to sort the cubes list based on the sorting 
# of the buffer list. 

# Is it possible to sort the cubes list in-place based on the 
# embedded LocZ numerical data? 

thanks in advance - check out blender, it's amazing.