00001 #ifndef __FBCONSTRAINT_H__
00002 #define __FBCONSTRAINT_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00045 #include <kaydaradef.h>
00046 #ifndef FBSDK_DLL
00047
00050 #define FBSDK_DLL K_DLLIMPORT
00051 #endif
00052
00053 #include <fbsdk/fbcomponent.h>
00054 #include <fbsdk/fbcore.h>
00055
00056 #ifdef FBSDKUseNamespace
00057 namespace FBSDKNamespace {
00058 #endif
00059
00060 FB_DEFINE_COMPONENT( FBSDK_DLL, Constraint );
00061
00069 #define FBRegisterConstraint( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00070 HIObject RegisterConstraint##ClassName##Create( HIObject ,char * pName,void * ) \
00071 { \
00072 ClassName *Class = new ClassName(pName); \
00073 Class->UniqueName = UniqueNameStr; \
00074 if (Class->FBCreate()) { \
00075 return Class->GetHIObject(); \
00076 } else { \
00077 delete Class; \
00078 return NULL; \
00079 } \
00080 } \
00081 \
00082 FBLibraryModule( ClassName ) \
00083 { \
00084 FBRegisterObject( ClassName##R1,"Constraints",Label,Description,RegisterConstraint##ClassName##Create,true, IconFilename ); \
00085 FBRegisterObject( ClassName##R2,"FbxStorable/Constraint",UniqueNameStr,Description,RegisterConstraint##ClassName##Create,true, IconFilename ); \
00086 }
00087
00093 #define FBConstraintDeclare( ClassName, Parent ) \
00094 FBClassDeclare( ClassName, Parent ); \
00095 public: \
00096 ClassName(char * pName):Parent(pName) { FBClassInit; } \
00097 private:
00098
00102 #define FBConstraintImplementation( ThisComponent ) \
00103 FBClassImplementation( ThisComponent )
00104
00106
00108 FB_FORWARD( FBConstraintInfo );
00109
00114 class FBSDK_DLL FBConstraintInfo
00115 {
00116 public:
00120 bool GetSnapRequested();
00121
00125 bool GetZeroRequested();
00126 };
00127
00129
00131 __FB_FORWARD( FBConstraint);
00132
00134 class FBSDK_DLL FBConstraint : public FBBox {
00135 __FBClassDeclare( FBConstraint,FBBox );
00136 public:
00141 FBConstraint(char *pName, HIObject pObject=NULL);
00142
00143 IObject_Declare(Implementation);
00144
00145 virtual void ActiveChanged();
00146
00147 virtual void RemoveAllAnimationNodes();
00148 virtual void SetupAllAnimationNodes();
00149
00150 virtual void SnapSuggested();
00151 virtual void FreezeSuggested();
00152
00157 virtual bool Disable( HFBModel pModel );
00158
00163 virtual bool Enable( HFBModel pModel );
00164
00171 virtual bool AnimationNodeNotify( HFBAnimationNode pAnimationNode, HFBEvaluateInfo pEvaluateInfo, HFBConstraintInfo pConstraintInfo );
00172
00174
00182 HFBAnimationNode AnimationNodeOutCreate ( kReference pUserId, HFBModel pModel, char* pAttribute );
00183 HFBAnimationNode AnimationNodeInCreate ( kReference pUserId, HFBModel pModel, char* pAttribute );
00191 HFBAnimationNode AnimationNodeInCreate ( kReference pUserId, HFBProperty pProperty );
00193
00200 virtual void SaveModelState( HFBModel pModel, bool pS, bool pR, bool pT );
00201
00205 virtual void RestoreModelState( HFBModel pModel );
00206
00213 virtual void FreezeSRT( HFBModel pModel, bool pS, bool pR, bool pT );
00214
00218 virtual HFBConstraint Clone();
00219
00223 int ReferenceGroupGetCount();
00224
00230 int ReferenceGroupAdd( char* pGroupName, int pMaxItemCount );
00231
00236 char* ReferenceGroupGetName( int pGroupIndex );
00237
00243 int ReferenceGroupGetMaxCount( int pGroupIndex );
00244
00250 HFBModel ReferenceGet( int pGroupIndex, int pItemIndex=0 );
00251
00256 int ReferenceGetCount( int pGroupIndex );
00257
00265 bool ReferenceAdd( int pGroupIndex, HFBModel pModel );
00266
00272 bool ReferenceRemove( int pGroupIndex, HFBModel pModel );
00273
00275 void ReferenceRemoveAll();
00276
00278
00283 virtual bool ReferenceAddNotify ( int pGroupIndex, HFBModel pModel );
00284 virtual bool ReferenceRemoveNotify ( int pGroupIndex, HFBModel pModel );
00286
00299 virtual bool DeformerPreNotify( HFBModel pModel, HFBEvaluateInfo pEvaluateInfo, HFBVertex pBBoxMin,HFBVertex pBBoxMax);
00300
00310 virtual bool DeformerNotify( HFBModel pModel, const HFBVertex pSrcVertex, const HFBVertex pSrcNormal,
00311 int pCount,
00312 HFBVertex pDstVertex,HFBVertex pDstNormal);
00313
00315
00321 virtual bool DeformerBind ( HFBModel pModel );
00322 virtual bool DeformerUnBind ( HFBModel pModel );
00324
00326
00331 virtual bool FbxStore ( HFBFbxObject pFbxObject, kFbxObjectStore pStoreWhat );
00332 virtual bool FbxRetrieve( HFBFbxObject pFbxObject, kFbxObjectStore pStoreWhat );
00334
00335 FBPropertyBool Deformer;
00336 FBPropertyBool HasLayout;
00337 FBPropertyString Description;
00338
00339 FBPropertyBool Active;
00340 FBPropertyBool Lock;
00341 FBPropertyAction Snap;
00342 FBPropertyAnimatableDouble Weight;
00343 };
00344
00346
00349 class FBSDK_DLL FBPropertyListConstraint : public FBPropertyListComponent
00350 {
00351 public:
00352 FBPropertyListConstraint();
00357 FBConstraint* operator[](int pIndex);
00358 };
00359
00361
00363 __FB_FORWARD( FBBox );
00364 __FB_FORWARD( FBPropertyListBox );
00365 FB_DEFINE_LIST( FBSDK_DLL, Box );
00366
00368 class FBSDK_DLL FBPropertyListBox : public FBPropertyListComponentBase
00369 {
00370 public:
00376 int Add( HFBBox pItem );
00380 virtual void RemoveAt( int pIndex );
00385 virtual HFBBox operator[](int pIndex);
00389 virtual int GetCount();
00390
00391 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00392 inline virtual FBComponent* GetAt(int pIndex) { return (FBComponent*)operator[](pIndex); }
00393 private:
00394 inline virtual int Add ( FBComponent* pItem ) { return Add((FBBox*)pItem); }
00395 #endif
00396 };
00397
00399
00401 FB_DEFINE_COMPONENT( FBSDK_DLL, Box );
00402 __FB_FORWARD( FBBoxPlaceHolder );
00403
00410 class FBSDK_DLL FBBoxPlaceHolder : public FBBox {
00411 __FBClassDeclare( FBBoxPlaceHolder, FBBox );
00412 public:
00416 FBBoxPlaceHolder(HIObject pObject);
00417
00418 FBPropertyBox Box;
00419 };
00420
00422
00424 FB_FORWARD( FBModel );
00425 __FB_FORWARD( FBModelPlaceHolder );
00426
00432 class FBSDK_DLL FBModelPlaceHolder : public FBBoxPlaceHolder {
00433 __FBClassDeclare( FBModelPlaceHolder, FBBoxPlaceHolder );
00434 public:
00438 FBModelPlaceHolder(HIObject pObject);
00439
00440 FBPropertyModel Model;
00441 FBPropertyBool UseGlobalTransforms;
00442 };
00443
00445
00447 __FB_FORWARD( FBConstraintRelation);
00448
00453 class FBSDK_DLL FBConstraintRelation : public FBConstraint {
00454 __FBClassDeclare( FBConstraintRelation, FBConstraint );
00455 public:
00460 FBConstraintRelation(char *pName, HIObject pObject=NULL);
00461
00462 IObject_Declare(Implementation);
00463
00469 HFBBox SetAsSource ( HFBBox pSource );
00470
00476 HFBBox ConstrainObject( HFBBox pConstrainedObject );
00477
00484 HFBBox CreateFunctionBox( char* pGroup, char* pName );
00485
00494 bool GetBoxPosition( HFBBox pBox, int& pX, int& pY );
00495
00503 bool SetBoxPosition( HFBBox pBox, int pX, int pY );
00504
00505 FBPropertyListBox Boxes;
00506 };
00507
00509
00511 FB_DEFINE_COMPONENT( FBSDK_DLL, ConstraintSolver );
00512
00520 #define FBRegisterConstraintSolver( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00521 HIObject RegisterConstraintSolver##ClassName##Create( HIObject ,char * pName,void * ) \
00522 { \
00523 ClassName *Class = new ClassName(pName); \
00524 Class->UniqueName = UniqueNameStr; \
00525 if (Class->FBCreate()) { \
00526 return Class->GetHIObject(); \
00527 } else { \
00528 delete Class; \
00529 return NULL; \
00530 } \
00531 } \
00532 \
00533 FBLibraryModule( ClassName ) \
00534 { \
00535 FBRegisterObject( ClassName##R1,"Browsing/Templates/Solvers",Label,Description,RegisterConstraintSolver##ClassName##Create,true, IconFilename ); \
00536 FBRegisterObject( ClassName##R2,"FbxStorable/Constraint",UniqueNameStr,Description,RegisterConstraintSolver##ClassName##Create,true, IconFilename ); \
00537 }
00538
00544 #define FBConstraintSolverDeclare( ClassName, Parent ) \
00545 FBClassDeclare( ClassName, Parent ); \
00546 public: \
00547 ClassName(char * pName):Parent(pName) { FBClassInit; } \
00548 private:
00549
00553 #define FBConstraintSolverImplementation( ThisComponent ) \
00554 FBClassImplementation( ThisComponent )
00555
00556 __FB_FORWARD( FBConstraintSolver );
00557
00559 class FBSDK_DLL FBConstraintSolver : public FBConstraint {
00560 __FBClassDeclare( FBConstraintSolver,FBConstraint );
00561 public:
00562
00563 FBConstraintSolver(char *pName, HIObject pObject=NULL);
00564
00565 static bool BackgroundEvaluate( FBModel* pModel, FBComponent* pTrackOrTake, FBTime pTime, FBVector3d& pT, FBVector3d& pR, FBVector3d& pS, HFBEvaluateInfo pEvaluateInfo = NULL, bool pGlobal = true );
00566 HFBEvaluateInfo BackgroundEvaluateInfo(HFBEvaluateInfo pSourceEvaluateInfo);
00567
00568 void MultiThreaded( bool pActive );
00569 bool IsMultiThreaded();
00570
00571 FBPropertyInt SampleRecordingPrecision;
00572 FBPropertyBool SyncAnimationPlay;
00573
00574 virtual void LiveChanged();
00575 };
00576
00578
00580 FB_FORWARD( FBPropertyListConstraintSolver );
00581
00583 class FBSDK_DLL FBPropertyListConstraintSolver : public FBPropertyListComponent
00584 {
00585 public:
00586 FBPropertyListConstraintSolver();
00591 FBConstraint* operator[](int pIndex);
00592 };
00593
00595
00597 FB_DEFINE_COMPONENT( FBSDK_DLL, PhysicalProperties );
00598
00606 #define FBRegisterPhysicalProperties( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00607 HIObject RegisterPhysicalProperties##ClassName##Create( HIObject ,char * pName,void * ) \
00608 { \
00609 ClassName *Class = new ClassName(pName); \
00610 if (Class->FBCreate()) { \
00611 return Class->GetHIObject(); \
00612 } else { \
00613 delete Class; \
00614 return NULL; \
00615 } \
00616 } \
00617 \
00618 FBLibraryModule( ClassName ) \
00619 { \
00620 FBRegisterObject( ClassName##R1,"Browsing/Templates/Physical Properties",Label,Description,RegisterPhysicalProperties##ClassName##Create,true, IconFilename ); \
00621 FBRegisterObject( ClassName##R2,"FbxStorable/Physical Properties",UniqueNameStr,Description,RegisterPhysicalProperties##ClassName##Create,true, IconFilename ); \
00622 }
00623
00629 #define FBPhysicalPropertiesDeclare( ClassName, Parent ) \
00630 FBClassDeclare( ClassName, Parent ); \
00631 public: \
00632 ClassName(char * pName):Parent(pName) { FBClassInit; } \
00633 private:
00634
00638 #define FBPhysicalPropertiesImplementation( ThisComponent ) \
00639 FBClassImplementation( ThisComponent )
00640
00641 __FB_FORWARD( FBPhysicalProperties );
00642
00646 class FBSDK_DLL FBPhysicalProperties : public FBBox {
00647 __FBClassDeclare( FBPhysicalProperties,FBBox );
00648 public:
00649
00650 FBPhysicalProperties(char *pName, HIObject pObject=NULL);
00651
00652 };
00653
00655
00657 FB_DEFINE_LIST( FBSDK_DLL, PhysicalProperties );
00658 FB_FORWARD( FBPropertyListPhysicalProperties );
00659
00661 class FBSDK_DLL FBPropertyListPhysicalProperties : public FBPropertyListComponent
00662 {
00663 public:
00664 FBPropertyListPhysicalProperties();
00669 FBPhysicalProperties* operator[](int pIndex);
00670 };
00671
00673
00675 __FB_FORWARD( FBConstraintManager );
00676
00678 class FBSDK_DLL FBConstraintManager : public FBComponent
00679 {
00680 __FBClassDeclare( FBConstraintManager, FBComponent );
00681 public:
00683 FBConstraintManager();
00684
00691 const char* TypeGetName ( int pTypeIndex );
00695 int TypeGetCount ();
00704 FBConstraint* TypeCreateConstraint( int pTypeIndex );
00705 };
00706
00707
00708 #ifdef FBSDKUseNamespace
00709 }
00710 #endif
00711 #endif