I have two questions about exporting to collada ( with collada DOM 1.4.0 )
First question,
I created a daeURI, which is passed as a domAccessor::setSource()'s argument, and setup it.
As follows:
daeURI uri ;
// pPositionArray is the pointer of domFloat_array and already created.
uri.setElement( pPositionArray ) ;
uri.resolveURI() ;
pAccessor->setSource( uri ) ;
I tested this output file using XSI 5.1 Collada importer, but it didn’t work.
So I got rid of the “file:///testCollada.dae” from their URI using text editor, it worked fine.
Is there the right way to make the daeURI without baseURI( like “file:///testCollada.dae” ) or is this a bug of XSI importer?
Second question,
I am using domInputLocal and domInputLocalOffset to describe <input> schema(the child of <vertices>, <polygons> schema).
But when I use XSI 5.1 Collada Importer, these schemas are ignored. So I replaced them(<InputLocal> and <InputLocalOffset>) with simple <input>.
It worked fine…
In the Collada Specification 1.4.0, there is only the <input> schema’s reference.
Is there the way of using <input> schema when I use the collada DOM 1.4.0? Or should I use the <InputLocal> scehma instead of <input> strictly?
hmmm… seems like there isn’t a way without just hacking it together like this.
daeURI uri ;
// pPositionArray is the pointer of domFloat_array and already created.
uri.setElement( pPositionArray ) ;
uri.resolveURI() ;
char *idString = new char[ strlen( uri.getID() + 2 ) ]; //+1 for # +1 for \0
strcpy( idString, "#" );
strcat( idString, uri.getID() );
pAccessor->getSource().setURI( idString ) ;
That might do the trick for you.
How are you creating these elements. are you just saying
domInputLocal *il = new domInputLocal();
That wouldn’t be the best way to create elements. you should use the daeElement::create( daeString name ) or daeElement::createAndPlace( daeString name ) functions. It will take care of the element naming for you. But if you don’t want to change your code all you have to do is call
There is no <inputLocal> element in COLLADA. It is a complex type. The DOM hides that fact from people when they use the appropriate creation methods like daeElement::create and daeElement::createAndPlace. But if you circumvent those methods and just create elements from their constructor you now have to worry about element names.
Elements that are complex types in the schema (ie. <element name=“input” type="inputLocal/> ) need to be named correctly.