Преглед изворни кода

allow passing in an LODNode to the constructor

David Rose пре 19 година
родитељ
комит
5d9ded7299
1 измењених фајлова са 7 додато и 7 уклоњено
  1. 7 7
      direct/src/actor/Actor.py

+ 7 - 7
direct/src/actor/Actor.py

@@ -22,7 +22,8 @@ class Actor(DirectObject, NodePath):
                                        LoaderOptions.LFReportErrors |
                                        LoaderOptions.LFReportErrors |
                                        LoaderOptions.LFConvertAnim)
                                        LoaderOptions.LFConvertAnim)
 
 
-    def __init__(self, models=None, anims=None, other=None, copy=1):
+    def __init__(self, models=None, anims=None, other=None, copy=1,
+                 lodNode = None):
         """__init__(self, string | string:string{}, string:string{} |
         """__init__(self, string | string:string{}, string:string{} |
         string:(string:string{}){}, Actor=None)
         string:(string:string{}){}, Actor=None)
         Actor constructor: can be used to create single or multipart
         Actor constructor: can be used to create single or multipart
@@ -129,7 +130,7 @@ class Actor(DirectObject, NodePath):
                     # if this is a dictionary of dictionaries
                     # if this is a dictionary of dictionaries
                     if (type(models[models.keys()[0]]) == type({})):
                     if (type(models[models.keys()[0]]) == type({})):
                         # then it must be a multipart actor w/LOD
                         # then it must be a multipart actor w/LOD
-                        self.setLODNode()
+                        self.setLODNode(node = lodNode)
                         # preserve numerical order for lod's
                         # preserve numerical order for lod's
                         # this will make it easier to set ranges
                         # this will make it easier to set ranges
                         sortedKeys = models.keys()
                         sortedKeys = models.keys()
@@ -150,7 +151,7 @@ class Actor(DirectObject, NodePath):
                             self.loadModel(models[partName], partName, copy = copy)
                             self.loadModel(models[partName], partName, copy = copy)
                     else:
                     else:
                         # it is a single part actor w/LOD
                         # it is a single part actor w/LOD
-                        self.setLODNode()
+                        self.setLODNode(node = lodNode)
                         # preserve order of LOD's
                         # preserve order of LOD's
                         sortedKeys = models.keys()
                         sortedKeys = models.keys()
                         sortedKeys.sort()
                         sortedKeys.sort()
@@ -461,10 +462,9 @@ class Actor(DirectObject, NodePath):
         If one is not supplied as an argument, make one
         If one is not supplied as an argument, make one
         """
         """
         if (node == None):
         if (node == None):
-            lod = LODNode("lod")
-            self.__LODNode = self.__geomNode.attachNewNode(lod)
-        else:
-            self.__LODNode = self.__geomNode.attachNewNode(node)
+            node = LODNode("lod")
+
+        self.__LODNode = self.__geomNode.attachNewNode(node)
         self.__hasLOD = 1
         self.__hasLOD = 1
         self.switches = {}
         self.switches = {}