kfbxcharacter.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_CHARACTER_H_
00005 #define _FBXSDK_CHARACTER_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 <kfbxmath/kfbxvector4.h>
00050 
00051 #include <klib/kstring.h>
00052 #include <klib/kerror.h>
00053 
00054 #include <kfbxplugins/kfbxconstraint.h>
00055 #include <kfbxplugins/kfbxnodelimits.h>
00056 #include <kfbxplugins/kfbxgroupname.h>
00057 
00058 #include <fbxfilesdk_nsbegin.h>
00059 
00060 class KFbxNode;
00061 class KFbxControlSet;
00062 class KFbxFilterSet;
00063 class KFbxSdkManager;
00064 class KFbxCharacter_Internal;
00065 
00073 typedef enum 
00074 { 
00075     eCharacterInputActor = 0, 
00076     eCharacterInputCharacter = 1, 
00077     eCharacterInputMarkerSet = 2, 
00078     eCharacterOutputMarkerSet = 3, 
00079     eCharacterInputStance = 4 
00080 } ECharacterInputType;
00081 
00082 
00083 typedef enum  
00084 {   
00085     eCharacterHips = 0,             // Required
00086     eCharacterLeftHip,              // Required
00087     eCharacterLeftKnee,             // Required
00088     eCharacterLeftAnkle,            // Required
00089     eCharacterLeftFoot,
00090     eCharacterRightHip,             // Required
00091     eCharacterRightKnee,            // Required
00092     eCharacterRightAnkle,           // Required
00093     eCharacterRightFoot,
00094     eCharacterWaist,                // Spine0, Required
00095     eCharacterChest,                // Spine1
00096     eCharacterLeftCollar,
00097     eCharacterLeftShoulder,         // Required
00098     eCharacterLeftElbow,            // Required
00099     eCharacterLeftWrist,            // Required
00100     eCharacterRightCollar,
00101     eCharacterRightShoulder,        // Required
00102     eCharacterRightElbow,           // Required
00103     eCharacterRightWrist,           // Required
00104     eCharacterNeck,
00105     eCharacterHead,                 // Required
00106     eCharacterLeftHipRoll,
00107     eCharacterLeftKneeRoll,
00108     eCharacterRightHipRoll,
00109     eCharacterRightKneeRoll,
00110     eCharacterLeftShoulderRoll,
00111     eCharacterLeftElbowRoll,
00112     eCharacterRightShoulderRoll,
00113     eCharacterRightElbowRoll,
00114     eCharacterSpine2,
00115     eCharacterSpine3,
00116     eCharacterSpine4,
00117     eCharacterSpine5,
00118     eCharacterSpine6,
00119     eCharacterSpine7,
00120     eCharacterSpine8,
00121     eCharacterSpine9,
00122     eCharacterLeftThumbA,
00123     eCharacterLeftThumbB,
00124     eCharacterLeftThumbC,
00125     eCharacterLeftIndexA,
00126     eCharacterLeftIndexB,
00127     eCharacterLeftIndexC,
00128     eCharacterLeftMiddleA,
00129     eCharacterLeftMiddleB,
00130     eCharacterLeftMiddleC,
00131     eCharacterLeftRingA,
00132     eCharacterLeftRingB,
00133     eCharacterLeftRingC,
00134     eCharacterLeftPinkyA,
00135     eCharacterLeftPinkyB,
00136     eCharacterLeftPinkyC,
00137     eCharacterRightThumbA,
00138     eCharacterRightThumbB,
00139     eCharacterRightThumbC,
00140     eCharacterRightIndexA,
00141     eCharacterRightIndexB,
00142     eCharacterRightIndexC,
00143     eCharacterRightMiddleA,
00144     eCharacterRightMiddleB,
00145     eCharacterRightMiddleC,
00146     eCharacterRightRingA,
00147     eCharacterRightRingB,
00148     eCharacterRightRingC,
00149     eCharacterRightPinkyA,
00150     eCharacterRightPinkyB,
00151     eCharacterRightPinkyC,
00152     eCharacterReference,
00153     eCharacterLeftFloor,
00154     eCharacterRightFloor,
00155     eCharacterHipsTranslation,
00156     eCharacterProps0,
00157     eCharacterProps1,
00158     eCharacterProps2,
00159     eCharacterProps3,
00160     eCharacterProps4,
00161 
00162     // Added in 4.0x as patch.
00163 
00164     eCharacterGameModeParentLeftHipRoll,
00165     eCharacterGameModeParentLeftKnee,
00166     eCharacterGameModeParentLeftKneeRoll,
00167     eCharacterGameModeParentRightHipRoll,
00168     eCharacterGameModeParentRightKnee,
00169     eCharacterGameModeParentRightKneeRoll,
00170     eCharacterGameModeParentLeftShoulderRoll,   
00171     eCharacterGameModeParentLeftElbow,  
00172     eCharacterGameModeParentLeftElbowRoll,  
00173     eCharacterGameModeParentRightShoulderRoll,
00174     eCharacterGameModeParentRightElbow,     
00175     eCharacterGameModeParentRightElbowRoll, 
00176 
00177 
00178     // Elements added for Dominus.
00179     // From this point, the enum doesn't have to be synchronized with the HumanIK library.
00180 
00181     eCharacterLeftHandFloor,
00182     eCharacterRightHandFloor,
00183 
00184     eCharacterLeftHand,
00185     eCharacterRightHand,
00186     
00187     eCharacterNeck1,
00188     eCharacterNeck2,
00189     eCharacterNeck3,
00190     eCharacterNeck4,
00191     eCharacterNeck5,
00192     eCharacterNeck6,
00193     eCharacterNeck7,
00194     eCharacterNeck8,
00195     eCharacterNeck9,
00196 
00197     eCharacterLeftInHandThumb,
00198     eCharacterLeftThumbD,
00199     
00200     eCharacterLeftInHandIndex,
00201     eCharacterLeftIndexD,
00202     
00203     eCharacterLeftInHandMiddle,
00204     eCharacterLeftMiddleD,
00205     
00206     eCharacterLeftInHandRing,
00207     eCharacterLeftRingD,
00208     
00209     eCharacterLeftInHandPinky,
00210     eCharacterLeftPinkyD,
00211 
00212     eCharacterLeftInHandExtraFinger,
00213     eCharacterLeftExtraFingerA,
00214     eCharacterLeftExtraFingerB,
00215     eCharacterLeftExtraFingerC,
00216     eCharacterLeftExtraFingerD,
00217 
00218     eCharacterRightInHandThumb,
00219     eCharacterRightThumbD,
00220     
00221     eCharacterRightInHandIndex,
00222     eCharacterRightIndexD,
00223     
00224     eCharacterRightInHandMiddle,
00225     eCharacterRightMiddleD,
00226     
00227     eCharacterRightInHandRing,
00228     eCharacterRightRingD,
00229     
00230     eCharacterRightInHandPinky,
00231     eCharacterRightPinkyD,
00232 
00233     eCharacterRightInHandExtraFinger,
00234     eCharacterRightExtraFingerA,
00235     eCharacterRightExtraFingerB,
00236     eCharacterRightExtraFingerC,
00237     eCharacterRightExtraFingerD,
00238 
00239     eCharacterLeftInFootThumb,
00240     eCharacterLeftFootThumbA,
00241     eCharacterLeftFootThumbB,
00242     eCharacterLeftFootThumbC,
00243     eCharacterLeftFootThumbD,
00244     eCharacterLeftInFootIndex,
00245     eCharacterLeftFootIndexA,
00246     eCharacterLeftFootIndexB,
00247     eCharacterLeftFootIndexC,
00248     eCharacterLeftFootIndexD,
00249     eCharacterLeftInFootMiddle,
00250     eCharacterLeftFootMiddleA,
00251     eCharacterLeftFootMiddleB,
00252     eCharacterLeftFootMiddleC,
00253     eCharacterLeftFootMiddleD,
00254     eCharacterLeftInFootRing,
00255     eCharacterLeftFootRingA,
00256     eCharacterLeftFootRingB,
00257     eCharacterLeftFootRingC,
00258     eCharacterLeftFootRingD,
00259     eCharacterLeftInFootPinky,
00260     eCharacterLeftFootPinkyA,
00261     eCharacterLeftFootPinkyB,
00262     eCharacterLeftFootPinkyC,
00263     eCharacterLeftFootPinkyD,
00264     eCharacterLeftInFootExtraFinger,
00265     eCharacterLeftFootExtraFingerA,
00266     eCharacterLeftFootExtraFingerB,
00267     eCharacterLeftFootExtraFingerC,
00268     eCharacterLeftFootExtraFingerD,
00269 
00270     eCharacterRightInFootThumb,
00271     eCharacterRightFootThumbA,
00272     eCharacterRightFootThumbB,
00273     eCharacterRightFootThumbC,
00274     eCharacterRightFootThumbD,
00275     eCharacterRightInFootIndex,
00276     eCharacterRightFootIndexA,
00277     eCharacterRightFootIndexB,
00278     eCharacterRightFootIndexC,
00279     eCharacterRightFootIndexD,
00280     eCharacterRightInFootMiddle,
00281     eCharacterRightFootMiddleA,
00282     eCharacterRightFootMiddleB,
00283     eCharacterRightFootMiddleC,
00284     eCharacterRightFootMiddleD,
00285     eCharacterRightInFootRing,
00286     eCharacterRightFootRingA,
00287     eCharacterRightFootRingB,
00288     eCharacterRightFootRingC,
00289     eCharacterRightFootRingD,
00290     eCharacterRightInFootPinky,
00291     eCharacterRightFootPinkyA,
00292     eCharacterRightFootPinkyB,
00293     eCharacterRightFootPinkyC,
00294     eCharacterRightFootPinkyD,
00295     eCharacterRightInFootExtraFinger,
00296     eCharacterRightFootExtraFingerA,
00297     eCharacterRightFootExtraFingerB,
00298     eCharacterRightFootExtraFingerC,
00299     eCharacterRightFootExtraFingerD,
00300 
00301     eCharacterLastNodeId
00302 } ECharacterNodeId;
00303 
00304 
00305 typedef enum 
00306 {
00307     eCharacterGroup_Base,
00308     eCharacterGroup_Auxiliary,
00309     eCharacterGroup_Spine,
00310     eCharacterGroup_Roll,
00311     eCharacterGroup_Special,
00312     eCharacterGroup_LeftHand,
00313     eCharacterGroup_RightHand,
00314     eCharacterGroup_Props,
00315     eCharacterGroup_GameModeParent,
00316 
00317     // Added for 4.5 
00318 
00319     eCharacterGroup_Neck,
00320     eCharacterGroup_LeftFoot,
00321     eCharacterGroup_RightFoot,
00322 
00323     eLastCharacterGroupId
00324 } ECharacterGroupId;
00325 
00326 
00327 typedef enum 
00328 {
00329     eCharacterLink,
00330     eControlSetLink,
00331     eControlSetEffector,
00332     eControlSetEffectorAux
00333 } ECharacterLinkType;
00334 
00340 class KFBX_DLL KFbxCharacterLink
00341 {
00342 public:
00343 
00344     KFbxCharacterLink();
00345     KFbxCharacterLink(const KFbxCharacterLink& pCharacterLink);
00346     KFbxCharacterLink& operator=(const KFbxCharacterLink& pCharacterLink);
00347     void Reset();
00348 
00350     KFbxNode* mNode;
00351 
00354     KString mTemplateName;
00355 
00357     KFbxVector4 mOffsetT;
00359     KFbxVector4 mOffsetR;
00361     KFbxVector4 mOffsetS;
00363     KFbxVector4 mParentROffset;
00364 
00366     bool        mHasRotSpace;
00368     KFbxLimits  mRLimits;
00370     KFbxVector4 mPreRotation;
00372     KFbxVector4 mPostRotation;
00374     int         mRotOrder;
00376     double      mAxisLen;
00377 
00378 
00380 //
00381 //  WARNING!
00382 //
00383 //  Anything beyond these lines may not be documented accurately and is 
00384 //  subject to change without notice.
00385 //
00387 
00388 #ifndef DOXYGEN_SHOULD_SKIP_THIS    
00389 
00390     KFbxProperty mPropertyLink;
00391 
00392 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00393 
00394 };
00395 
00410 class KFBX_DLL KFbxCharacter : public KFbxConstraint
00411 {
00412     KFBXOBJECT_DECLARE(KFbxCharacter);
00413 
00414 public:
00421     void Reset();
00422 
00427     void SetInput(ECharacterInputType pInputType, KFbxObject* pInputObject = NULL);
00428 
00430     ECharacterInputType GetInputType() const;
00431 
00437     KFbxObject* GetInputObject() const;
00438 
00446     bool SetCharacterLink(ECharacterNodeId pCharacterNodeId, const KFbxCharacterLink& pCharacterLink, bool pUpdateObjectList = true);
00447 
00453     bool GetCharacterLink(ECharacterNodeId pCharacterNodeId, KFbxCharacterLink* pCharacterLink = NULL) const;
00454 
00458     KFbxControlSet& GetControlSet() const;
00459 
00463     KFbxFilterSet& GetFilterSet() const;
00464 
00469     static int GetCharacterGroupCount(ECharacterGroupId pCharacterGroupId);
00470 
00476     static ECharacterNodeId GetCharacterGroupElementByIndex(ECharacterGroupId pCharacterGroupId, int pIndex);
00477 
00478     
00484     static char* GetCharacterGroupNameByIndex(ECharacterGroupId pCharacterGroupId, int pIndex);
00485 
00491     static int GetCharacterGroupVersionByIndex(ECharacterGroupId pCharacterGroupId, int pIndex);
00492 
00500     static bool FindCharacterGroupIndexByName(char* pName, bool pForceGroupId, ECharacterGroupId& pCharacterGroupId, int& pIndex);
00501 
00509     static bool GetCharacterGroupIndexByElement(ECharacterNodeId pCharacterNodeId, ECharacterGroupId& pCharacterGroupId, int& pIndex);
00510 
00517     static bool GetCharacterGroupVersionByElement(ECharacterNodeId pCharacterNodeId, int& pVersion);
00518 
00526     static bool GetCharacterNodeNameFromNodeId(ECharacterNodeId pCharacterNodeId, char*& pName);
00527 
00533     static bool GetCharacterNodeIdFromNodeName(char* pName, ECharacterNodeId& pCharacterNodeId);
00534 
00535     typedef enum 
00536     {
00537         eINTERNAL_ERROR,
00538         eERROR_COUNT
00539     } EError; 
00540 
00541 
00543 //
00544 //  WARNING!
00545 //
00546 //  Anything beyond these lines may not be documented accurately and is 
00547 //  subject to change without notice.
00548 //
00550 
00551 #ifndef DOXYGEN_SHOULD_SKIP_THIS    
00552 
00553     virtual KObject* GetFbxObject_internal();
00554     virtual KObject const* GetFbxObject_internal() const;
00555 
00556     // Clone
00557     virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType) const;
00558 
00559 protected:
00560     KFbxCharacter& operator=(KFbxCharacter const& pCharacter); 
00561 
00562 public:
00563     virtual KFbxObject::ENameSpace GetNameSpace() const; 
00564 
00565     static char const* GetNamePrefix() { return CONSTRAINT_PREFIX; }
00566     
00567     KFbxCharacter(KFbxSdkManager& pManager, char const* pName);
00568     ~KFbxCharacter();
00569 
00570     virtual void Destruct(bool pRecursive, bool pDependents);
00571 
00572     virtual EConstraintType GetConstraintType();
00573     virtual KString         GetTypeName() const;
00574 
00575     virtual KStringList GetTypeFlags() const;
00576 
00577     // KFbxTakeNodeContainer virtual functions
00578     virtual void AddChannels(KFbxTakeNode *pTakeNode);
00579 
00580     bool FbxPlugNotify(KFbxPlugEvent const &pEvent);
00581 
00582     KFbxCharacter_Internal* mPH;
00583     
00584     bool GetFilterSetNameFromPropertyNameOrModeAndIndex( char const*  &pFilterSetName, char const* pPropertyName, int pIndex )const ;
00585     bool GetPropertyNameAndModeNameAndIndexFromFilterSetName(char const* &pPropertyName,char const* &pPropertyModeName,int &pIndex, char const* pFilterSetName) const;  
00586     
00587     KError mError;
00588 
00589     KString mName;  
00590     KFbxCharacterLink mCharacterLink[eCharacterLastNodeId];
00591     KFbxControlSet* mControlSet;
00592     KFbxFilterSet* mFilterSet;
00593 
00594     friend class KFbxScene;
00595     friend class KFbxNode;
00596     friend class KFbxReaderFbx;
00597     friend class KFbxCharacter_Internal;
00598 
00599 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00600 
00601 protected:
00602     
00603 };
00604 
00605 typedef KFbxCharacter* HKFbxCharacter;
00606 
00607 #include <fbxfilesdk_nsend.h>
00608 
00609 #endif // #ifndef _FBXSDK_CHARACTER_H_
00610 
00611