Collada DOM strangeness

I have a trivial piece of code to load a dae file and report on the geometries in it. getElementCount reports 3 geometries for each one in the file, and getElement loops over each 3 times. What am I doing wrong? Or am I mis-understanding something fundamental?
The output from this snippet when run on sample/data/cube.dae is:

Geometry 0 name box has id box
Geometry 1 name box has id box
Geometry 2 name box has id box

Collada::ReadColladaDoc(const char * filename)
   int error;
   DAE doc;
   error = doc.load(filename);
   assert(error == DAE_OK);

   unsigned int geometryElementCount = 
                     COLLADA_ELEMENT_GEOMETRY, NULL);

   for (unsigned int i = 0; i < geometryElementCount; ++i) {
        domGeometry *curGeom;
        error = doc.getDatabase()->getElement(
                     (daeElement **)&curGeom, i, NULL, 
                     COLLADA_ELEMENT_GEOMETRY, NULL);

        assert(error == DAE_OK);
        printf("Geometry %i name %s has id %s
", i, 
                     curGeom->getName(), curGeom->getId());

   return geometryElementCount;

I experience the same problem. It’s probably a bug.

Marking the collection as modified immediately after the load works around the bug:


(thanks to Andy Lorino on the sourceforge forum)


Hi plalonde,

Why I can’t load the file with the fuction “DAE::load(filename)”? I write as below:

DAE dae;
int error;
error = dae.load(“cube.dae”);

The file “cube.dae” is just in the current working directory.