fbcharactersolver.h

Go to the documentation of this file.
00001 #ifndef __FBCHARACTERSOLVER_H__
00002 #define __FBCHARACTERSOLVER_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 
00045 #include <kaydaradef.h>
00046 #ifndef FBSDK_DLL 
00047 
00050     #define FBSDK_DLL K_DLLIMPORT
00051 #endif
00052 
00053 #include <fbsdk/fbcomponent.h>
00054 #include <fbsdk/fbcore.h>
00055 #include <fbsdk/fbcharactermanipulator.h>
00056 #include <fbsdk/fbcharacter.h>
00057 #include <fbsdk/fbcharacterpose.h>
00058 #include <fbsdk/fbobjectpose.h>
00059 
00060 #ifdef FBSDKUseNamespace
00061     namespace FBSDKNamespace {
00062 #endif
00063 
00064 FB_DEFINE_COMPONENT( FBSDK_DLL, CharacterSolver );
00065 
00073 #define FBRegisterCharacterSolver( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00074     HIObject RegisterCharacterSolver##ClassName##Create( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
00075     { \
00076       ClassName *Class = new ClassName(pName); \
00077         Class->UniqueName = UniqueNameStr; \
00078         if (Class->FBCreate()) { \
00079             return Class->GetHIObject(); \
00080         } else { \
00081             delete Class; \
00082             return NULL; \
00083         } \
00084     } \
00085 \
00086     FBLibraryModule( ClassName ) \
00087     {   \
00088         FBRegisterObject( ClassName##R1,"FbxStorable/CharacterSolver",UniqueNameStr,Description,RegisterCharacterSolver##ClassName##Create, true, IconFilename ); \
00089         FBRegisterObject( ClassName##R2,"Character/Solvers",UniqueNameStr,Description,RegisterCharacterSolver##ClassName##Create,true, IconFilename ); \
00090     }
00091 
00097 #define FBCharacterSolverDeclare( ClassName, Parent ) \
00098     FBClassDeclare( ClassName, Parent ); \
00099   public: \
00100     ClassName(const char* pName):Parent(pName) { FBClassInit; } \
00101   private:
00102 
00106 #define FBCharacterSolverImplementation( ThisComponent ) \
00107         FBClassImplementation( ThisComponent )
00108 
00110 // FBConstraint
00112 __FB_FORWARD( FBCharacterSolver);
00113 
00115 class FBSDK_DLL FBCharacterSolver : public FBConstraint 
00116 {
00117     __FBClassDeclare( FBCharacterSolver,FBConstraint );
00118 public:
00123     FBCharacterSolver(const char* pName, HIObject pObject=NULL);
00124 
00125 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00126     IObject_Declare(K_IMPLEMENTATION);
00127 #endif
00128 
00129     int mEvaluationId;                      
00130     FBPropertyCharacter TargetCharacter;    
00131     FBPropertyComponent Source;             
00132 
00139     FBEvaluateInfo* BackgroundEvaluateInfoBegin(FBEvaluateInfo* pSourceEvaluateInfo, bool pEvaluateCandidates=false);
00140 
00147     FBEvaluateInfo* BackgroundEvaluateInfoRecursiveBegin(FBEvaluateInfo* pSourceEvaluateInfo, bool pForceUpdateLocals=false);
00148 
00150     void            BackgroundEvaluateInfoEnd(FBEvaluateInfo* pBackgroundEvaluateInfo);
00151 
00159     bool            BackgroundEvaluateInfoNotify(FBEvaluateInfo* pBackgroundEvaluateInfo, kBackgroundEvaluationCallback pFunction, void* pCustomData=NULL);
00160 
00161     void            ResetConnectorSetup();
00162     
00163     virtual FBCharacterManipulatorCtrlSet* CreateCharacterManipulatorCtrlSet(const char* pName);
00164 
00166     virtual double  GetCharacterSolverVersion() { return 1.0; };
00167     
00171     virtual int         GetExtraFKCount() { return 0; }
00176     virtual const char* GetExtraFKNameAt(int pIndex) { return NULL; }
00181     virtual FBBodyPartId GetExtraFKBodyPartAt(int pIndex) { return kFBCtrlSetPartNone; }
00185     virtual int         GetExtraBoneCount() { return 0; }
00190     virtual const char* GetExtraBoneNameAt(int pIndex) { return NULL; }
00195     virtual FBBodyPartId GetExtraBoneBodyPartAt(int pIndex) { return kFBCtrlSetPartNone; }
00196 
00201     FBModel*    GetExtraBoneModelAt(int pIndex);
00206     FBModelMarker*    GetExtraFKModelAt(int pIndex);
00207 
00208 
00209 
00214     void    SetExtraBoneModelAt(FBModel* pModel, int pIndex);
00219     void    SetExtraFKModelAt(FBModelMarker* pModel, int pIndex);
00220 
00223     void ExtractOffsets();
00231     void GetTransformOffset( FBVector3d &pT, FBRVector &pR, FBSVector &pS, int pIndex );
00239     void SetTransformOffset( FBVector3d &pT, FBRVector &pR, FBSVector &pS, int pIndex );
00246     void GetParentRotationOffset( FBRVector &pR, int pIndex );
00253     void SetParentRotationOffset( FBRVector &pR, int pIndex );
00254 
00260     virtual void CharacterPasteState( FBCharacter* pFromCharacter, FBCharacterPose* pPose, FBCharacterPoseOptions& pCharacterPoseOptions) {}
00261 
00266     virtual void ResetExtraProperties() {};
00267     
00270     bool GetRigAlign();
00271 
00274     bool GetDoubleSolve();
00275 };
00276 
00277 
00278 // Registered Character Solver and Instanciation
00279 
00283 FBSDK_DLL int FBGetCharacterExternalSolverCount();
00284 
00289 FBSDK_DLL const char* FBGetCharacterExternalSolverName(int pIndex);
00290 
00295 FBSDK_DLL int FBGetCharacterExternalSolverIndex(const char* pName);
00296 
00302 FBSDK_DLL FBCharacterSolver* FBInstanciateCharacterExternalSolver(int pIndex, const char *pSolverName = NULL);
00303 
00304 
00305 
00306 #ifdef FBSDKUseNamespace
00307     }
00308 #endif
00309 #endif