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

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”);

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

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

Can you post the full code? I’m not totally sure what’s failing.

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

‘array’ is null. Try these changes.


domInputLocal array = (domInputLocal)vertices->createAndPlace(“input”);

daeURI uri;
uri.setElement( source );
uri.resolveURI();
array->setSource( uri );

Thanks a bunch!
On to the next section now!

David