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
45 
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__ */
FBObjectPoseMirrorOptions::SetFlag
void SetFlag(FBObjectPoseMirrorOptionsFlag pFlag, bool pValue)
Set a flag value.
FBPropertyListObjectPose::operator[]
FBObjectPose * operator[](int pIndex)
Get the object pose at pIndex.
FBObjectPose::GetTransform
bool GetTransform(FBTVector &pT, FBMatrix &pRM, FBMatrix &pSM, const char *pObjectName, FBPoseTransformType pPoseTransformType)
Get the transform of an object in the pose.
FBObjectPoseMirrorOptionsFlag
FBObjectPoseMirrorOptionsFlag
ObjectPoseMirrorOptions flags.
Definition: fbobjectpose.h:82
FBObjectPose::CopyPoseDataFrom
void CopyPoseDataFrom(FBObjectPose &pFromPose)
Copy all the pose data from a given pose.
FBObjectPoseOptions::mPoseTransformType
FBPoseTransformType mPoseTransformType
Transform type (Local, Global or LocalRef).
Definition: fbobjectpose.h:103
FBObjectPoseOptionsFlag
FBObjectPoseOptionsFlag
ObjectPoseOptions flags.
Definition: fbobjectpose.h:71
MirrorTransformR
K_DLLIMPORT void MirrorTransformR(FBMatrix &pMirrorRM, const FBMatrix &pRM, const FBVector4< double > &pPlaneEquation)
Mirror a rotation using the specified mirror plane.
FBObjectPose::MirrorPose
void MirrorPose(const char *pObjectName, FBObjectPoseMirrorOptions &pObjectPoseMirrorOptions)
Mirror the transform of an object in the pose.
FBObjectPose::CopyPoseTransformFrom
void CopyPoseTransformFrom(FBObjectPose &pFromPose, const char *pObjectName, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Copy the transforms of an object from a given pose.
FBObjectPoseMirrorOptions::mMirrorPlaneEquation
FBVector4< double > mMirrorPlaneEquation
Equation of the mirror plane.
Definition: fbobjectpose.h:157
FBObjectPoseMirrorOptions::FBObjectPoseMirrorOptions
FBObjectPoseMirrorOptions()
Constructor.
FBObjectPoseMirrorOptions
FBObjectPoseMirrorOptions class.
Definition: fbobjectpose.h:148
MirrorTransformT
K_DLLIMPORT void MirrorTransformT(FBTVector &pMirrorT, const FBTVector &pT, const FBVector4< double > &pPlaneEquation)
Mirror a translation using the specified mirror plane.
FBObjectPose::SetPropertyValue
void SetPropertyValue(const char *pObjectName, const char *pPropertyName, double *pValue, int pSize)
Set the value of a property in the pose.
FBObjectPose::IsPropertyStored
bool IsPropertyStored(const char *pObjectName, const char *pPropertyName)
Is the property stored in the pose?
FBStringList
String list.
Definition: fbstring.h:208
FBObjectPose::CopyPropertyPose
void CopyPropertyPose(const char *pObjectName, FBProperty &pProperty)
Copy the pose of a property of an object.
fbpose.h
Access to poses.
FBVector4< double >
FBSDK_DLL
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbobjectpose.h:48
FBObjectPose::AddStanceOffset
void AddStanceOffset(const char *pObjectName, FBObjectPose &pStancePose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Add the StanceOffset to an object in the pose.
GetPlaneEquation
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.
FBObjectPose::SetTransform
void SetTransform(FBTVector &pT, FBMatrix &pRM, FBMatrix &pSM, const char *pObjectName, FBPoseTransformType pPoseTransformType)
Set the transform of an object in the pose.
FBPose
Pose class.
Definition: fbpose.h:76
FBObjectPoseOptions::mReferenceGT
FBTVector mReferenceGT
Global translation vector of reference object.
Definition: fbobjectpose.h:106
FBObjectPose::GetStoredObjectNames
FBStringList GetStoredObjectNames()
Get all the object names currently stored in this pose.
FBObjectPoseOptions
FBObjectPoseOptions class.
Definition: fbobjectpose.h:99
FBObjectPose::FBObjectPose
FBObjectPose(const char *pName, HIObject pObject=NULL)
Public constructor.
FBObjectPose::AddStanceOffsetAllObjects
void AddStanceOffsetAllObjects(FBObjectPose &pStancePose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Add the StanceOffset to all the objects in the pose.
FBObjectPose::PasteObjectPose
void PasteObjectPose(const char *pObjectName, FBComponent &pObject)
Paste the pose of all the properties of an object.
__FBClassDeclare
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
FBObjectPose::MirrorRetargetPose
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.
FBProperty
Property: Base property class.
Definition: fbproperties.h:195
__FB_FORWARD
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
FBObjectPoseMirrorOptions::ClearFlag
void ClearFlag()
Clear all flags.
FBObjectPoseOptions::SetFlag
void SetFlag(FBObjectPoseOptionsFlag pFlag, bool pValue)
Set a flag value.
FBObjectPose::CopyFrom
void CopyFrom(FBObjectPose &pFromPose)
Copy everything from a given object.
FBObjectPoseOptions::mReferenceGRM
FBMatrix mReferenceGRM
Global rotation matrix of reference object.
Definition: fbobjectpose.h:109
FBObjectPose::PastePropertyPose
void PastePropertyPose(const char *pObjectName, FBProperty &pProperty)
Paste the pose of a property of an object.
GetPlaneRotation
K_DLLIMPORT void GetPlaneRotation(FBMatrix &pPlaneRM, const FBVector4< double > &pPlaneEquation)
Get the plane rotation matrix from a plane equation.
FBObjectPose::MirrorRetargetPoseAllObjects
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.
FBObjectPose::IsPropertyPoseable
bool IsPropertyPoseable(FBProperty &pProperty)
Is the property poseable?
FBObjectPose::MirrorPoseAllObjects
void MirrorPoseAllObjects(FBObjectPoseMirrorOptions &pObjectPoseMirrorOptions)
Mirror the transform of all objects in the pose.
FBMatrix
Four x Four (double) Matrix.
Definition: fbtypes.h:290
FBPropertyListObjectPose
PropertyList: ObjectPose.
Definition: fbobjectpose.h:476
FBObjectPoseOptions::mReferenceGSM
FBMatrix mReferenceGSM
Global scaling matrix of reference object.
Definition: fbobjectpose.h:112
FBModelTransformationType
FBModelTransformationType
Types of transformation vector/matrices possible.
Definition: fbmodel.h:167
FBObjectPoseMirrorOptions::GetFlag
bool GetFlag(FBObjectPoseMirrorOptionsFlag pFlag)
Get a flag value.
FBObjectPoseOptions::ClearFlag
void ClearFlag()
Clear all flags.
FBObjectPose
FBObjectPose class.
Definition: fbobjectpose.h:193
FBObjectPose::CopyPoseAllObjectsTransformFrom
void CopyPoseAllObjectsTransformFrom(FBObjectPose &pFromPose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Copy all the transforms from a given pose.
FBObjectPose::CopyTransform
void CopyTransform(const char *pObjectName, FBComponent &pObject, FBObjectPoseOptions &pObjectPoseOptions)
Copy the transform of an object.
fbcomponent.h
Basic class definitions.
FBObjectPoseOptions::GetFlag
bool GetFlag(FBObjectPoseOptionsFlag pFlag)
Get a flag value.
FBObjectPose::CopyObjectPose
void CopyObjectPose(const char *pObjectName, FBComponent &pObject)
Copy the pose of all the properties of an object.
FBPropertyListComponent
PropertyList: Concrete class for PropertyList of component
Definition: fbcomponent.h:536
FBObjectPose::PasteTransform
void PasteTransform(const char *pObjectName, FBComponent &pObject, FBObjectPoseOptions &pObjectPoseOptions, FBEvaluateInfo *pEvaluateInfo=NULL)
Paste the transform of an object.
FBObjectPose::MultTransform
void MultTransform(const char *pObjectName, FBMatrix &pGX, FBModelTransformationType pTransformAttribute, FBPoseTransformType pPoseTransformType)
Multiply the transform of an objects in the pose.
FBObjectPose::RemoveStanceOffsetAllObjects
void RemoveStanceOffsetAllObjects(FBObjectPose &pStancePose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Remove the StanceOffset from all the objects in the pose.
FB_FORWARD
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
FBObjectPoseOptions::FBObjectPoseOptions
FBObjectPoseOptions()
Constructor.
FBObjectPose::RetargetPose
static void RetargetPose(FBObjectPose &pDstPose, FBObjectPose &pSrcPose, const char *pDstObjectName, const char *pSrcObjectName)
Retarget the non-transform properties from the SrcPose to the DstPose.
FBPoseTransformType
FBPoseTransformType
Transform mode of pose.
Definition: fbobjectpose.h:61
FBObjectPose::RemoveStanceOffset
void RemoveStanceOffset(const char *pObjectName, FBObjectPose &pStancePose, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Remove the StanceOffset from an object in the pose.
FBEvaluateInfo
AnimationNodeNotify evaluation information.
Definition: fbevaluateinfo.h:79
NormalizePlaneEquation
K_DLLIMPORT void NormalizePlaneEquation(FBVector4< double > &pNormalizedPlaneEquation, FBVector4< double > &pPlaneEquation)
Normalize a plane equation.
FBComponent
MotionBuilder SDK base class.
Definition: fbcomponent.h:651
FBObjectPose::ClearPose
void ClearPose()
Clear all the data of the pose.
FBObjectPose::GetPropertyValue
void GetPropertyValue(double *pValue, int pSize, const char *pObjectName, const char *pPropertyName)
Get the value of a property stored in the pose.
FBObjectPose::MultTransformAllObjects
void MultTransformAllObjects(FBMatrix &pGX, FBModelTransformationType pTransformAttribute, FBPoseTransformType pPoseTransformType)
Multiply the transform of all objects in the pose.
FBObjectPose::IsTransformStored
bool IsTransformStored(const char *pObjectName, FBPoseTransformType pPoseTransformType=kFBPoseTransformInvalid)
Is the transform of this object stored in the specified TransformType?
MirrorTransform
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.