Open Reality Reference Guide
fbcharactersolver.h
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
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
116 
119 {
121 public:
126  FBCharacterSolver(const char* pName, HIObject pObject=NULL);
127 
128 #ifndef DOXYGEN_SHOULD_SKIP_THIS
129  IObject_Declare(override);
130 #endif
131 
133  FBPropertyCharacter TargetCharacter;
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 
210 
211 
212 
217  void SetExtraBoneModelAt(FBModel* pModel, int pIndex);
222  void SetExtraFKModelAt(FBModelMarker* pModel, int pIndex);
223 
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 
278 
282 
285  void SetBlendAuxiliaryWithEffector(bool pBlendAux);
286 };
287 
288 
289 // Registered Character Solver and Instanciation
290 
294 FBSDK_DLL int FBGetCharacterExternalSolverCount();
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
A character is the link between a motion source and a character model.
Definition: fbcharacter.h:1388
Used to work with character poses.
Stores options for operations on poses.
Constraint class.
virtual double GetCharacterSolverVersion()
Version of the solver. Needs to be overloaded in derived class.
bool BackgroundEvaluateInfoNotify(FBEvaluateInfo *pBackgroundEvaluateInfo, kBackgroundEvaluationCallback pFunction, void *pCustomData=NULL)
Enable evaluation notification.
FBPropertyComponent Source
Read Write Property: Source character when doing a character retarget.
virtual FBBodyPartId GetExtraFKBodyPartAt(int pIndex)
Return The specified extra FK BodyPart (ex.
virtual const char * GetExtraFKNameAt(int pIndex)
Return the specified extra FK Name (ex.
void SetExtraBoneModelAt(FBModel *pModel, int pIndex)
Set the specified extra Bone model for a specified Extra Bone Index.
bool GetDoubleSolve()
Returns true when control rig has Double Solve property on.
void BackgroundEvaluateInfoEnd(FBEvaluateInfo *pBackgroundEvaluateInfo)
Release background evaluation info - very important.
FBModelMarker * GetExtraFKModelAt(int pIndex)
Return the specified extra FK model (ex.
virtual int GetExtraFKCount()
Return number of extra FK model (ex.
virtual int GetExtraBoneCount()
Return number of extra Bone model (ex.
void SetParentRotationOffset(FBRVector &pR, int pIndex)
Set the Parent Rotation Offset of the Given Extra Bone Index.
virtual const char * GetExtraBoneNameAt(int pIndex)
Return The specified extra Bone name (ex.
FBPropertyCharacter TargetCharacter
Read Write Property: The character being constrained.
void GetParentRotationOffset(FBRVector &pR, int pIndex)
Get the Parent Rotation Offset of the Given Extra Bone Index.
virtual void ResetExtraProperties()
Support for resetting properties that are defined and specific to custom solver Override this functio...
FBEvaluateInfo * BackgroundEvaluateInfoBegin(FBEvaluateInfo *pSourceEvaluateInfo, bool pEvaluateCandidates=false)
Start background evaluation.
FBModel * GetExtraBoneModelAt(int pIndex)
Return The specified extra Bone model (ex.
virtual FBBodyPartId GetExtraBoneBodyPartAt(int pIndex)
Return The specified extra Bone BodyPart (ex.
bool GetRigAlign()
Returns true when control rig has Rig Align property on.
void SetTransformOffset(FBVector3d &pT, FBRVector &pR, FBSVector &pS, int pIndex)
Set the transform of the Given Extra Bone Index.
bool GetBlendAuxiliaryWithEffector()
Returns true means consider blending auxiliary with effector when evaluate control rig.
int mEvaluationId
Last Evaluation Id.
void GetTransformOffset(FBVector3d &pT, FBRVector &pR, FBSVector &pS, int pIndex)
Get the transform of the Given Extra Bone Index.
void ExtractOffsets()
Extract Transforms Of Extra Bones for character stance pose information.
virtual void CharacterPasteState(FBCharacter *pFromCharacter, FBCharacterPose *pPose, FBCharacterPoseOptions &pCharacterPoseOptions)
Paste the state of a character on another one.
FBEvaluateInfo * BackgroundEvaluateInfoRecursiveBegin(FBEvaluateInfo *pSourceEvaluateInfo, bool pForceUpdateLocals=false)
Start recursive background evaluation.
void SetExtraFKModelAt(FBModelMarker *pModel, int pIndex)
Set the specified extra FK model for a specified Extra FK Index (ex.
FBCharacterSolver(const char *pName, HIObject pObject=NULL)
Constructor.
void SetBlendAuxiliaryWithEffector(bool pBlendAux)
Set true means consider blending auxiliary with effector when evaluate an control rig.
Base class for constraints.
Definition: fbconstraint.h:134
AnimationNodeNotify evaluation information.
Model class.
Definition: fbmodel.h:274
Model marker class.
Definition: fbmodel.h:872
Three dimensional scaling vector.
Definition: fbtypes.h:566
Contains definitions for actors, characters, and marker sets In Development.
FBBodyPartId
Body part for character.
Definition: fbcharacter.h:447
@ kFBCtrlSetPartNone
No part selected.
Definition: fbcharacter.h:448
This class allows customization of the character manipulator behavior.
Contains definitions for object poses.
Basic class definitions.
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Contains definitions for devices, boxes and models.
FB_DEFINE_COMPONENT(K_DLLIMPORT, AnimationNode)
Animation node class.
Contains definitions for object poses.
class K_DLLIMPORT FBPropertyBaseComponent< FBComponent * > FBPropertyComponent
Property: FBPropertyBaseComponent(FBComponent*)
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
class K_DLLIMPORT FBVector3< double > FBVector3d
3D vector.
Definition: fbtypes.h:438