kfbxcontrolset.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_CONTROL_SET_H_
00005 #define _FBXSDK_CONTROL_SET_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 2002 - 2007 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material
00013  (collectively the "Data") in these files contain unpublished information
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by
00015  Canada and United States of America federal copyright law and by international
00016  treaties.
00017 
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE,
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE.
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
00028 
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE.
00039 
00040 **************************************************************************************/
00041 
00042 #include <kaydaradef.h>
00043 #ifndef KFBX_DLL 
00044     #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046 
00047 #include <kaydara.h>
00048 
00049 #include <kfbxcharacter/kfbxcharacter.h>
00050 
00051 #include <kfbxmath/kfbxxmatrix.h>
00052 
00053 #include <klib/kstring.h>
00054 
00055 #include <fbxfilesdk_nsbegin.h>
00056 
00057 class KFbxNode;
00058 class KFbxSdkManager;
00059 class KFbxControlSetPlug;
00060 class KFbxControlSetPlug_internal;
00061 
00062 typedef enum 
00063 {
00064     eEffectorHips = 0,
00065     eEffectorLeftAnkle,
00066     eEffectorRightAnkle,
00067     eEffectorLeftWrist,
00068     eEffectorRightWrist,
00069     eEffectorLeftKnee,
00070     eEffectorRightKnee,
00071     eEffectorLeftElbow,
00072     eEffectorRightElbow,
00073     eEffectorChestOrigin,
00074     eEffectorChestEnd,
00075     eEffectorLeftFoot,
00076     eEffectorRightFoot,
00077     eEffectorLeftShoulder,
00078     eEffectorRightShoulder,
00079     eEffectorHead,
00080     eEffectorLeftHip,
00081     eEffectorRightHip,
00082 
00083     // Added for 4.5 
00084 
00085     eEffectorLeftHand,
00086     eEffectorRightHand,
00087 
00088     eEffectorLeftHandThumb,
00089     eEffectorLeftHandIndex,
00090     eEffectorLeftHandMiddle,
00091     eEffectorLeftHandRing,
00092     eEffectorLeftHandPinky,
00093     eEffectorLeftHandExtraFinger,
00094 
00095     eEffectorRightHandThumb,
00096     eEffectorRightHandIndex,
00097     eEffectorRightHandMiddle,
00098     eEffectorRightHandRing,
00099     eEffectorRightHandPinky,
00100     eEffectorRightHandExtraFinger,
00101 
00102     eEffectorLeftFootThumb,
00103     eEffectorLeftFootIndex,
00104     eEffectorLeftFootMiddle,
00105     eEffectorLeftFootRing,
00106     eEffectorLeftFootPinky,
00107     eEffectorLeftFootExtraFinger,
00108 
00109     eEffectorRightFootThumb,
00110     eEffectorRightFootIndex,
00111     eEffectorRightFootMiddle,
00112     eEffectorRightFootRing,
00113     eEffectorRightFootPinky,
00114     eEffectorRightFootExtraFinger,
00115 
00116     eEffectorLastNodeId
00117 } EEffectorNodeId;
00118 
00119 typedef enum 
00120 {   
00121     eEffectorSetDefault = 0, 
00122     eEffectorSetAux1, 
00123     eEffectorSetAux2, 
00124     eEffectorSetAux3, 
00125     eEffectorSetAux4, 
00126     eEffectorSetAux5, 
00127     eEffectorSetAux6, 
00128     eEffectorSetAux7, 
00129     eEffectorSetAux8, 
00130     eEffectorSetAux9, 
00131     eEffectorSetAux10, 
00132     eEffectorSetAux11, 
00133     eEffectorSetAux12, 
00134     eEffectorSetAux13, 
00135     eEffectorSetAux14, 
00136     eLastEffectorSetId
00137 } EEffectorSetId;
00138 
00139 
00145 class KFBX_DLL KFbxControlSetLink
00146 {
00147 
00148 public:
00149 
00150     KFbxControlSetLink();
00151     KFbxControlSetLink(const KFbxControlSetLink& pControlSetLink);
00152     KFbxControlSetLink& operator=(const KFbxControlSetLink& pControlSetLink);
00153 
00158     void Reset();
00159 
00161     KFbxNode* mNode;
00162 
00165     KString mTemplateName;
00166 };
00167 
00173 class KFBX_DLL KFbxEffector
00174 {
00175 
00176 public:
00177 
00178     KFbxEffector();
00179     KFbxEffector& operator=(KFbxEffector& pEffector);
00180 
00186     void Reset();
00187 
00189     KFbxNode* mNode;
00190 
00192     bool mShow;
00193 
00194     // These members are for backward compatibility and should not be used. These properties are now published through class KFbxControlSetPlug.
00195 #ifndef DOXYGEN_SHOULD_SKIP_THIS    
00196     bool mTActive;
00197     bool mRActive;
00198     bool mCandidateTActive;
00199     bool mCandidateRActive;
00200 #endif
00201 };
00202 
00217 class KFBX_DLL KFbxControlSet
00218 {
00219 
00220 public:
00221 
00225     void Reset();
00226 
00232     enum EType
00233     {
00234         eNone,
00235         eFkIk,
00236         eIkOnly
00237     };
00238 
00240     void SetType(EType pType);
00241 
00243     EType GetType();
00244 
00246     void SetUseAxis(bool pUseAxis);
00247 
00249     bool GetUseAxis();
00250 
00252     void SetLockTransform(bool pLockTransform);
00253 
00255     bool GetLockTransform();
00256 
00258     void SetLock3DPick(bool pLock3DPick);
00259 
00261     bool GetLock3DPick();
00262 
00272     bool SetControlSetLink(ECharacterNodeId pCharacterNodeId, const KFbxControlSetLink& pControlSetLink);
00273 
00283     bool GetControlSetLink(ECharacterNodeId pCharacterNodeId, KFbxControlSetLink* pControlSetLink = NULL);
00284 
00290     bool SetEffector(EEffectorNodeId pEffectorNodeId, KFbxEffector pEffector);
00291 
00297     bool GetEffector(EEffectorNodeId pEffectorNodeId, KFbxEffector* pEffector = NULL);
00298     
00305     bool SetEffectorAux(EEffectorNodeId pEffectorNodeId, KFbxNode* pNode,EEffectorSetId pEffectorSetId = eEffectorSetAux1);
00306 
00313     bool GetEffectorAux(EEffectorNodeId pEffectorNodeId, KFbxNode** pNode = NULL,EEffectorSetId pEffectorSetId = eEffectorSetAux1);
00314 
00319     static char* GetEffectorNodeName(EEffectorNodeId pEffectorNodeId);
00320 
00326     static EEffectorNodeId GetEffectorNodeId(char* pEffectorNodeName);
00327 
00328 
00330 //
00331 //  WARNING!
00332 //
00333 //  Anything beyond these lines may not be documented accurately and is 
00334 //  subject to change without notice.
00335 //
00337 
00338 #ifndef DOXYGEN_SHOULD_SKIP_THIS    
00339 
00340 private:
00341 
00342     KFbxControlSet();
00343     ~KFbxControlSet();
00344 
00345     KFbxCharacter* mCharacter;
00346     EType mType;
00347     bool mUseAxis;
00348     bool mLockTransform;
00349     bool mLock3DPick;
00350     KFbxControlSetLink mControlSetLink[eCharacterLastNodeId]; // Except floor node IDs!
00351     KFbxEffector mEffector[eEffectorLastNodeId];
00352     KFbxNode* mEffectorAux[eEffectorLastNodeId][eLastEffectorSetId-1];
00353 
00354     friend class KFbxCharacter;
00355     friend class KFbxNode;
00356 
00357 public:
00358 
00359     void FromPlug(KFbxControlSetPlug *pPlug);
00360     void ToPlug(KFbxControlSetPlug *pPlug);
00361 
00362 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00363 
00364 };
00365 
00366 
00367 class KFBX_DLL KFbxControlSetPlug : public KFbxTakeNodeContainer
00368 {
00369     KFBXOBJECT_DECLARE(KFbxControlSetPlug);
00370 public:
00376 
00380         KError& GetError();
00381 
00383         typedef enum 
00384         {
00385             eERROR,
00386             eERROR_COUNT
00387         } EError;   
00388 
00392         EError GetLastErrorID();
00393 
00397         char* GetLastErrorString();
00398 
00400 
00401         virtual KFbxObject::ENameSpace GetNameSpace() const;
00402         virtual KObject*  GetFbxObject_internal();
00403         virtual KObject const*  GetFbxObject_internal() const;
00404 
00405         // Clone
00406         virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType) const;
00407 
00408     protected:
00409         static char const* GetNamePrefix() { return CONTROLSET_PLUG_PREFIX; }
00410 
00411         KFbxControlSetPlug(KFbxSdkManager& pManager, char const* pName);
00412         virtual ~KFbxControlSetPlug();
00413 
00414         virtual void Destruct(bool pRecursive, bool pDependents);
00415 
00416         virtual KString     GetTypeName() const;
00417         virtual KStringList GetTypeFlags() const;
00418 
00419         virtual void AddChannels(KFbxTakeNode *pTakeNode);
00420 
00421         KFbxControlSetPlug_internal* mPH;
00422 
00423         KError mError;
00424 
00425         friend class KFbxReaderFbx;
00426         friend class KFbxWriterFbx;
00427         friend class KFbxWriterFbx6;
00428         friend class KFbxScene;
00429 };
00430 
00431 typedef KFbxControlSetPlug* HKFbxControlSetPlug;
00432 
00433 #include <fbxfilesdk_nsend.h>
00434 
00435 #endif // #ifndef _FBXSDK_CONTROL_SET_H_
00436 
00437