Results 1 to 3 of 3

Thread: Problem with loading scene-nodes

  1. #1
    Enrico
    Guest

    Problem with loading scene-nodes

    Hi,

    I am currently trying to load the nodes for a "visual_scene". First I get a domVisual_scene element:
    Code :
    domVisual_scene *thisScene;
    error = input->getDatabase()->getElement((daeElement**)&thisScene, currentScene, NULL, "scene");
    Then I try to access the node array, where the program crashes:
    Code :
    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

  2. #2
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    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.

  3. #3
    Senior Member
    Join Date
    Aug 2005
    Location
    California
    Posts
    165
    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.

    -Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •