From daa73b4c9c98b2252df8f256f69fea00cbc35579 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 10 Aug 2002 00:22:02 +0000 Subject: [PATCH] support creating actors with node paths --- direct/src/actor/Actor.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index 31c3b2c7a1..c4caee78c7 100644 --- a/direct/src/actor/Actor.py +++ b/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" % \ (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: - 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): print "model = None!!!"