blob: 1a8b70cf523822badf5217e9fe52647d15354493 [file] [log] [blame]
/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
*/
#include <dae.h>
#include <dae/daeDom.h>
#include <dom/domLibrary_materials.h>
#include <dae/daeMetaCMPolicy.h>
#include <dae/daeMetaSequence.h>
#include <dae/daeMetaChoice.h>
#include <dae/daeMetaGroup.h>
#include <dae/daeMetaAny.h>
#include <dae/daeMetaElementAttribute.h>
daeElementRef
domLibrary_materials::create(DAE& dae)
{
domLibrary_materialsRef ref = new domLibrary_materials(dae);
return ref;
}
daeMetaElement *
domLibrary_materials::registerElement(DAE& dae)
{
daeMetaElement* meta = dae.getMeta(ID());
if ( meta != NULL ) return meta;
meta = new daeMetaElement(dae);
dae.setMeta(ID(), *meta);
meta->setName( "library_materials" );
meta->registerClass(domLibrary_materials::create);
daeMetaCMPolicy *cm = NULL;
daeMetaElementAttribute *mea = NULL;
cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 );
mea->setName( "asset" );
mea->setOffset( daeOffsetOf(domLibrary_materials,elemAsset) );
mea->setElementType( domAsset::registerElement(dae) );
cm->appendChild( mea );
mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 );
mea->setName( "material" );
mea->setOffset( daeOffsetOf(domLibrary_materials,elemMaterial_array) );
mea->setElementType( domMaterial::registerElement(dae) );
cm->appendChild( mea );
mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
mea->setName( "extra" );
mea->setOffset( daeOffsetOf(domLibrary_materials,elemExtra_array) );
mea->setElementType( domExtra::registerElement(dae) );
cm->appendChild( mea );
cm->setMaxOrdinal( 2 );
meta->setCMRoot( cm );
// Add attribute: id
{
daeMetaAttribute *ma = new daeMetaAttribute;
ma->setName( "id" );
ma->setType( dae.getAtomicTypes().get("xsID"));
ma->setOffset( daeOffsetOf( domLibrary_materials , attrId ));
ma->setContainer( meta );
meta->appendAttribute(ma);
}
// Add attribute: name
{
daeMetaAttribute *ma = new daeMetaAttribute;
ma->setName( "name" );
ma->setType( dae.getAtomicTypes().get("xsNCName"));
ma->setOffset( daeOffsetOf( domLibrary_materials , attrName ));
ma->setContainer( meta );
meta->appendAttribute(ma);
}
meta->setElementSize(sizeof(domLibrary_materials));
meta->validate();
return meta;
}