소스 검색

support creating actors with node paths

David Rose 23 년 전
부모
커밋
daa73b4c9c
1개의 변경된 파일12개의 추가작업 그리고 4개의 파일을 삭제
  1. 12 4
      direct/src/actor/Actor.py

+ 12 - 4
direct/src/actor/Actor.py

@@ -1086,11 +1086,19 @@ class Actor(PandaObject, NodePath):
         Actor.notify.debug("in loadModel: %s , part: %s, lod: %s, copy: %s" % \
         Actor.notify.debug("in loadModel: %s , part: %s, lod: %s, copy: %s" % \
             (modelPath, partName, lodName, copy))
             (modelPath, partName, lodName, copy))
 
 
-        # load the model and extract its part bundle
-        if (copy):
-            model = loader.loadModelCopy(modelPath)
+        if isinstance(modelPath, NodePath):
+            # If we got a NodePath instead of a string, use *that* as
+            # the model directly.
+            if (copy):
+                model = modelPath.copyTo(hidden)
+            else:
+                model = modelPath
         else:
         else:
-            model = loader.loadModelOnce(modelPath)
+            # otherwise, we got the name of the model to load.
+            if (copy):
+                model = loader.loadModelCopy(modelPath)
+            else:
+                model = loader.loadModelOnce(modelPath)
 
 
         if (model == None):
         if (model == None):
             print "model = None!!!"
             print "model = None!!!"