Browse Source

Added ability to use 'high', 'med', 'low' as lodNames

Josh Wilson 20 years ago
parent
commit
9699ba9508
1 changed files with 11 additions and 2 deletions
  1. 11 2
      direct/src/actor/Actor.py

+ 11 - 2
direct/src/actor/Actor.py

@@ -320,8 +320,17 @@ class Actor(PandaObject, NodePath):
         # and sort them every time somebody asks for the list
         # and sort them every time somebody asks for the list
         self.__sortedLODNames = self.__partBundleDict.keys()
         self.__sortedLODNames = self.__partBundleDict.keys()
         # Reverse sort the doing a string->int
         # Reverse sort the doing a string->int
-        self.__sortedLODNames.sort(lambda x,y : cmp(int(y), int(x)))
-        
+        def sortFunc(x,y):
+            if isinstance(x,str):
+                smap = {'h':2,
+                        'm':1,
+                        'l':0}
+                return cmp(smap[y[0]],smap[x[0]])
+            else:
+                return cmp (int(y),int(x))
+                
+        self.__sortedLODNames.sort(sortFunc)
+
     def getLODNames(self):
     def getLODNames(self):
         """
         """
         Return list of Actor LOD names. If not an LOD actor,
         Return list of Actor LOD names. If not an LOD actor,