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*/,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(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(char *pName, HIObject pObject=NULL);
00124 
00125 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00126     IObject_Declare(Implementation);
00127 #endif
00128 
00129     int mEvaluationId;                      
00130     FBPropertyCharacter TargetCharacter;    
00131     FBPropertyComponent Source;             
00132 
00133     HFBEvaluateInfo BackgroundEvaluateInfo(HFBEvaluateInfo pSourceEvaluateInfo);
00134     void            ResetConnectorSetup();
00135     
00136     virtual FBCharacterManipulatorCtrlSet* CreateCharacterManipulatorCtrlSet(char* pName);
00137 
00139     virtual double  GetCharacterSolverVersion() { return 1.0; };
00140     
00144     virtual int         GetExtraFKCount() { return 0; }
00149     virtual const char* GetExtraFKNameAt(int pIndex) { return NULL; }
00154     virtual FBBodyPartId GetExtraFKBodyPartAt(int pIndex) { return kFBCtrlSetPartNone; }
00158     virtual int         GetExtraBoneCount() { return 0; }
00163     virtual const char* GetExtraBoneNameAt(int pIndex) { return NULL; }
00168     virtual FBBodyPartId GetExtraBoneBodyPartAt(int pIndex) { return kFBCtrlSetPartNone; }
00169 
00174     FBModel*    GetExtraBoneModelAt(int pIndex);
00179     FBModelMarker*    GetExtraFKModelAt(int pIndex);
00180 
00181 
00182 
00187     void    SetExtraBoneModelAt(FBModel* pModel, int pIndex);
00192     void    SetExtraFKModelAt(FBModelMarker* pModel, int pIndex);
00193 
00196     void ExtractOffsets();
00204     void GetTransformOffset( FBVector3d &pT, FBRVector &pR, FBSVector &pS, int pIndex );
00212     void SetTransformOffset( FBVector3d &pT, FBRVector &pR, FBSVector &pS, int pIndex );
00219     void GetParentRotationOffset( FBRVector &pR, int pIndex );
00226     void SetParentRotationOffset( FBRVector &pR, int pIndex );
00227 
00233     virtual void CharacterPasteState( FBCharacter* pFromCharacter, FBCharacterPose* pPose, FBCharacterPoseOptions& pCharacterPoseOptions) {}
00234 };
00235 
00236 
00237 // Registered Character Solver and Instanciation
00238 
00242 FBSDK_DLL int FBGetCharacterExternalSolverCount();
00243 
00248 FBSDK_DLL const char* FBGetCharacterExternalSolverName(int pIndex);
00249 
00254 FBSDK_DLL int FBGetCharacterExternalSolverIndex(char* pName);
00255 
00261 FBSDK_DLL FBCharacterSolver* FBInstanciateCharacterExternalSolver(int pIndex, const char *pSolverName = NULL);
00262 
00263 
00264 
00265 #ifdef FBSDKUseNamespace
00266     }
00267 #endif
00268 #endif