Results 1 to 4 of 4

Thread: Collada DOM strangeness

  1. #1
    Junior Member
    Join Date
    Jan 2006
    Posts
    2

    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:
    Code :
    Geometry 0 name box has id box
    Geometry 1 name box has id box
    Geometry 2 name box has id box

    Code :
    int
    Collada::ReadColladaDoc(const char * filename)
    {
       int error;
       DAE doc;
       error = doc.load(filename);
       assert(error == DAE_OK);
     
       unsigned int geometryElementCount = 
              doc.getDatabase()->getElementCount(NULL, 
                         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\n", i, 
                         curGeom->getName(), curGeom->getId());
       }
     
       return geometryElementCount;
    }

  2. #2
    Junior Member
    Join Date
    Jan 2006
    Posts
    15
    I experience the same problem. It's probably a bug.

  3. #3
    Junior Member
    Join Date
    Jan 2006
    Posts
    2
    Marking the collection as modified immediately after the load works around the bug:
    Code :
    doc->getDatabase()->getCollection((daeUInt)0)->setModified(true);
    (thanks to Andy Lorino on the sourceforge forum)

    Paul

  4. #4
    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.

Posting Permissions

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