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 #ifndef __domAnimation_h__ 10 #define __domAnimation_h__ 11 12 #include <dae/daeDocument.h> 13 #include <dom/domTypes.h> 14 #include <dom/domElements.h> 15 16 #include <dom/domAsset.h> 17 #include <dom/domSource.h> 18 #include <dom/domSampler.h> 19 #include <dom/domChannel.h> 20 #include <dom/domAnimation.h> 21 #include <dom/domExtra.h> 22 class DAE; 23 24 /** 25 * The animation element categorizes the declaration of animation information. 26 * The animation hierarchy contains elements that describe the animations 27 * key-frame data and sampler functions, ordered in such a way to group together 28 * animations that should be executed together. 29 */ 30 class domAnimation : public daeElement 31 { 32 public: 33 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::ANIMATION; } 34 static daeInt ID() { return 651; } 35 virtual daeInt typeID() const { return ID(); } 36 protected: // Attributes 37 /** 38 * The id attribute is a text string containing the unique identifier of 39 * this element. This value must be unique within the instance document. 40 * Optional attribute. 41 */ 42 xsID attrId; 43 /** 44 * The name attribute is the text string name of this element. Optional attribute. 45 */ 46 xsNCName attrName; 47 48 protected: // Elements 49 /** 50 * The animation element may contain an asset element. @see domAsset 51 */ 52 domAssetRef elemAsset; 53 /** 54 * The animation element may contain any number of source elements. @see 55 * domSource 56 */ 57 domSource_Array elemSource_array; 58 /** 59 * The animation element may contain any number of sampler elements. @see 60 * domSampler 61 */ 62 domSampler_Array elemSampler_array; 63 /** 64 * The animation element may contain any number of channel elements. @see 65 * domChannel 66 */ 67 domChannel_Array elemChannel_array; 68 /** 69 * The animation may be hierarchical and may contain any number of other 70 * animation elements. @see domAnimation 71 */ 72 domAnimation_Array elemAnimation_array; 73 /** 74 * The extra element may appear any number of times. @see domExtra 75 */ 76 domExtra_Array elemExtra_array; 77 /** 78 * Used to preserve order in elements that do not specify strict sequencing of sub-elements. 79 */ 80 daeElementRefArray _contents; 81 /** 82 * Used to preserve order in elements that have a complex content model. 83 */ 84 daeUIntArray _contentsOrder; 85 86 /** 87 * Used to store information needed for some content model objects. 88 */ 89 daeTArray< daeCharArray * > _CMData; 90 91 92 public: //Accessors and Mutators 93 /** 94 * Gets the id attribute. 95 * @return Returns a xsID of the id attribute. 96 */ 97 xsID getId() const { return attrId; } 98 /** 99 * Sets the id attribute. 100 * @param atId The new value for the id attribute. 101 */ 102 void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true; 103 if( _document != NULL ) _document->changeElementID( this, attrId ); 104 } 105 106 /** 107 * Gets the name attribute. 108 * @return Returns a xsNCName of the name attribute. 109 */ 110 xsNCName getName() const { return attrName; } 111 /** 112 * Sets the name attribute. 113 * @param atName The new value for the name attribute. 114 */ 115 void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; } 116 117 /** 118 * Gets the asset element. 119 * @return a daeSmartRef to the asset element. 120 */ 121 const domAssetRef getAsset() const { return elemAsset; } 122 /** 123 * Gets the source element array. 124 * @return Returns a reference to the array of source elements. 125 */ 126 domSource_Array &getSource_array() { return elemSource_array; } 127 /** 128 * Gets the source element array. 129 * @return Returns a constant reference to the array of source elements. 130 */ 131 const domSource_Array &getSource_array() const { return elemSource_array; } 132 /** 133 * Gets the sampler element array. 134 * @return Returns a reference to the array of sampler elements. 135 */ 136 domSampler_Array &getSampler_array() { return elemSampler_array; } 137 /** 138 * Gets the sampler element array. 139 * @return Returns a constant reference to the array of sampler elements. 140 */ 141 const domSampler_Array &getSampler_array() const { return elemSampler_array; } 142 /** 143 * Gets the channel element array. 144 * @return Returns a reference to the array of channel elements. 145 */ 146 domChannel_Array &getChannel_array() { return elemChannel_array; } 147 /** 148 * Gets the channel element array. 149 * @return Returns a constant reference to the array of channel elements. 150 */ 151 const domChannel_Array &getChannel_array() const { return elemChannel_array; } 152 /** 153 * Gets the animation element array. 154 * @return Returns a reference to the array of animation elements. 155 */ 156 domAnimation_Array &getAnimation_array() { return elemAnimation_array; } 157 /** 158 * Gets the animation element array. 159 * @return Returns a constant reference to the array of animation elements. 160 */ 161 const domAnimation_Array &getAnimation_array() const { return elemAnimation_array; } 162 /** 163 * Gets the extra element array. 164 * @return Returns a reference to the array of extra elements. 165 */ 166 domExtra_Array &getExtra_array() { return elemExtra_array; } 167 /** 168 * Gets the extra element array. 169 * @return Returns a constant reference to the array of extra elements. 170 */ 171 const domExtra_Array &getExtra_array() const { return elemExtra_array; } 172 /** 173 * Gets the _contents array. 174 * @return Returns a reference to the _contents element array. 175 */ 176 daeElementRefArray &getContents() { return _contents; } 177 /** 178 * Gets the _contents array. 179 * @return Returns a constant reference to the _contents element array. 180 */ 181 const daeElementRefArray &getContents() const { return _contents; } 182 183 protected: 184 /** 185 * Constructor 186 */ 187 domAnimation(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemSource_array(), elemSampler_array(), elemChannel_array(), elemAnimation_array(), elemExtra_array() {} 188 /** 189 * Destructor 190 */ 191 virtual ~domAnimation() { daeElement::deleteCMDataArray(_CMData); } 192 /** 193 * Overloaded assignment operator 194 */ 195 virtual domAnimation &operator=( const domAnimation &cpy ) { (void)cpy; return *this; } 196 197 public: // STATIC METHODS 198 /** 199 * Creates an instance of this class and returns a daeElementRef referencing it. 200 * @return a daeElementRef referencing an instance of this object. 201 */ 202 static DLLSPEC daeElementRef create(DAE& dae); 203 /** 204 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 205 * If a daeMetaElement already exists it will return that instead of creating a new one. 206 * @return A daeMetaElement describing this COLLADA element. 207 */ 208 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 209 }; 210 211 212 #endif 213