I am currently trying to load the nodes for a “visual_scene”. First I get a domVisual_scene element:
error = input->getDatabase()->getElement((daeElement**)&thisScene, currentScene, NULL, "scene");
Then I try to access the node array, where the program crashes:
if(error == DAE_OK)
domNode_Array nodes = thisScene->getNode_array();
cout << "Nodes: " << nodes.getCount() << endl; // <- Crash!
What am I doing wrong?
Is there a small sample, which loads a scene?
Thanks in advance, Enrico
getNode_array returns a reference. You probably don’t want to copy the array so use “domNode_Array& nodes = …” instead. Technically what you’re doing should still be ok (though inefficient), but I remember reading that there are problems with copying daeArray objects, and that may be causing your crash.
There were problems with the array copy constructor and operator=
They have been fixed in the SVN repository but have yet been released in an official package. Saving the reference instead of doing a copy is definately more effecient and likely a better approach to take. And it gets around the problem you are seeing. Either save as a reference or get the newest code from the SVN on the sourceforge site.