problems with changes in daeURI

Hi guys. I year ago I wrote my collada exporter where I was using this (and similar constructs for creating the <triangles> part in the geometry:

domInputLocal * pinput = (domInputLocal*)vertices->createAndPlace(COLLADA_ELEMENT_INPUT);
daeURI posURI;
posURI.setElement(positions);
posURI.resolveURI();
pinput->setSource(posURI);
pinput->setSemantic("POSITION");

Due to the changes in the daeURI class this is not working anymore. According to http://collada.org/mediawiki/index.php/DOM_backward_compatibility i ran into the type of problem where I should ask here how to achieve the same with the new api.

I already tried out

domInputLocal * pinput = (domInputLocal*)vertices->createAndPlace(COLLADA_ELEMENT_INPUT);
daeURI posURI(*positions);
pinput->setSource(posURI);
pinput->setSemantic("POSITION");

which I thought to be the right way to do that, but here all the source Attributes are empty.

Could you tell me how to solve my problem?
grassi

I think the part in red seems to be the where your problem is. You don’t show the creation of “positions” and if it’s not placed in the same document as “pinput” then the URI won’t construct and resolve correctly.

Hi, the creation of positions is done the following way:

domGeometry* geomElement;
domLibrary_geometries * myLib;
int res = dae->getDatabase()->getElement((daeElement**)&myLib, 0,NULL, COLLADA_ELEMENT_LIBRARY_GEOMETRIES, NULL);

geomElement = (domGeometry*)myLib-> createAndPlace(COLLADA_ELEMENT_GEOMETRY);
//stuff done with geomElement

domMesh *meshEl = (domMesh*)geomElement-> createAndPlace(COLLADA_ELEMENT_MESH);
domVertices * vertices = (domVertices*)meshEl-> createAndPlace(COLLADA_ELEMENT_VERTICES);
//stuff done with vertices

domSource * positions = (domSource*) meshEl-> createAndPlace(COLLADA_ELEMENT_SOURCE);

Everything is done in the same dae. The elements were resolved correctly with the old collada dom, but this one seems as if it either isn’t able to resolve it or doesn’t resolve it at all. Do I have to call something so that the resolving takes place before i do the dae->saveAs(…)?

The current output of this looks like that:

<vertices id="gum_tree-Geometry-Vertex">
	<input semantic="POSITION" source=""/>
</vertices>

Where nothing is in the source attribute.

Does the “positions” element have an “id” attribute value?