Get scene object


I’ve created and exported a scene in 3D studio max.

The scene consists of several Objects with specific names.

	NodePath myModel = window->load_model(framework.get_models(), "moveTool");
	myModel.set_pos(0, 0, 0);

I then run;

and this is the console output

Uploaded with

Now my question is, how do I get access to the GeomNodes within the scene ?

If I check for children I get only 1 child as you can see from the screenshot.

If I use the find function to find any of the objects by name, the handle I get back is invalid.


ok, this seems to work

	NodePath moveTool = window->load_model(framework.get_models(), "MoveTool");
	moveTool.set_pos(0, 0, 0);

	PT(PandaNode) rootNode = DCAST(PandaNode, moveTool.node());

	int numChildren = rootNode->get_num_children();
	std::cout << "\nNum Children = " << numChildren << "\n";

	PT(PandaNode) pChild = rootNode->get_child(0);
	int numChildChildren = pChild->get_num_children();
	std::cout << "\nNum Child Children = " << numChildChildren << "\n";
	for (unsigned int i = 0; i < numChildChildren; ++i)
		PT(GeomNode) pNode = DCAST(GeomNode, pChild->get_child(i));

		if (pNode)
			std::cout << "\nChild Child Name = " << pNode->get_name();

	NodePath sceneRoot = moveTool.get_child(0);

	NodePath node = sceneRoot.find("xAxis");

the question remains, should NodePath::find not return a valid node if called on NodePath moveTool ?
Or does it only search within the direct children of a node rather than all children of that node including it’s sub children?

This will search only the direct children of sceneRoot:

NodePath node = sceneRoot.find("xAxis");

This will search all of the descendants of sceneRoot:

NodePath node = sceneRoot.find("**/xAxis");