소스 검색

updated sorting algorithm for lods

Zachary Pavlov 17 년 전
부모
커밋
fdc9d8fd53
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      direct/src/actor/Actor.py

+ 10 - 0
direct/src/actor/Actor.py

@@ -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):