fbsdk/fbcharactersolver.h Source File

fbcharactersolver.h
Go to the documentation of this file.
1 #ifndef __FBCHARACTERSOLVER_H__
2 #define __FBCHARACTERSOLVER_H__
3 /**************************************************************************
4  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5  All Rights Reserved.
6 
7  The coded instructions, statements, computer programs, and/or related
8  material (collectively the "Data") in these files contain unpublished
9  information proprietary to Autodesk, Inc. and/or its licensors, which is
10  protected by Canada and United States of America federal copyright law
11  and by international treaties.
12 
13  The Data may not be disclosed or distributed to third parties, in whole
14  or in part, without the prior written consent of Autodesk, Inc.
15  ("Autodesk").
16 
17  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24  FREE.
25 
26  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
45 #include <kaydaradef.h>
46 #ifndef FBSDK_DLL
47 
50  #define FBSDK_DLL K_DLLIMPORT
51 #endif
52 
53 #include <fbsdk/fbcomponent.h>
54 #include <fbsdk/fbcore.h>
55 #if !defined(K_NO_MANIPULATOR)
57 #endif
58 #include <fbsdk/fbcharacter.h>
59 #include <fbsdk/fbcharacterpose.h>
60 #include <fbsdk/fbobjectpose.h>
61 
62 #ifdef FBSDKUseNamespace
63  namespace FBSDKNamespace {
64 #endif
65 
66 FB_DEFINE_COMPONENT( FBSDK_DLL, CharacterSolver );
67 
75 #define FBRegisterCharacterSolver( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
76  HIObject RegisterCharacterSolver##ClassName##Create( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
77  { \
78  ClassName *Class = new ClassName(pName); \
79  Class->UniqueName = UniqueNameStr; \
80  if (Class->FBCreate()) { \
81  return Class->GetHIObject(); \
82  } else { \
83  delete Class; \
84  return NULL; \
85  } \
86  } \
87 \
88  FBLibraryModule( ClassName ) \
89  { \
90  FBRegisterObject( ClassName##R1,"FbxStorable/CharacterSolver",UniqueNameStr,Description,RegisterCharacterSolver##ClassName##Create, true, IconFilename ); \
91  FBRegisterObject( ClassName##R2,"Character/Solvers",UniqueNameStr,Description,RegisterCharacterSolver##ClassName##Create,true, IconFilename ); \
92  }
93 
99 #define FBCharacterSolverDeclare( ClassName, Parent ) \
100  FBClassDeclare( ClassName, Parent ); \
101  public: \
102  ClassName(const char* pName):Parent(pName) { FBClassInit; } \
103  private:
104 
108 #define FBCharacterSolverImplementation( ThisComponent ) \
109  FBClassImplementation( ThisComponent )
110 
112 // FBConstraint
114 __FB_FORWARD( FBCharacterSolver );
115 __FB_FORWARD( FBCharacterManipulatorCtrlSet );
116 
119 {
121 public:
126  FBCharacterSolver(const char* pName, HIObject pObject=NULL);
127 
128 #ifndef DOXYGEN_SHOULD_SKIP_THIS
130 #endif
131 
135 
142  FBEvaluateInfo* BackgroundEvaluateInfoBegin(FBEvaluateInfo* pSourceEvaluateInfo, bool pEvaluateCandidates=false);
143 
150  FBEvaluateInfo* BackgroundEvaluateInfoRecursiveBegin(FBEvaluateInfo* pSourceEvaluateInfo, bool pForceUpdateLocals=false);
151 
153  void BackgroundEvaluateInfoEnd(FBEvaluateInfo* pBackgroundEvaluateInfo);
154 
162  bool BackgroundEvaluateInfoNotify(FBEvaluateInfo* pBackgroundEvaluateInfo, kBackgroundEvaluationCallback pFunction, void* pCustomData=NULL);
163 
164  void ResetConnectorSetup();
165 
166  virtual FBCharacterManipulatorCtrlSet* CreateCharacterManipulatorCtrlSet(const char* pName);
167 
169  virtual double GetCharacterSolverVersion() { return 1.0; };
170 
174  virtual int GetExtraFKCount() { return 0; }
179  virtual const char* GetExtraFKNameAt(int pIndex) { return NULL; }
184  virtual FBBodyPartId GetExtraFKBodyPartAt(int pIndex) { return kFBCtrlSetPartNone; }
188  virtual int GetExtraBoneCount() { return 0; }
193  virtual const char* GetExtraBoneNameAt(int pIndex) { return NULL; }
199 
204  FBModel* GetExtraBoneModelAt(int pIndex);
209  FBModelMarker* GetExtraFKModelAt(int pIndex);
210 
211 
212 
217  void SetExtraBoneModelAt(FBModel* pModel, int pIndex);
222  void SetExtraFKModelAt(FBModelMarker* pModel, int pIndex);
223 
226  void ExtractOffsets();
234  void GetTransformOffset( FBVector3d &pT, FBRVector &pR, FBSVector &pS, int pIndex );
242  void SetTransformOffset( FBVector3d &pT, FBRVector &pR, FBSVector &pS, int pIndex );
249  void GetParentRotationOffset( FBRVector &pR, int pIndex );
256  void SetParentRotationOffset( FBRVector &pR, int pIndex );
257 
263  virtual void CharacterPasteState( FBCharacter* pFromCharacter, FBCharacterPose* pPose, FBCharacterPoseOptions& pCharacterPoseOptions) {}
264 
269  virtual void ResetExtraProperties() {};
270 
273  bool GetRigAlign();
274 
277  bool GetDoubleSolve();
278 
281  bool GetBlendAuxiliaryWithEffector();
282 
285  void SetBlendAuxiliaryWithEffector(bool pBlendAux);
286 };
287 
288 
289 // Registered Character Solver and Instanciation
290 
295 
300 FBSDK_DLL const char* FBGetCharacterExternalSolverName(int pIndex);
301 
306 FBSDK_DLL int FBGetCharacterExternalSolverIndex(const char* pName);
307 
313 FBSDK_DLL FBCharacterSolver* FBInstanciateCharacterExternalSolver(int pIndex, const char *pSolverName = NULL);
314 
315 
316 
317 #ifdef FBSDKUseNamespace
318  }
319 #endif
320 #endif
This class allows customization of the character manipulator behavior.
FBPropertyCharacter TargetCharacter
Read Write Property: The character being constrained.
virtual const char * GetExtraFKNameAt(int pIndex)
Return the specified extra FK Name (ex.
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:132
Model class.
Definition: fbmodel.h:273
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
virtual double GetCharacterSolverVersion()
Version of the solver. Needs to be overloaded in derived class.
#define FB_DEFINE_COMPONENT(DllTag, Type)
Define a component and give it the ability to be a property.
Definition: fbproperties.h:139
const char * FBGetCharacterExternalSolverName(int pIndex)
Get character external solver name.
Three dimensional scaling vector.
Definition: fbtypes.h:565
FBPropertyComponent Source
Read Write Property: Source character when doing a character retarget.
class FBVector3< double > FBVector3d
3D vector.
Definition: fbtypes.h:438
Contains definitions for object poses.
int mEvaluationId
Last Evaluation Id.
#define NULL
Definition: kaydara.h:179
class FBPropertyBaseComponent< FBCharacter * > FBPropertyCharacter
#define K_IMPLEMENTATION
Definition: iobject.h:53
virtual int GetExtraFKCount()
Return number of extra FK model (ex.
Contains definitions for devices, boxes and models.
#define IObject_Declare(IsPure)
Definition: iobject.h:75
Stores options for operations on poses.
virtual int GetExtraBoneCount()
Return number of extra Bone model (ex.
class FBPropertyBaseComponent< FBComponent * > FBPropertyComponent
Property: FBPropertyBaseComponent(FBComponent*)
virtual const char * GetExtraBoneNameAt(int pIndex)
Return The specified extra Bone name (ex.
FBCharacterSolver * FBInstanciateCharacterExternalSolver(int pIndex, const char *pSolverName=((void *) 0))
Instanciate the given external character solver.
Contains definitions for object poses.
Model marker class.
Definition: fbmodel.h:847
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
virtual FBBodyPartId GetExtraBoneBodyPartAt(int pIndex)
Return The specified extra Bone BodyPart (ex.
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
Basic class definitions.
Base class for constraints.
Definition: fbconstraint.h:134
int FBGetCharacterExternalSolverIndex(const char *pName)
Get character external solver index.
Contains definitions for actors, characters, and marker sets In Development.
Used to work with character poses.
A character is the link between a motion source and a character model.
Definition: fbcharacter.h:1364
virtual void CharacterPasteState(FBCharacter *pFromCharacter, FBCharacterPose *pPose, FBCharacterPoseOptions &pCharacterPoseOptions)
Paste the state of a character on another one.
AnimationNodeNotify evaluation information.
virtual FBBodyPartId GetExtraFKBodyPartAt(int pIndex)
Return The specified extra FK BodyPart (ex.
virtual void ResetExtraProperties()
Support for resetting properties that are defined and specific to custom solver Override this functio...
int FBGetCharacterExternalSolverCount()
Get character external solver count.
void(* kBackgroundEvaluationCallback)(const FBAnimationNode *pDst, const FBAnimationNode *pSrc, void *pCustomData)
Background Notification Function.
FBBodyPartId
Body part for character.
Definition: fbcharacter.h:446