Open Reality Reference Guide
fbobjectpose.h
Go to the documentation of this file.
1 #ifndef __FBOBJECTPOSE_H__
2 #define __FBOBJECTPOSE_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/fbpose.h>
53 
54 #ifdef FBSDKUseNamespace
55  namespace FBSDKNamespace {
56 #endif
57 
58 
61 {
62  kFBPoseTransformInvalid = -1,
63  kFBPoseTransformLocal = 0,
64  kFBPoseTransformGlobal,
65  kFBPoseTransformLocalRef,
66  kFBPoseTransformTypeCount
67 };
68 
71 {
72  kFBObjectPoseOptionsNoFlag = 0,
73  kFBObjectPoseOptionsTranslationX= 1,
74  kFBObjectPoseOptionsTranslationY= 1<<1,
75  kFBObjectPoseOptionsTranslationZ= 1<<2,
76  kFBObjectPoseOptionsRotation = 1<<3,
77  kFBObjectPoseOptionsScaling = 1<<4,
78 };
79 
82 {
83  kFBObjectPoseMirrorOptionsNoFlag = 0,
84  kFBObjectPoseMirrorOptionsUpdateLocal = 1,
85  kFBObjectPoseMirrorOptionsUpdateLocalMirrorParent = 1<<1,
86  kFBObjectPoseMirrorOptionsUpdateLocalRef = 1<<2,
87  kFBObjectPoseMirrorOptionsUpdateLocalRefMirrorRef = 1<<3,
88 };
89 
91 // FBObjectPoseOptions
94 
99 {
100  public:
101 
104 
107 
110 
113 
117 
122  void SetFlag( FBObjectPoseOptionsFlag pFlag, bool pValue );
123 
129 
132  void ClearFlag();
133 
134  private:
135 
137 };
138 
140 // FBObjectPoseMirrorOptions
143 
148 {
149  public:
150 
158 
162 
167  void SetFlag( FBObjectPoseMirrorOptionsFlag pFlag, bool pValue );
168 
174 
177  void ClearFlag();
178 
179  private:
180 
182 };
183 
185 // FBObjectPose
188 
193 {
194  //--- Open Reality declaration.
196 
197  public:
203  FBObjectPose( const char* pName, HIObject pObject=NULL );
204 
207  void ClearPose();
208 
212  bool IsPropertyPoseable( FBProperty &pProperty );
213 
218 
224  void CopyObjectPose( const char* pObjectName, FBComponent& pObject );
225 
231  void CopyPropertyPose( const char* pObjectName, FBProperty& pProperty );
232 
239  void PasteObjectPose( const char* pObjectName, FBComponent& pObject );
240 
247  void PastePropertyPose( const char* pObjectName, FBProperty& pProperty );
248 
255  void SetPropertyValue( const char* pObjectName, const char* pPropertyName, double* pValue, int pSize );
256 
263  void GetPropertyValue( double* pValue, int pSize, const char* pObjectName, const char* pPropertyName );
264 
270  bool IsPropertyStored( const char* pObjectName, const char* pPropertyName );
271 
278  void CopyTransform( const char* pObjectName, FBComponent& pObject, FBObjectPoseOptions& pObjectPoseOptions );
279 
287  void PasteTransform( const char* pObjectName, FBComponent& pObject, FBObjectPoseOptions& pObjectPoseOptions, FBEvaluateInfo* pEvaluateInfo = NULL );
288 
296  void SetTransform( FBTVector& pT, FBMatrix& pRM, FBMatrix& pSM, const char* pObjectName, FBPoseTransformType pPoseTransformType );
297 
306  bool GetTransform( FBTVector& pT, FBMatrix& pRM, FBMatrix& pSM, const char* pObjectName, FBPoseTransformType pPoseTransformType );
307 
314  bool IsTransformStored( const char* pObjectName, FBPoseTransformType pPoseTransformType = kFBPoseTransformInvalid );
315 
321  void MultTransformAllObjects( FBMatrix& pGX, FBModelTransformationType pTransformAttribute, FBPoseTransformType pPoseTransformType );
322 
329  void MultTransform( const char* pObjectName, FBMatrix& pGX, FBModelTransformationType pTransformAttribute, FBPoseTransformType pPoseTransformType );
330 
334  void MirrorPoseAllObjects( FBObjectPoseMirrorOptions& pObjectPoseMirrorOptions );
335 
340  void MirrorPose( const char* pObjectName, FBObjectPoseMirrorOptions& pObjectPoseMirrorOptions );
341 
348  void RemoveStanceOffsetAllObjects( FBObjectPose& pStancePose, FBPoseTransformType pPoseTransformType = kFBPoseTransformInvalid );
349 
357  void RemoveStanceOffset( const char* pObjectName, FBObjectPose& pStancePose, FBPoseTransformType pPoseTransformType = kFBPoseTransformInvalid );
358 
365  void AddStanceOffsetAllObjects( FBObjectPose& pStancePose, FBPoseTransformType pPoseTransformType = kFBPoseTransformInvalid );
366 
374  void AddStanceOffset( const char* pObjectName, FBObjectPose& pStancePose, FBPoseTransformType pPoseTransformType = kFBPoseTransformInvalid );
375 
386  (
387  FBObjectPose& pDstPose,
388  FBObjectPose& pSrcPose,
389  FBObjectPose& pDstStancePose,
390  FBObjectPose& pSrcStancePose,
391  FBVector4<double>& pMirrorPlaneEquation
392  );
393 
405  static void MirrorRetargetPose
406  (
407  FBObjectPose& pDstPose,
408  FBObjectPose& pSrcPose,
409  FBObjectPose& pDstStancePose,
410  FBObjectPose& pSrcStancePose,
411  FBVector4<double>& pMirrorPlaneEquation,
412  const char* pDstObjectName,
413  const char* pSrcObjectName
414  );
415 
423  static void RetargetPose
424  (
425  FBObjectPose& pDstPose,
426  FBObjectPose& pSrcPose,
427  const char* pDstObjectName,
428  const char* pSrcObjectName
429  );
430 
435  void CopyFrom( FBObjectPose& pFromPose );
436 
441  void CopyPoseDataFrom( FBObjectPose& pFromPose );
442 
448  void CopyPoseAllObjectsTransformFrom( FBObjectPose& pFromPose, FBPoseTransformType pPoseTransformType = kFBPoseTransformInvalid );
449 
456  void CopyPoseTransformFrom( FBObjectPose& pFromPose, const char* pObjectName, FBPoseTransformType pPoseTransformType = kFBPoseTransformInvalid );
457 
458  private:
459 
461 
465  FBObjectPose( const FBObjectPose& );
466  FBObjectPose& operator=( const FBObjectPose& );
468 };
469 
471 // Property List: ObjectPose
473 
476 {
477  public:
483  FBObjectPose* operator[]( int pIndex );
484 };
485 
487 // Useful functions
489 
495 FBSDK_DLL void GetPlaneEquation( FBVector4<double>& pPlaneEquation, const FBTVector& pPlaneNormalVector, const FBTVector& pPointOnPlane );
496 
502 FBSDK_DLL void GetPlaneEquation( FBVector4<double>& pPlaneEquation, const FBTVector& pPointOnPlane, const FBMatrix& pPlaneRM );
503 
508 FBSDK_DLL void GetPlaneRotation( FBMatrix& pPlaneRM, const FBVector4<double>& pPlaneEquation );
509 
514 FBSDK_DLL void NormalizePlaneEquation( FBVector4<double>& pNormalizedPlaneEquation, FBVector4<double>& pPlaneEquation );
515 
525 FBSDK_DLL void MirrorTransform( FBTVector& pMirrorT, FBMatrix& pMirrorRM, FBMatrix& pMirrorSM, const FBTVector& pT, const FBMatrix& pRM, const FBMatrix& pSM, const FBVector4<double>& pPlaneEquation );
526 
532 FBSDK_DLL void MirrorTransformT( FBTVector& pMirrorT, const FBTVector& pT, const FBVector4<double>& pPlaneEquation );
533 
539 FBSDK_DLL void MirrorTransformR( FBMatrix& pMirrorRM, const FBMatrix& pRM, const FBVector4<double>& pPlaneEquation );
540 
541 
542 #ifdef FBSDKUseNamespace
543  }
544 #endif
545 
546 #endif /* __FBOBJECTPOSE_H__ */
MotionBuilder SDK base class.
Definition: fbcomponent.h:651
AnimationNodeNotify evaluation information.
Four x Four (double) Matrix.
Definition: fbtypes.h:290
FBObjectPose class.
Definition: fbobjectpose.h:193
void CopyFrom(FBObjectPose &pFromPose)
Copy everything from a given object.
void ClearPose()
Clear all the data of the pose.
void CopyPoseAllObjectsTransformFrom(FBObjectPose &pFromPose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Copy all the transforms from a given pose.
void SetTransform(FBTVector &pT, FBMatrix &pRM, FBMatrix &pSM, const char *pObjectName, FBPoseTransformType pPoseTransformType)
Set the transform of an object in the pose.
FBStringList GetStoredObjectNames()
Get all the object names currently stored in this pose.
static void RetargetPose(FBObjectPose &pDstPose, FBObjectPose &pSrcPose, const char *pDstObjectName, const char *pSrcObjectName)
Retarget the non-transform properties from the SrcPose to the DstPose.
void AddStanceOffsetAllObjects(FBObjectPose &pStancePose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Add the StanceOffset to all the objects in the pose.
FBObjectPose(const char *pName, HIObject pObject=NULL)
Public constructor.
void PastePropertyPose(const char *pObjectName, FBProperty &pProperty)
Paste the pose of a property of an object.
void MirrorPose(const char *pObjectName, FBObjectPoseMirrorOptions &pObjectPoseMirrorOptions)
Mirror the transform of an object in the pose.
void SetPropertyValue(const char *pObjectName, const char *pPropertyName, double *pValue, int pSize)
Set the value of a property in the pose.
void MultTransform(const char *pObjectName, FBMatrix &pGX, FBModelTransformationType pTransformAttribute, FBPoseTransformType pPoseTransformType)
Multiply the transform of an objects in the pose.
static void MirrorRetargetPoseAllObjects(FBObjectPose &pDstPose, FBObjectPose &pSrcPose, FBObjectPose &pDstStancePose, FBObjectPose &pSrcStancePose, FBVector4< double > &pMirrorPlaneEquation)
Mirror the transform of all objects in the SrcPose and retarget the result on the DstPose.
bool IsPropertyStored(const char *pObjectName, const char *pPropertyName)
Is the property stored in the pose?
void CopyObjectPose(const char *pObjectName, FBComponent &pObject)
Copy the pose of all the properties of an object.
void PasteTransform(const char *pObjectName, FBComponent &pObject, FBObjectPoseOptions &pObjectPoseOptions, FBEvaluateInfo *pEvaluateInfo=NULL)
Paste the transform of an object.
void CopyTransform(const char *pObjectName, FBComponent &pObject, FBObjectPoseOptions &pObjectPoseOptions)
Copy the transform of an object.
void MultTransformAllObjects(FBMatrix &pGX, FBModelTransformationType pTransformAttribute, FBPoseTransformType pPoseTransformType)
Multiply the transform of all objects in the pose.
void RemoveStanceOffset(const char *pObjectName, FBObjectPose &pStancePose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Remove the StanceOffset from an object in the pose.
void AddStanceOffset(const char *pObjectName, FBObjectPose &pStancePose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Add the StanceOffset to an object in the pose.
void GetPropertyValue(double *pValue, int pSize, const char *pObjectName, const char *pPropertyName)
Get the value of a property stored in the pose.
static void MirrorRetargetPose(FBObjectPose &pDstPose, FBObjectPose &pSrcPose, FBObjectPose &pDstStancePose, FBObjectPose &pSrcStancePose, FBVector4< double > &pMirrorPlaneEquation, const char *pDstObjectName, const char *pSrcObjectName)
Mirror the transform of an object in the SrcPose and retarget the result on the DstPose.
void CopyPropertyPose(const char *pObjectName, FBProperty &pProperty)
Copy the pose of a property of an object.
void RemoveStanceOffsetAllObjects(FBObjectPose &pStancePose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Remove the StanceOffset from all the objects in the pose.
bool GetTransform(FBTVector &pT, FBMatrix &pRM, FBMatrix &pSM, const char *pObjectName, FBPoseTransformType pPoseTransformType)
Get the transform of an object in the pose.
void CopyPoseTransformFrom(FBObjectPose &pFromPose, const char *pObjectName, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Copy the transforms of an object from a given pose.
void CopyPoseDataFrom(FBObjectPose &pFromPose)
Copy all the pose data from a given pose.
bool IsTransformStored(const char *pObjectName, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Is the transform of this object stored in the specified TransformType?
void MirrorPoseAllObjects(FBObjectPoseMirrorOptions &pObjectPoseMirrorOptions)
Mirror the transform of all objects in the pose.
void PasteObjectPose(const char *pObjectName, FBComponent &pObject)
Paste the pose of all the properties of an object.
bool IsPropertyPoseable(FBProperty &pProperty)
Is the property poseable?
FBObjectPoseMirrorOptions class.
Definition: fbobjectpose.h:148
void ClearFlag()
Clear all flags.
FBVector4< double > mMirrorPlaneEquation
Equation of the mirror plane.
Definition: fbobjectpose.h:157
FBObjectPoseMirrorOptions()
Constructor.
bool GetFlag(FBObjectPoseMirrorOptionsFlag pFlag)
Get a flag value.
void SetFlag(FBObjectPoseMirrorOptionsFlag pFlag, bool pValue)
Set a flag value.
FBObjectPoseOptions class.
Definition: fbobjectpose.h:99
void ClearFlag()
Clear all flags.
FBTVector mReferenceGT
Global translation vector of reference object.
Definition: fbobjectpose.h:106
void SetFlag(FBObjectPoseOptionsFlag pFlag, bool pValue)
Set a flag value.
FBMatrix mReferenceGRM
Global rotation matrix of reference object.
Definition: fbobjectpose.h:109
bool GetFlag(FBObjectPoseOptionsFlag pFlag)
Get a flag value.
FBPoseTransformType mPoseTransformType
Transform type (Local, Global or LocalRef).
Definition: fbobjectpose.h:103
FBObjectPoseOptions()
Constructor.
FBMatrix mReferenceGSM
Global scaling matrix of reference object.
Definition: fbobjectpose.h:112
Pose class.
Definition: fbpose.h:76
Property: Base property class.
Definition: fbproperties.h:195
PropertyList: Concrete class for PropertyList of component
Definition: fbcomponent.h:536
PropertyList: ObjectPose.
Definition: fbobjectpose.h:476
FBObjectPose * operator[](int pIndex)
Get the object pose at pIndex.
String list.
Definition: fbstring.h:208
Basic class definitions.
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
FBModelTransformationType
Types of transformation vector/matrices possible.
Definition: fbmodel.h:167
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbobjectpose.h:48
K_DLLIMPORT void MirrorTransformR(FBMatrix &pMirrorRM, const FBMatrix &pRM, const FBVector4< double > &pPlaneEquation)
Mirror a rotation using the specified mirror plane.
FBPoseTransformType
Transform mode of pose.
Definition: fbobjectpose.h:61
K_DLLIMPORT void NormalizePlaneEquation(FBVector4< double > &pNormalizedPlaneEquation, FBVector4< double > &pPlaneEquation)
Normalize a plane equation.
K_DLLIMPORT void GetPlaneRotation(FBMatrix &pPlaneRM, const FBVector4< double > &pPlaneEquation)
Get the plane rotation matrix from a plane equation.
FBObjectPoseMirrorOptionsFlag
ObjectPoseMirrorOptions flags.
Definition: fbobjectpose.h:82
K_DLLIMPORT void MirrorTransform(FBTVector &pMirrorT, FBMatrix &pMirrorRM, FBMatrix &pMirrorSM, const FBTVector &pT, const FBMatrix &pRM, const FBMatrix &pSM, const FBVector4< double > &pPlaneEquation)
Mirror a transformation using the specified mirror plane.
FBObjectPoseOptionsFlag
ObjectPoseOptions flags.
Definition: fbobjectpose.h:71
K_DLLIMPORT void GetPlaneEquation(FBVector4< double > &pPlaneEquation, const FBTVector &pPlaneNormalVector, const FBTVector &pPointOnPlane)
Get a plane equation from a normal vector and a point on the plane.
K_DLLIMPORT void MirrorTransformT(FBTVector &pMirrorT, const FBTVector &pT, const FBVector4< double > &pPlaneEquation)
Mirror a translation using the specified mirror plane.
Access to poses.
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68