[Tutor] sorting objects with embedded data
Tue, 15 Aug 2000 12:27:54 -0700 (PDT)
On Tue, 15 Aug 2000 email@example.com wrote:
> 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.
An easy way to do this is to tell the sort() specifically how to compare
two items based on LocZ. sort() can take in an optional parameter that
allows you to redefine the sorting order. Here's a sample comparison
def cmpLocZ(cube1, cube2):
return cmp(cube1.LocZ, cube2.LocZ)
Once you have something like this, you can pass this off to the sorting
and things should work well.