MoPaths

Hey all,

I was trying to load up a moPath that is inside of a model that I have loaded into the scene. Unfortunatly, it appears that moPath.py only has a loadFile. I don’t want to do that, because my scene has multiple moPaths, and it can’t handle it.
So, I added some new code into moPath.py to get around this issue. Here is the code I added.
####################
def loadNodePath( self, nodePath, fReset = 1):
if fReset:
self.reset()
if nodePath:
self.__extractCurves(nodePath)
if (self.tNurbsCurve != []):
self.maxT = self.tNurbsCurve[-1].getMaxT()
elif (self.xyzNurbsCurve != None):
self.maxT = self.xyzNurbsCurve.getMaxT()
elif (self.hprNurbsCurve != None):
self.maxT = self.hprNurbsCurve.getMaxT()
else:
print ‘Mopath: no valid curves in NodePath: %s’ % nodePath

        nodePath.removeNode()
    else:
        print 'Mopath: Invalid NodePath: %s' % nodePath

#####################
The idea here being that I can just use a .find on my model, and pass the nodepath which contains the nurbescurve into the function. This has worked for me except for one small problem I noticed. Iif I use loadModelCopy, the model no longer holds the NurbesCurves, and causes the load to fail. Once I switched over to loadModel, all my problems were gone.

So, two questions.

  1. Is there any reason this functionality was not in Panda already like this? Basically, a reason I should not do this.
  2. Does anyone know of another way to achieve a similair result?
  1. Sounds like a reasonable addition. To complete the addition, we should fix it so that loadModelCopy() will work properly with Mopaths. This is really just a matter of definining a trivial make_copy() method on ClassicNurbsCurve.

  2. In the VR Studio, we have always worked by saving each Mopath out as a separate model file. No reason that everyone else should do things the same way, but that’s why we were never troubled by this limitation.

David