Open Reality Reference Guide
fbcharactermanipulator.h
Go to the documentation of this file.
1 #ifndef __FBCHARACTERMANIPULATOR_H__
2 #define __FBCHARACTERMANIPULATOR_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 
43 #include <kaydaradef.h>
44 #ifndef FBSDK_DLL
48  #define FBSDK_DLL K_DLLIMPORT
49 #endif
50 
51 #include <fbsdk/fbcomponent.h>
52 #include <fbsdk/fbcore.h>
53 #include <fbsdk/fbcharacter.h>
54 
55 #ifdef FBSDKUseNamespace
56  namespace FBSDKNamespace {
57 #endif
58 
60 // Return value for manipulation functions
64 {
68 };
69 
72 {
76 };
77 
80 {
83 };
84 
87 {
94 };
95 
98 {
102 };
103 
106 {
113 };
114 
117 {
122 };
123 
126 {
131 };
132 
133 FB_DEFINE_COMPONENT( FBSDK_DLL, CharacterManipulator );
134 FB_DEFINE_COMPONENT( FBSDK_DLL, CharacterManipulatorCtrlSet );
135 
137 // FBCharacterManipulator
139 
163 
166 {
168 public:
173  FBCharacterManipulator(const char* pName, HIObject pObject=NULL);
174 
180  virtual FBManipulationGetResult TranslationIsEditable( bool &pEditable, FBReferencialType pRefType ) = 0;
181 
182  // Manipulation Get/Set
190  virtual FBManipulationSetResult TranslationSet( FBTVector &pT, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat ) = 0;
198 
199  // Manipulation
207  virtual void TranslationStopManipulation () = 0;
208 
209 
210  //Rotation
216  virtual FBManipulationGetResult RotationIsEditable( bool &pEditable, FBReferencialType pRefType ) = 0;
217 
218  /* Matrix Get/Set */
226  virtual FBManipulationSetResult RotationSet( FBMatrix &pRM, FBReferencialType pRefType, FBSetType pSetType, bool pOnlyRoot = false ) = 0;
233 
234  /* Manipulation */
242  virtual void RotationStopManipulation () = 0;
243 
244  //Scaling
249  virtual FBManipulationGetResult ScalingIsEditable( bool &pEditable ) = 0;
250 
251  /* Manipulation Get/Set*/
259  virtual FBManipulationSetResult ScalingSet( FBSVector &pS, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat ) = 0;
266 
267  /* Manipulation */
275  virtual void ScalingStopManipulation () = 0;
276 
281 
286 
291 };
292 
298 #define FBCharacterManipulatorCtrlSetDeclare( ClassName, Parent ) \
299  FBClassDeclare( ClassName, Parent ); \
300  public: \
301  ClassName(const char* pName):Parent(pName) { FBClassInit; } \
302  private:
303 
307 #define FBCharacterManipulatorCtrlSetImplementation( ThisComponent ) \
308  FBClassImplementation( ThisComponent )
309 
311 // FBCharacterManipulatorCtrlSet
314 
317 {
319 public:
324  FBCharacterManipulatorCtrlSet(const char* pName, HIObject pObject=NULL);
325 
330 
335  virtual void AllocateState(FBCharacter* pCharacter);
336 
340  virtual void DeallocateState();
341 
345  bool IsFullBody();
346 
351 
355  bool IsBodyPart();
356 
361 
366 
370  bool IsIKPivotUse();
371 
374  virtual void SyncCharacter(FBEvaluateInfo *pEvalInfo);
375 
380 
385 
390 
395 
400 
406 
412 
419 
424  float GetEffectorReachTValue(int pEffectorId);
429  void SetEffectorReachTValue(int pEffectorId, float pValue);
430 
435  float GetEffectorPullValue(int pEffectorId);
440  void SetEffectorPullValue(int pEffectorId, float pValue);
441 
446  void TranslationSetGlobal(FBTVector pVector, int pEffectorId);
451  void TranslationSetLocal(FBTVector pVector, int pEffectorId);
452 
453  //For the following function, please see the description in the parent class.
454  //Translation
455  virtual FBManipulationGetResult TranslationIsEditable( bool &pEditable, FBReferencialType pRefType ) override;
456  // Manipulation Get/Set
457  virtual FBManipulationSetResult TranslationSet( FBTVector &pT, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat ) override;
459  // Manipulation
460  virtual FBManipulationStartResult TranslationStartManipulation( FBReferencialType pRefType, const FBTime* pTime = NULL ) override;
461  void TranslationStopManipulation () override;
462 
463  //Rotation
464  virtual FBManipulationGetResult RotationIsEditable( bool &pEditable, FBReferencialType pRefType ) override;
465  /* Matrix Get/Set */
466  virtual FBManipulationSetResult RotationSet( FBMatrix &pRM, FBReferencialType pRefType, FBSetType pSetType, bool pOnlyRoot = false ) override;
467  virtual FBManipulationGetResult RotationGet( FBMatrix &pRM, FBReferencialType pRefType ) override;
468  /* Manipulation */
470  virtual void RotationStopManipulation () override;
471 
472  //Scaling
473  virtual FBManipulationGetResult ScalingIsEditable( bool &pEditable ) override;
474  /* Manipulation Get/Set*/
476  virtual FBManipulationSetResult ScalingSet( FBSVector &pS, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat ) override;
477  /* Manipulation */
479  virtual void ScalingStopManipulation () override;
480 };
481 
482 #ifdef FBSDKUseNamespace
483  }
484 #endif
485 #endif
A character is the link between a motion source and a character model.
Definition: fbcharacter.h:1388
bool IsIKPivotUse()
Determine if IK pivot are used when manipualting a character.
virtual void ScalingStopManipulation() override
Called when the manipulation is finished.
FBCharacter * GetCharacter()
Returns the character being manipulated.
bool IsReachOverride()
Determine if the reach override option is enable for the manipulated character.
virtual void DeallocateState()
Override this method to deallocate the state allocate in the AllocateState() function.
float GetEffectorReachTValue(int pEffectorId)
Get the reach T (IK Blend T since MotionBuilder 2013) value for a specified effector on the current m...
void TranslationStopManipulation() override
Called when the manipulation is finished.
virtual FBManipulationStartResult ScalingStartManipulation(FBReferencialType pRefType) override
Called to determine if the manipulation can be done.
virtual void AllocateState(FBCharacter *pCharacter)
Override this method to allocate the necessary state requires when manipulating a character.
virtual FBManipulationGetResult ScalingIsEditable(bool &pEditable) override
Returned value will indicate if a scaling manipulation can be done.
FBEffectorId GetManipulatedEffectorIdForRotation()
Find the index of the currently manipulated effector for Rotation Only.
float GetEffectorPullValue(int pEffectorId)
Get the pull (IK Pull since MotionBuilder 2013) value for a specified effector on the current manipul...
void SetEffectorPullValue(int pEffectorId, float pValue)
Set the pull (IK Pull since MotionBuilder 2013) value for a specified effector on the current manipul...
FBBodyNodeId GetManipulatedBodyNode()
Find the index of the currently manipulated effector set.
FBEffectorSetID GetEffectorSet()
Find the index of the currently manipulated effector set.
virtual FBManipulationGetResult ScalingGet(FBSVector &pS, FBReferencialType pRefType) override
Get the scale manipulator position.
virtual FBManipulationGetResult RotationIsEditable(bool &pEditable, FBReferencialType pRefType) override
Returned value will indicate if a rotation manipulation can be done.
virtual FBManipulationStartResult RotationStartManipulation(FBReferencialType pRefType) override
Called to determine if the manipulation can be done.
virtual FBManipulationSetResult RotationSet(FBMatrix &pRM, FBReferencialType pRefType, FBSetType pSetType, bool pOnlyRoot=false) override
Set the value of the translation to the manipulated model.
virtual FBManipulationStartResult TranslationStartManipulation(FBReferencialType pRefType, const FBTime *pTime=NULL) override
Called to determine if the manipulation can be done.
void TranslationSetGlobal(FBTVector pVector, int pEffectorId)
Set the translation for the specified effector on the current manipulated character in global coordin...
bool IsFullBodyNoPull()
Determine if the character is in Full Body - No Pull keying mode.
bool IsDescendantPulling(FBEffectorId pEffectorId)
Determine if one of the effector's child has a IK Pull value bigger than 0.5 on the current manipulat...
virtual FBManipulationGetResult TranslationGet(FBTVector &pT, FBReferencialType pRefType, FBManipPivot pPivot=FBManipPivotObjectTranslation) override
Get the translation manipulator position.
void SetEffectorReachTValue(int pEffectorId, float pValue)
Set the reach T (IK Blend T since MotionBuilder 2013) value for a specified effector on the current m...
virtual FBManipulationSetResult ScalingSet(FBSVector &pS, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat) override
Set the value of the scale to the manipulated model.
virtual void RotationStopManipulation() override
Called when the manipulation is finished.
FBEffectorId GetDescendantEffector(FBEffectorId pEffectorId, int pIndex)
Return the child effector for the provided effector.
FBEffectorId GetManipulatedEffectorIdForTranslation()
Find the index of the currently manipulated effector For Translation.
virtual FBManipulationGetResult RotationGet(FBMatrix &pRM, FBReferencialType pRefType) override
Get the rotation manipulator position.
bool IsFullBody()
Determine if the character is in Full Body keying mode.
bool IsStiffnessOverride()
Determine if the stiffness override option is enable for the manipulated character.
virtual FBManipulationGetResult TranslationIsEditable(bool &pEditable, FBReferencialType pRefType) override
Returned value will indicate if a translation manipulation can be done.
FBCharacterManipulatorCtrlSet(const char *pName, HIObject pObject=NULL)
Constructor.
int GetDescendantEffectorCount(FBEffectorId pEffectorId)
Return the child effector count of the provided effector based on the skeleton hierarchy.
FBEffectorId GetManipulatedEffectorId()
Find the index of the currently manipulated effector for Translation or Rotation depending of Mode.
bool IsBodyPart()
Determine if the character is in Body Part keying mode.
void TranslationSetLocal(FBTVector pVector, int pEffectorId)
Set the translation for the specified effector on the current manipulated character in local coordina...
virtual void SyncCharacter(FBEvaluateInfo *pEvalInfo)
Synchronize the character after doing a manipulation using this function.
virtual FBManipulationSetResult TranslationSet(FBTVector &pT, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat) override
Set the value of the translation to the manipulated model.
Character Manipulator class.
virtual FBManipulationGetResult TranslationGet(FBTVector &pT, FBReferencialType pRefType, FBManipPivot pPivot=FBManipPivotObjectTranslation)=0
Get the translation manipulator position.
FBCharacterManipulator(const char *pName, HIObject pObject=NULL)
Constructor.
virtual void ScalingStopManipulation()=0
Called when the manipulation is finished.
virtual FBManipulationGetResult RotationGet(FBMatrix &pRM, FBReferencialType pRefType)=0
Get the rotation manipulator position.
virtual FBManipulationStartResult RotationStartManipulation(FBReferencialType pRefType)=0
Called to determine if the manipulation can be done.
virtual FBManipulationGetResult TranslationIsEditable(bool &pEditable, FBReferencialType pRefType)=0
Returned value will indicate if a translation manipulation can be done.
virtual FBManipulationSetResult ScalingSet(FBSVector &pS, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat)=0
Set the value of the scale to the manipulated model.
virtual void RotationStopManipulation()=0
Called when the manipulation is finished.
virtual FBManipulationSetResult RotationSet(FBMatrix &pRM, FBReferencialType pRefType, FBSetType pSetType, bool pOnlyRoot=false)=0
Set the value of the translation to the manipulated model.
virtual FBManipulationSetResult TranslationSet(FBTVector &pT, FBReferencialType pRefType, FBSetType pSetType, FBSetWhat pSetWhat)=0
Set the value of the translation to the manipulated model.
FBManipMode GetManipulatorMode()
return the manipulator Mode
virtual FBManipulationGetResult ScalingGet(FBSVector &pS, FBReferencialType pRefType)=0
Get the scale manipulator position.
virtual FBManipulationStartResult TranslationStartManipulation(FBReferencialType pRefType, const FBTime *pTime=NULL)=0
Called to determine if the manipulation can be done.
virtual FBManipulationGetResult ScalingIsEditable(bool &pEditable)=0
Returned value will indicate if a scaling manipulation can be done.
FBModel * GetManipulatedNode()
return the manipulated Model
virtual FBManipulationStartResult ScalingStartManipulation(FBReferencialType pRefType)=0
Called to determine if the manipulation can be done.
virtual void TranslationStopManipulation()=0
Called when the manipulation is finished.
virtual FBManipulationGetResult RotationIsEditable(bool &pEditable, FBReferencialType pRefType)=0
Returned value will indicate if a rotation manipulation can be done.
bool IsReleasePinPressed()
Call this to know if the Button Release is on when manipulating.
MotionBuilder SDK base class.
Definition: fbcomponent.h:651
AnimationNodeNotify evaluation information.
Four x Four (double) Matrix.
Definition: fbtypes.h:290
Model class.
Definition: fbmodel.h:274
Three dimensional scaling vector.
Definition: fbtypes.h:566
Time data structure.
Definition: fbtime.h:88
Contains definitions for actors, characters, and marker sets In Development.
FBEffectorId
All effector nodes.
Definition: fbcharacter.h:364
FBEffectorSetID
Effector ID identifier.
Definition: fbcharacter.h:416
FBBodyNodeId
All body nodes.
Definition: fbcharacter.h:125
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
FBSetType
Specify what to do with the provided value.
@ FBSetTypeExact
Set the value directly.
@ FBSetTypeNone
Do nothing with the value.
@ FBSetTypeCumulative
Add the provided value to the original value.
FBReferencialType
Specify the referential when a manipulation function is called.
@ FBRefTypeNone
No type specified.
@ FBRefTypeParent
Parenting mode.
@ FBRefTypeLocal
Referential is in local coordinate.
@ FBRefTypeGlobal
Referential is in global coordinate.
@ FBRefTypeLayer
Local additive rotation.
@ FBRefTypeSumLayers
Global additive rotation.
FBManipMode
Manipulator Mode.
@ FBManip_EditorRotation
Rotation Manipulation Mode.
@ FBManip_EditorScaling
Scaling Manipulation Mode.
@ FBManip_EditorTranslation
Translation Manipulation Mode.
@ FBManip_EditorOther
Unknown Manipulation Mode.
FBManipPivot
Specify how the pivot should be interpreted.
@ FBManipPivotObjectRotation
Consider the rotation of the pivot.
@ FBManipPivotObjectUnknown
Don't consider the pivot.
@ FBManipPivotObjectScaling
Consider the scaling of the pivot.
@ FBManipPivotObjectTranslation
Consider the translation of the pivot.
FBManipulationStartResult
Manipulation Start Result.
@ kFBManipulationOK
This is the default value to return, means that you will handle the manipulation.
@ kFBManipulationOKNoUndo
This value means that the manipulation will be done, but the manipulation will not be undoable.
@ kFBManipulationRefuse
Manipulation will be skipped.
FBSetWhat
Specify what part of the provided value should be used.
@ FBSetWhatX
Set only the X component of the value.
@ FBSetWhatNone
Do nothing with the value.
@ FBSetWhatZ
Set only the Z component of the value.
@ FBSetWhatY
Set only the Y component of the value.
@ FBSetWhatXYZ
Set the XYZ components of the value.
@ FBSetWhatAll
Set all components of the value.
__FB_FORWARD(FBCharacterManipulator)
Used to translate, rotate or scale a character.
FBManipulationSetResult
Manipulation Set Result.
@ kFBManipulationSetFail
Return this value when you have set the value.
@ kFBManipulationSetContinue
Return this value when you don't want handle the request, another manipulator will try to handle it.
FBManipulationGetResult
Manipulation Get Result.
@ kFBManipulationGetFail
Return this value to prevent other manipulator to handle the request.
@ kFBManipulationGetContinue
Return this value when you cannot provided the requested value, another manipulator will try to provi...
@ kFBManipulationGetDone
Return this value when you can provided the requested value.
Basic class definitions.
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
Contains definitions for devices, boxes and models.
FB_DEFINE_COMPONENT(K_DLLIMPORT, AnimationNode)
Animation node class.