David Rose преди 24 години
родител
ревизия
4f4939dd81
променени са 1 файла, в които са добавени 14 реда и са изтрити 8 реда
  1. 14 8
      direct/src/showbase/Loader.py

+ 14 - 8
direct/src/showbase/Loader.py

@@ -59,22 +59,28 @@ class Loader:
             nodePath = None
             nodePath = None
         return nodePath
         return nodePath
 
 
-    def loadModelOnceUnder(self, modelPath, nodeName):
-        """loadModelOnceUnder(self, string, string)
+    def loadModelOnceUnder(self, modelPath, underNode):
+        """loadModelOnceUnder(self, string, string | node | NodePath)
         Behaves like loadModelOnce, but also implicitly creates a new
         Behaves like loadModelOnce, but also implicitly creates a new
         node to attach the model under, which helps to differentiate
         node to attach the model under, which helps to differentiate
-        different instances.  This is useful when you want to load a
-        model once several times before parenting each instance
-        somewhere, or when you want to load a model and immediately
-        set a transform on it.  But also consider loadModelCopy().
+        different instances.
+
+        underNode may be either a node name, or a NodePath or a Node
+        to an already-existing node.
+
+        This is useful when you want to load a model once several
+        times before parenting each instance somewhere, or when you
+        want to load a model and immediately set a transform on it.
+        But also consider loadModelCopy().
+        
         """
         """
 
 
-        Loader.notify.debug("Loading model once: %s under %s" % (modelPath, nodeName))
+        Loader.notify.debug("Loading model once: %s under %s" % (modelPath, underNode))
         if phaseChecker:
         if phaseChecker:
             phaseChecker(modelPath)
             phaseChecker(modelPath)
         node = ModelPool.loadModel(modelPath)
         node = ModelPool.loadModel(modelPath)
         if (node != None):
         if (node != None):
-            nodePath = NodePath(nodeName)
+            nodePath = NodePath(underNode)
             nodePath.attachNewNode(node)
             nodePath.attachNewNode(node)
         else:
         else:
             nodePath = None
             nodePath = None