updated sorting algorithm for lods

This commit is contained in:
Zachary Pavlov 2008-11-18 21:03:06 +00:00
parent da5afd76e7
commit fdc9d8fd53

View File

@ -554,6 +554,16 @@ class Actor(DirectObject, NodePath):
def __updateSortedLODNames(self):
# Cache the sorted LOD names so we dont have to grab them
# and sort them every time somebody asks for the list
if(self.__hasLOD):
lodnode = self.__LODNode.node()
switchRange = range(lodnode.getNumSwitches())
switchList = [lodnode.getIn(x) for x in switchRange]
nameList = [self.__LODNode.getChild(x).getName() for x in switchRange]
sortedList = zip(switchList, nameList)
sortedList.sort()
self.__sortedLODNames = [x[1] for x in sortedList]
return
self.__sortedLODNames = self.__partBundleDict.keys()
# Reverse sort the doing a string->int
def sortFunc(x, y):