Get scene object

hello,

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);
	myModel.set_scale(0.1f);
	myModel.set_two_sided(true);
	myModel.reparent_to(window->get_render());
	myModel.show();

I then run

        myModel.ls();

and this is the console output

Uploaded with ImageShack.us

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.

Chrys

ok, this seems to work

	NodePath moveTool = window->load_model(framework.get_models(), "MoveTool");
	moveTool.set_pos(0, 0, 0);
	moveTool.set_scale(0.1f);
	moveTool.set_two_sided(true);
	moveTool.reparent_to(window->get_render());
	moveTool.show();

	moveTool.ls();

	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");

David