[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.
example:
cubes=[[cube.001],[cube.002],[cube.003],[cube.004],[cube.005]]
# 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:
buffer=[]
for a in cubes:
buffer.append(a.LocZ)
buffer.sort()
# 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.