00001 /* 00002 Copyright (C) 2005-2006 Feeling Software Inc. 00003 MIT License: http://www.opensource.org/licenses/mit-license.php 00004 */ 00005 /* 00006 Based on the FS Import classes: 00007 Copyright (C) 2005-2006 Feeling Software Inc 00008 Copyright (C) 2005-2006 Autodesk Media Entertainment 00009 MIT License: http://www.opensource.org/licenses/mit-license.php 00010 */ 00011 00017 #ifndef _FCD_ANIMATION_H_ 00018 #define _FCD_ANIMATION_H_ 00019 00020 #include "FUtils/FUXmlNodeIdPair.h" 00021 #include "FCDocument/FCDEntity.h" 00022 00023 class FCDocument; 00024 class FCDAnimated; 00025 class FCDAnimation; 00026 class FCDAnimationChannel; 00027 class FCDAnimationCurve; 00028 00029 typedef vector<FCDAnimation*> FCDAnimationList; 00030 typedef vector<FCDAnimationChannel*> FCDAnimationChannelList; 00031 typedef vector<FCDAnimationCurve*> FCDAnimationCurveList; 00045 class FCOLLADA_EXPORT FCDAnimation : public FCDEntity 00046 { 00047 private: 00048 DeclareObjectType; 00049 FCDAnimationChannelList channels; 00050 FUXmlNodeIdPairList childNodes; 00051 FCDAnimationList children; 00052 00053 public: 00059 FCDAnimation(FCDocument* document); 00060 00065 virtual ~FCDAnimation(); 00066 00070 virtual Type GetType() const { return ANIMATION; } 00071 00078 virtual FCDEntity* FindDaeId(const string& daeId); 00079 00083 inline size_t GetChildCount() const { return children.size(); } 00084 00090 inline FCDAnimation* GetChild(size_t index) { FUAssert(index < GetChildCount(), return NULL); return children.at(index); } 00091 inline const FCDAnimation* GetChild(size_t index) const { FUAssert(index < GetChildCount(), return NULL); return children.at(index); } 00095 inline FCDAnimation* AddChild(); 00096 00099 inline void ReleaseChild(FCDAnimation* animation); 00100 00105 void FindAnimationChannels(const string& pointer, FCDAnimationChannelList& targetChannels); 00106 00109 size_t GetChannelCount() const { return channels.size(); } 00110 00115 FCDAnimationChannel* GetChannel(size_t index) { FUAssert(index < GetChannelCount(), return NULL); return channels.at(index); } 00116 const FCDAnimationChannel* GetChannel(size_t index) const { FUAssert(index < GetChannelCount(), return NULL); return channels.at(index); } 00120 FCDAnimationChannel* AddChannel(); 00121 00124 void ReleaseChannel(FCDAnimationChannel* channel); 00125 00129 void GetCurves(FCDAnimationCurveList& curves); 00130 00135 FUStatus Link(); 00136 00141 virtual FUStatus LoadFromXML(xmlNode* animationNode); 00142 00146 virtual xmlNode* WriteToXML(xmlNode* parentNode) const; 00147 00154 xmlNode* FindChildById(const string& id); 00155 00161 bool LinkDriver(FCDAnimated* animated); 00162 }; 00163 00164 #endif // _FCD_ANIMATION_H_