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 #ifndef __domAnimation_clip_h__
     10 #define __domAnimation_clip_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/domExtra.h>
     18 #include <dom/domInstanceWithExtra.h>
     19 class DAE;
     20 
     21 /**
     22  * The animation_clip element defines a section of the animation curves to
     23  * be used together as  an animation clip.
     24  */
     25 class domAnimation_clip : public daeElement
     26 {
     27 public:
     28 	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::ANIMATION_CLIP; }
     29 	static daeInt ID() { return 652; }
     30 	virtual daeInt typeID() const { return ID(); }
     31 protected:  // Attributes
     32 /**
     33  *  The id attribute is a text string containing the unique identifier of
     34  * this element.  This value must be unique within the instance document.
     35  * Optional attribute.
     36  */
     37 	xsID attrId;
     38 /**
     39  *  The name attribute is the text string name of this element. Optional attribute.
     40  */
     41 	xsNCName attrName;
     42 /**
     43  *  The start attribute is the time in seconds of the beginning of the clip.
     44  * This time is  the same as that used in the key-frame data and is used to
     45  * determine which set of  key-frames will be included in the clip.  The start
     46  * time does not specify when the clip  will be played.  If the time falls
     47  * between two keyframes of a referenced animation, an  interpolated value
     48  * should be used.  The default value is 0.0.  Optional attribute.
     49  */
     50 	xsDouble attrStart;
     51 /**
     52  *  The end attribute is the time in seconds of the end of the clip.  This
     53  * is used in the  same way as the start time.  If end is not specified, the
     54  * value is taken to be the end  time of the longest animation.  Optional
     55  * attribute.
     56  */
     57 	xsDouble attrEnd;
     58 
     59 protected:  // Elements
     60 /**
     61  *  The animation_clip element may contain an asset element.  @see domAsset
     62  */
     63 	domAssetRef elemAsset;
     64 /**
     65  * The animation_clip must instance at least one animation element. @see domInstance_animation
     66  */
     67 	domInstanceWithExtra_Array elemInstance_animation_array;
     68 /**
     69  *  The extra element may appear any number of times.  @see domExtra
     70  */
     71 	domExtra_Array elemExtra_array;
     72 
     73 public:	//Accessors and Mutators
     74 	/**
     75 	 * Gets the id attribute.
     76 	 * @return Returns a xsID of the id attribute.
     77 	 */
     78 	xsID getId() const { return attrId; }
     79 	/**
     80 	 * Sets the id attribute.
     81 	 * @param atId The new value for the id attribute.
     82 	 */
     83 	void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
     84 		if( _document != NULL ) _document->changeElementID( this, attrId );
     85 	}
     86 
     87 	/**
     88 	 * Gets the name attribute.
     89 	 * @return Returns a xsNCName of the name attribute.
     90 	 */
     91 	xsNCName getName() const { return attrName; }
     92 	/**
     93 	 * Sets the name attribute.
     94 	 * @param atName The new value for the name attribute.
     95 	 */
     96 	void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
     97 
     98 	/**
     99 	 * Gets the start attribute.
    100 	 * @return Returns a xsDouble of the start attribute.
    101 	 */
    102 	xsDouble getStart() const { return attrStart; }
    103 	/**
    104 	 * Sets the start attribute.
    105 	 * @param atStart The new value for the start attribute.
    106 	 */
    107 	void setStart( xsDouble atStart ) { attrStart = atStart; _validAttributeArray[2] = true; }
    108 
    109 	/**
    110 	 * Gets the end attribute.
    111 	 * @return Returns a xsDouble of the end attribute.
    112 	 */
    113 	xsDouble getEnd() const { return attrEnd; }
    114 	/**
    115 	 * Sets the end attribute.
    116 	 * @param atEnd The new value for the end attribute.
    117 	 */
    118 	void setEnd( xsDouble atEnd ) { attrEnd = atEnd; _validAttributeArray[3] = true; }
    119 
    120 	/**
    121 	 * Gets the asset element.
    122 	 * @return a daeSmartRef to the asset element.
    123 	 */
    124 	const domAssetRef getAsset() const { return elemAsset; }
    125 	/**
    126 	 * Gets the instance_animation element array.
    127 	 * @return Returns a reference to the array of instance_animation elements.
    128 	 */
    129 	domInstanceWithExtra_Array &getInstance_animation_array() { return elemInstance_animation_array; }
    130 	/**
    131 	 * Gets the instance_animation element array.
    132 	 * @return Returns a constant reference to the array of instance_animation elements.
    133 	 */
    134 	const domInstanceWithExtra_Array &getInstance_animation_array() const { return elemInstance_animation_array; }
    135 	/**
    136 	 * Gets the extra element array.
    137 	 * @return Returns a reference to the array of extra elements.
    138 	 */
    139 	domExtra_Array &getExtra_array() { return elemExtra_array; }
    140 	/**
    141 	 * Gets the extra element array.
    142 	 * @return Returns a constant reference to the array of extra elements.
    143 	 */
    144 	const domExtra_Array &getExtra_array() const { return elemExtra_array; }
    145 protected:
    146 	/**
    147 	 * Constructor
    148 	 */
    149 	domAnimation_clip(DAE& dae) : daeElement(dae), attrId(), attrName(), attrStart(), attrEnd(), elemAsset(), elemInstance_animation_array(), elemExtra_array() {}
    150 	/**
    151 	 * Destructor
    152 	 */
    153 	virtual ~domAnimation_clip() {}
    154 	/**
    155 	 * Overloaded assignment operator
    156 	 */
    157 	virtual domAnimation_clip &operator=( const domAnimation_clip &cpy ) { (void)cpy; return *this; }
    158 
    159 public: // STATIC METHODS
    160 	/**
    161 	 * Creates an instance of this class and returns a daeElementRef referencing it.
    162 	 * @return a daeElementRef referencing an instance of this object.
    163 	 */
    164 	static DLLSPEC daeElementRef create(DAE& dae);
    165 	/**
    166 	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    167 	 * If a daeMetaElement already exists it will return that instead of creating a new one.
    168 	 * @return A daeMetaElement describing this COLLADA element.
    169 	 */
    170 	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    171 };
    172 
    173 
    174 #endif
    175