Home | History | Annotate | Download | only in dom
      1 /*
      2 * Copyright 2006 Sony Computer Entertainment Inc.
      3 *
      4 * Licensed under the MIT Open Source License, for details please see license.txt or the website
      5 * http://www.opensource.org/licenses/mit-license.php
      6 *
      7 */
      8 
      9 #include <dae.h>
     10 #include <dae/daeDom.h>
     11 #include <dom/domLibrary_animations.h>
     12 #include <dae/daeMetaCMPolicy.h>
     13 #include <dae/daeMetaSequence.h>
     14 #include <dae/daeMetaChoice.h>
     15 #include <dae/daeMetaGroup.h>
     16 #include <dae/daeMetaAny.h>
     17 #include <dae/daeMetaElementAttribute.h>
     18 
     19 daeElementRef
     20 domLibrary_animations::create(DAE& dae)
     21 {
     22 	domLibrary_animationsRef ref = new domLibrary_animations(dae);
     23 	return ref;
     24 }
     25 
     26 
     27 daeMetaElement *
     28 domLibrary_animations::registerElement(DAE& dae)
     29 {
     30 	daeMetaElement* meta = dae.getMeta(ID());
     31 	if ( meta != NULL ) return meta;
     32 
     33 	meta = new daeMetaElement(dae);
     34 	dae.setMeta(ID(), *meta);
     35 	meta->setName( "library_animations" );
     36 	meta->registerClass(domLibrary_animations::create);
     37 
     38 	daeMetaCMPolicy *cm = NULL;
     39 	daeMetaElementAttribute *mea = NULL;
     40 	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
     41 
     42 	mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 );
     43 	mea->setName( "asset" );
     44 	mea->setOffset( daeOffsetOf(domLibrary_animations,elemAsset) );
     45 	mea->setElementType( domAsset::registerElement(dae) );
     46 	cm->appendChild( mea );
     47 
     48 	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 );
     49 	mea->setName( "animation" );
     50 	mea->setOffset( daeOffsetOf(domLibrary_animations,elemAnimation_array) );
     51 	mea->setElementType( domAnimation::registerElement(dae) );
     52 	cm->appendChild( mea );
     53 
     54 	mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
     55 	mea->setName( "extra" );
     56 	mea->setOffset( daeOffsetOf(domLibrary_animations,elemExtra_array) );
     57 	mea->setElementType( domExtra::registerElement(dae) );
     58 	cm->appendChild( mea );
     59 
     60 	cm->setMaxOrdinal( 2 );
     61 	meta->setCMRoot( cm );
     62 
     63 	//	Add attribute: id
     64 	{
     65 		daeMetaAttribute *ma = new daeMetaAttribute;
     66 		ma->setName( "id" );
     67 		ma->setType( dae.getAtomicTypes().get("xsID"));
     68 		ma->setOffset( daeOffsetOf( domLibrary_animations , attrId ));
     69 		ma->setContainer( meta );
     70 
     71 		meta->appendAttribute(ma);
     72 	}
     73 
     74 	//	Add attribute: name
     75 	{
     76 		daeMetaAttribute *ma = new daeMetaAttribute;
     77 		ma->setName( "name" );
     78 		ma->setType( dae.getAtomicTypes().get("xsNCName"));
     79 		ma->setOffset( daeOffsetOf( domLibrary_animations , attrName ));
     80 		ma->setContainer( meta );
     81 
     82 		meta->appendAttribute(ma);
     83 	}
     84 
     85 	meta->setElementSize(sizeof(domLibrary_animations));
     86 	meta->validate();
     87 
     88 	return meta;
     89 }
     90 
     91