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/domAnimation_clip.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 domAnimation_clip::create(DAE& dae) 21 { 22 domAnimation_clipRef ref = new domAnimation_clip(dae); 23 return ref; 24 } 25 26 27 daeMetaElement * 28 domAnimation_clip::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( "animation_clip" ); 36 meta->registerClass(domAnimation_clip::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(domAnimation_clip,elemAsset) ); 45 mea->setElementType( domAsset::registerElement(dae) ); 46 cm->appendChild( mea ); 47 48 mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 ); 49 mea->setName( "instance_animation" ); 50 mea->setOffset( daeOffsetOf(domAnimation_clip,elemInstance_animation_array) ); 51 mea->setElementType( domInstanceWithExtra::registerElement(dae) ); 52 cm->appendChild( mea ); 53 54 mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 ); 55 mea->setName( "extra" ); 56 mea->setOffset( daeOffsetOf(domAnimation_clip,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( domAnimation_clip , 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( domAnimation_clip , attrName )); 80 ma->setContainer( meta ); 81 82 meta->appendAttribute(ma); 83 } 84 85 // Add attribute: start 86 { 87 daeMetaAttribute *ma = new daeMetaAttribute; 88 ma->setName( "start" ); 89 ma->setType( dae.getAtomicTypes().get("xsDouble")); 90 ma->setOffset( daeOffsetOf( domAnimation_clip , attrStart )); 91 ma->setContainer( meta ); 92 ma->setDefaultString( "0.0"); 93 94 meta->appendAttribute(ma); 95 } 96 97 // Add attribute: end 98 { 99 daeMetaAttribute *ma = new daeMetaAttribute; 100 ma->setName( "end" ); 101 ma->setType( dae.getAtomicTypes().get("xsDouble")); 102 ma->setOffset( daeOffsetOf( domAnimation_clip , attrEnd )); 103 ma->setContainer( meta ); 104 105 meta->appendAttribute(ma); 106 } 107 108 meta->setElementSize(sizeof(domAnimation_clip)); 109 meta->validate(); 110 111 return meta; 112 } 113 114