Retrieving NodePath data

I wrote this small script into my code in order to try to understand how to read about nodes in the scene. While browsing through the API, I couldn’t figure out how to get the type of node each is, more specifically whether it’s a model or actor. I assume it’s through the find() command, but couldn’t figure out the correct query.

Also, how do I find out the egg files the actors are stored in, and the animation to go with it? It seems it isn’t displayed like the model’s names.

(Testing with panda3D’s models)

        numChildren = render.getNumChildren()

        for a in range(0,numChildren):
            child=render.getChild(a)
            print child.getName()
            print " ",child.getPos()
            print " ",child.getHpr()
            print " ",child.getScale()
            print " ",child.getTransparency()

Output:

camera
  Point3(0, -10, 2)
  VBase3(0, 0, 0)
  VBase3(1, 1, 1)
  0
environment.egg
  Point3(-8, 42, 0)
  VBase3(0, 0, 0)
  VBase3(0.25, 0.25, 0.25)
  0
panda_walk_character
  Point3(-4, 0, 0)
  VBase3(0, 0, 0)
  VBase3(0.005, 0.005, 0.005)
  1
panda_walk_character
  Point3(0, 0, 0)
  VBase3(0, 0, 0)
  VBase3(0.005, 0.005, 0.005)
  1
panda_walk_character
  Point3(4, 0, 0)
  VBase3(0, 0, 0)
  VBase3(0.005, 0.005, 0.005)
  1

You can get a node’s type with nodePath.node().getType(), but it sounds like you’re asking for something different. The distinction between “model” and “actor” is a higher-level distinction, something that doesn’t make sense to ask a node.

Generally, you know which egg files you’re loading. Some of your egg files represent static models, and some of them represent animatable actors. You have to know what you’re loading before you load it, and you load them in different ways according to what you plan to do with them.

Um, same answer? Usually you know what egg files you’ve got before you get started.

David