fbcharacterpose.h

Go to the documentation of this file.
00001 #ifndef __FBCHARACTERPOSE_H__
00002 #define __FBCHARACTERPOSE_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00043 #include <kaydaradef.h>
00044 #ifndef FBSDK_DLL
00045 
00048     #define FBSDK_DLL K_DLLIMPORT
00049 #endif
00050 
00051 #include <fbsdk/fbcomponent.h>
00052 #include <fbsdk/fbpose.h>
00053 
00054 #ifdef FBSDKUseNamespace
00055     namespace FBSDKNamespace {
00056 #endif
00057 
00058 FB_FORWARD( FBCharacter )
00059 FB_FORWARD( FBCharacterExtension )
00060 FB_FORWARD( FBObjectPose )
00061 FB_FORWARD( FBModel )
00062 
00063 
00064 enum FBCharacterPoseFlag
00065 {
00066     kFBCharacterPoseNoFlag              = 0,
00067     kFBCharacterPoseMirror              = 1,
00068     kFBCharacterPoseGravity             = 1<<1,
00069     kFBCharacterPoseMatchTX             = 1<<2,
00070     kFBCharacterPoseMatchTY             = 1<<3,
00071     kFBCharacterPoseMatchTZ             = 1<<4,
00072     kFBCharacterPoseMatchR              = 1<<5,
00073     kFBCharacterPoseMatchPivot          = 1<<6,
00074     kFBCharacterPoseUseKeyingGroup      = 1<<7
00075 };
00076 
00078 enum FBMirrorPlaneType
00079 {
00080     kFBMirrorPlaneTypeInvalid = -1,
00081     kFBMirrorPlaneTypeAuto    =  0,
00082     kFBMirrorPlaneTypeZY,
00083     kFBMirrorPlaneTypeXY,
00084     kFBMirrorPlaneTypeXZ,
00085     kFBMirrorPlaneTypeUser,
00086     kFBMirrorPlaneTypeEquation,
00087     kFBMirrorPlaneTypeCount
00088 };
00089 
00091 enum FBCharacterPoseKeyingMode
00092 {
00093     kFBCharacterPoseKeyingModeInvalid   = -1,
00094     kFBCharacterPoseKeyingModeFullBody  =  0,
00095     kFBCharacterPoseKeyingModeBodyPart,
00096     kFBCharacterPoseKeyingModeCount
00097 };
00098 
00100 // FBCharacterPoseOptions
00102 FB_FORWARD( FBCharacterPoseOptions );
00103 
00117 class FBSDK_DLL FBCharacterPoseOptions
00118 {
00119   public:
00120 
00124     FBModel* mModelToMatch;
00125 
00127     FBCharacterPoseKeyingMode mCharacterPoseKeyingMode;
00128 
00130     FBMirrorPlaneType mMirrorPlaneType;
00131 
00138     FBVector4<double> mMirrorPlaneEquation;
00139 
00141     double mMirrorPlaneTiltAngle;
00142 
00144     double mMirrorPlanePanAngle;
00145     
00148     FBCharacterPoseOptions();
00149 
00154     void SetFlag( FBCharacterPoseFlag pFlag, bool pValue );
00155 
00160     bool GetFlag( FBCharacterPoseFlag pFlag );
00161 
00164     void ClearFlag();
00165 
00166   private:
00167 
00168     FBCharacterPoseFlag mFlags;
00169 };
00170 
00172 // FBCharacterPose
00174 __FB_FORWARD( FBCharacterPose );
00175 
00179 class FBSDK_DLL FBCharacterPose : public FBPose
00180 {
00181     //--- Open Reality declaration.
00182     __FBClassDeclare( FBCharacterPose, FBPose );
00183 
00184   public:
00190     FBCharacterPose( char* pName, HIObject pObject = NULL );
00191 
00194     void ClearPose();
00195 
00198     void ClearCharacterPose();
00199 
00202     void ClearCharacterExtensionsPose();
00203 
00207     void CopyPose( FBCharacter& pCharacter );
00208 
00212     void CopyPoseCharacter( FBCharacter& pCharacter );
00213 
00217     void CopyPoseCharacterExtensions( FBCharacter& pCharacter );
00218 
00222     void CopyPoseCharacterExtension( FBCharacterExtension& pCharacterExtension );
00223 
00230     void PastePose( FBCharacter& pCharacter, FBCharacterPoseOptions& pCharacterPoseOptions );
00231 
00237     void PastePoseCharacter( FBCharacter& pCharacter, FBCharacterPoseOptions& pCharacterPoseOptions );
00238 
00244     void PastePoseCharacterExtensions( FBCharacter& pCharacter, FBCharacterPoseOptions& pCharacterPoseOptions );
00245 
00251     void PastePoseCharacterExtension( FBCharacterExtension& pCharacterExtension, FBCharacterPoseOptions& pCharacterPoseOptions );
00252 
00256     bool IsCharacterPoseStored();
00257 
00262     bool IsCharacterExtensionPoseStored( const char* pCharacterExtensionName );
00263 
00268     void CopyFrom( FBCharacterPose& pFromPose );
00269 
00274     void CopyPoseDataFrom( FBCharacterPose& pFromPose );
00275 
00279     void CopyPoseCharacterFrom( FBCharacterPose& pFromPose );
00280 
00284     void CopyPoseCharacterExtensionsFrom( FBCharacterPose& pFromPose );
00285 
00289     int GetCharacterExtensionPoseCount();
00290 
00295     FBObjectPose* GetCharacterExtensionPoseAt( int pIndex );
00296     
00301     FBObjectPose* GetCharacterExtensionPose( const char* pCharacterExtensionName );
00302 
00308     FBObjectPose* GetOrCreateCharacterExtensionPose( const char* pCharacterExtensionName );
00309 
00313     void RemoveCharacterExtensionPoseAt( int pIndex );
00314     
00318     void RemoveCharacterExtensionPose( const char* pCharacterExtensionName );
00319 
00324     FBString GetCharacterExtensionNameFromPose( FBObjectPose& pCharacterExtensionPose );
00325 
00331     void GetMirrorPlaneEquation( FBVector4<double>& pMirrorPlaneEquation, FBCharacter& pCharacter, FBCharacterPoseOptions& pCharacterPoseOptions );
00332 
00338     void GetMirrorPlaneEquation( FBMatrix& pMirrorPlaneEquation, FBCharacter& pCharacter, FBCharacterPoseOptions& pCharacterPoseOptions );
00339 
00340     
00344     int GetExtraBoneCount();
00345 
00350     FBModel* GetExtraBoneModelAt(int pIndex);
00351 
00358     void GetExtraBoneTransformOffset(FBVector3d &pT, FBVector3d &pR, FBVector3d &pS, int pIndex );
00359 
00366     void GetExtraBoneTransform(FBVector3d &pT, FBVector3d &pR, FBVector3d &pS, int pIndex );
00367 
00372     void GetExtraBoneParentRotationOffset( FBRVector &pR, int pIndex );
00373 
00377     void ApplyPoseCandidate();
00378 
00379   private:
00380 
00382 
00386     FBCharacterPose( const FBCharacterPose& );
00387     FBCharacterPose& operator=( const FBCharacterPose& );
00389 };
00390 
00392 // Property List: CharacterPose
00394 
00396 class FBSDK_DLL FBPropertyListCharacterPose : public FBPropertyListComponent
00397 {
00398   public:
00399     FBPropertyListCharacterPose();
00404     FBCharacterPose* operator[]( int pIndex );
00405 };
00406 
00407 #ifdef FBSDKUseNamespace
00408     }
00409 #endif
00410 
00411 #endif /* __FBCHARACTERPOSE_H__ */