From 0d3349bac0d03ea1a0836dc068340885ed908e7e Mon Sep 17 00:00:00 2001 From: "Asad M. Zaman" Date: Fri, 14 Nov 2008 04:18:48 +0000 Subject: [PATCH] use the already sortedLODNames instead of sorting everytime --- direct/src/actor/Actor.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index 1c2100646b..8cad60dad9 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -635,14 +635,16 @@ class Actor(DirectObject, NodePath): """ # make sure we don't call this twice in a row # and pollute the the switches dictionary - sortedKeys = self.switches.keys() - sortedKeys.sort() - index = sortedKeys.index(lodName) +## sortedKeys = self.switches.keys() +## sortedKeys.sort() + sortedKeys = self.__sortedLODNames + index = sortedKeys.index(str(lodName)) self.__LODNode.node().forceSwitch(index) def printLOD(self): - sortedKeys = self.switches.keys() - sortedKeys.sort() +## sortedKeys = self.switches.keys() +## sortedKeys.sort() + sortedKeys = self.__sortedLODNames for eachLod in sortedKeys: print "python switches for %s: in: %d, out %d" % (eachLod, self.switches[eachLod][0], @@ -686,9 +688,10 @@ class Actor(DirectObject, NodePath): # save the switch distance info self.switches[lodName] = [inDist, outDist] # add the switch distance info - sortedKeys = self.switches.keys() - sortedKeys.sort() - index = sortedKeys.index(lodName) +## sortedKeys = self.switches.keys() +## sortedKeys.sort() + sortedKeys = self.__sortedLODNames + index = sortedKeys.index(str(lodName)) self.__LODNode.node().setSwitch(index, inDist, outDist) def getLOD(self, lodName):