Results 1 to 8 of 8

Thread: How to correctly create internal urls for exporting?

  1. #1

    How to correctly create internal urls for exporting?

    domMesh *meshElement = (domMesh *)geo->createAndPlace("mesh");
    domVertices *vertices = (domVertices*)meshElement->createAndPlace("vertices");
    domInputLocal *array = (domInputLocal*)meshElement->createAndPlace("InputLocal");
    domSource *source = (domSource*)meshElement->createAndPlace("source");
    source->setName("points");

    array->setSource(daeURI("#points")); // FAILS
    array->setSemantic(daeStringRef("VERTEX")); // FAILS
    domFloat_array *PositionFA = (domFloat_array*)source->createAndPlace("float_array");

    What is the correct method to set the Source and Semantic for the array?

    David

  2. #2
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    Try these changes:

    domMesh *meshElement = (domMesh *)geo->createAndPlace("mesh");
    domVertices *vertices = (domVertices*)meshElement->createAndPlace("vertices");
    domInputLocal *array = (domInputLocal*)vertices->createAndPlace("input");
    domSource *source = (domSource*)meshElement->createAndPlace("source");
    source->setId("points");

    array->setSource("#points");
    array->setSemantic("VERTEX");

    domFloat_array *PositionFA = (domFloat_array*)source->createAndPlace("float_array");

  3. #3
    I made the changes but - array->setSource("#points");
    Still fails in
    daeURI &operator=( const daeURI& other) {
    setURI(other.getOriginalURI());
    element = other.element;
    state = other.state;
    return *this;

    fails at element = since other.element is null.
    How do I get it set?

    David

  4. #4
    I believe this is what is failing-
    setURI(other.getOriginalURI());

    I start the data base with - (path being desired output file name)
    sprintf(newname,"file:///%s",path);

    DAE *daeObject = new DAE;
    daeObject->setDatabase(NULL);
    daeCollection *collection;
    int res = daeObject->getDatabase()->insertCollection(newname,&collection);

    Then the first uri set which I changed to set the element -

    daeURI uri("#points");
    uri.setElement( PositionFA );
    uri.resolveURI();
    array->setSource( uri );

    This fails.
    protocal, authority and filepath are null after resolve URI.

    David

  5. #5
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    Can you post the full code? I'm not totally sure what's failing.

  6. #6
    all code until crash-

    char newname[512];
    domCOLLADA *domRoot;

    sprintf(newname,"file:///%s",path); // path = somefile.dae

    DAE *daeObject = new DAE;
    daeObject->setDatabase(NULL);
    daeCollection *collection;
    int res = daeObject->getDatabase()->insertCollection(newname,&collection);

    if(collection){
    domRoot = (domCOLLADA *)collection->getDomRoot();
    } // error message and return left out

    domLibrary_geometries *geoLib = (domLibrary_geometries*)domRoot->createAndPlace("library_geometries");

    domGeometry *geo = (domGeometry*)geoLib->createAndPlace("geometry");

    domMesh *meshElement = (domMesh *)geo->createAndPlace("mesh");

    domVertices *vertices = (domVertices*)meshElement->createAndPlace("vertices");
    domInputLocal *array = (domInputLocal*)vertices->createAndPlace("InputLocal");
    domSource *source = (domSource*)meshElement->createAndPlace("source");
    source->setId("points");
    domFloat_array *PositionFA = (domFloat_array*)source->createAndPlace("float_array");

    daeURI uri("#points");
    uri.setElement( PositionFA );
    uri.resolveURI();
    array->setSource( uri ); // this fails

  7. #7
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    'array' is null. Try these changes.

    ...
    domInputLocal *array = (domInputLocal*)vertices->createAndPlace("input");
    ...
    daeURI uri;
    uri.setElement( source );
    uri.resolveURI();
    array->setSource( uri );

  8. #8
    Thanks a bunch!
    On to the next section now!

    David

Posting Permissions

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