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
00220 virtual HFBConstraint Clone();
00221
00225 int ReferenceGroupGetCount();
00226
00232 int ReferenceGroupAdd( char* pGroupName, int pMaxItemCount );
00233
00238 char* ReferenceGroupGetName( int pGroupIndex );
00239
00245 int ReferenceGroupGetMaxCount( int pGroupIndex );
00246
00252 HFBModel ReferenceGet( int pGroupIndex, int pItemIndex=0 );
00253
00258 int ReferenceGetCount( int pGroupIndex );
00259
00267 bool ReferenceAdd( int pGroupIndex, HFBModel pModel );
00268
00274 bool ReferenceRemove( int pGroupIndex, HFBModel pModel );
00275
00277 void ReferenceRemoveAll();
00278
00280
00285 virtual bool ReferenceAddNotify ( int pGroupIndex, HFBModel pModel );
00286 virtual bool ReferenceRemoveNotify ( int pGroupIndex, HFBModel pModel );
00288
00298 virtual bool DeformerNotify( HFBModel pModel, HFBVertex pSrcVertex, HFBVertex pSrcNormal,
00299 int pCount,
00300 HFBVertex pDstVertex,HFBVertex pDstNormal);
00301
00303
00309 virtual bool DeformerBind ( HFBModel pModel );
00310 virtual bool DeformerUnBind ( HFBModel pModel );
00312
00314
00319 virtual bool FbxStore ( HFBFbxObject pFbxObject, kFbxObjectStore pStoreWhat );
00320 virtual bool FbxRetrieve( HFBFbxObject pFbxObject, kFbxObjectStore pStoreWhat );
00322
00323 FBPropertyBool Deformer;
00324 FBPropertyBool HasLayout;
00325 FBPropertyString Description;
00326
00327 FBPropertyBool Active;
00328 FBPropertyBool Lock;
00329 FBPropertyAction Snap;
00330 FBPropertyAnimatableDouble Weight;
00331 };
00332
00334
00337 class FBSDK_DLL FBPropertyListConstraint : public FBPropertyListComponent
00338 {
00339 public:
00340 FBPropertyListConstraint();
00345 FBConstraint* operator[](int pIndex);
00346 };
00347
00349
00351 __FB_FORWARD( FBBox );
00352 __FB_FORWARD( FBPropertyListBox );
00353 FB_DEFINE_LIST( FBSDK_DLL, Box );
00354
00356 class FBSDK_DLL FBPropertyListBox : public FBPropertyListComponentBase
00357 {
00358 public:
00364 int Add( HFBBox pItem );
00368 virtual void RemoveAt( int pIndex );
00373 virtual HFBBox operator[](int pIndex);
00377 virtual int GetCount();
00378
00379 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00380 inline virtual FBComponent* GetAt(int pIndex) { return (FBComponent*)operator[](pIndex); }
00381 private:
00382 inline virtual int Add ( FBComponent* pItem ) { return Add((FBBox*)pItem); }
00383 #endif
00384 };
00385
00387
00389 FB_DEFINE_COMPONENT( FBSDK_DLL, Box );
00390 __FB_FORWARD( FBBoxPlaceHolder );
00391
00398 class FBSDK_DLL FBBoxPlaceHolder : public FBBox {
00399 __FBClassDeclare( FBBoxPlaceHolder, FBBox );
00400 public:
00404 FBBoxPlaceHolder(HIObject pObject);
00405
00406 FBPropertyBox Box;
00407 };
00408
00410
00412 FB_FORWARD( FBModel );
00413 __FB_FORWARD( FBModelPlaceHolder );
00414
00420 class FBSDK_DLL FBModelPlaceHolder : public FBBoxPlaceHolder {
00421 __FBClassDeclare( FBModelPlaceHolder, FBBoxPlaceHolder );
00422 public:
00426 FBModelPlaceHolder(HIObject pObject);
00427
00428 FBPropertyModel Model;
00429 FBPropertyBool UseGlobalTransforms;
00430 };
00431
00433
00435 __FB_FORWARD( FBConstraintRelation);
00436
00441 class FBSDK_DLL FBConstraintRelation : public FBConstraint {
00442 __FBClassDeclare( FBConstraintRelation, FBConstraint );
00443 public:
00448 FBConstraintRelation(char *pName, HIObject pObject=NULL);
00449
00450 IObject_Declare(Implementation);
00451
00457 HFBBox SetAsSource ( HFBBox pSource );
00458
00464 HFBBox ConstrainObject( HFBBox pConstrainedObject );
00465
00472 HFBBox CreateFunctionBox( char* pGroup, char* pName );
00473
00482 bool GetBoxPosition( HFBBox pBox, int& pX, int& pY );
00483
00491 bool SetBoxPosition( HFBBox pBox, int pX, int pY );
00492
00493 FBPropertyListBox Boxes;
00494 };
00495
00497
00499 FB_DEFINE_COMPONENT( FBSDK_DLL, ConstraintSolver );
00500
00508 #define FBRegisterConstraintSolver( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00509 HIObject RegisterConstraintSolver##ClassName##Create( HIObject ,char * pName,void * ) \
00510 { \
00511 ClassName *Class = new ClassName(pName); \
00512 Class->UniqueName = UniqueNameStr; \
00513 if (Class->FBCreate()) { \
00514 return Class->GetHIObject(); \
00515 } else { \
00516 delete Class; \
00517 return NULL; \
00518 } \
00519 } \
00520 \
00521 FBLibraryModule( ClassName ) \
00522 { \
00523 FBRegisterObject( ClassName##R1,"Browsing/Templates/Solvers",Label,Description,RegisterConstraintSolver##ClassName##Create,true, IconFilename ); \
00524 FBRegisterObject( ClassName##R2,"FbxStorable/Constraint",UniqueNameStr,Description,RegisterConstraintSolver##ClassName##Create,true, IconFilename ); \
00525 }
00526
00532 #define FBConstraintSolverDeclare( ClassName, Parent ) \
00533 FBClassDeclare( ClassName, Parent ); \
00534 public: \
00535 ClassName(char * pName):Parent(pName) { FBClassInit; } \
00536 private:
00537
00541 #define FBConstraintSolverImplementation( ThisComponent ) \
00542 FBClassImplementation( ThisComponent )
00543
00544 __FB_FORWARD( FBConstraintSolver );
00545
00547 class FBSDK_DLL FBConstraintSolver : public FBConstraint {
00548 __FBClassDeclare( FBConstraintSolver,FBConstraint );
00549 public:
00550
00551 FBConstraintSolver(char *pName, HIObject pObject=NULL);
00552
00553 static bool BackgroundEvaluate( FBModel* pModel, FBComponent* pTrackOrTake, FBTime pTime, FBVector3d& pT, FBVector3d& pR, FBVector3d& pS, HFBEvaluateInfo pEvaluateInfo = NULL, bool pGlobal = true );
00554
00555 void MultiThreaded( bool pActive );
00556 bool IsMultiThreaded();
00557
00558 FBPropertyInt SampleRecordingPrecision;
00559
00560 virtual void LiveChanged();
00561 };
00562
00564
00566 FB_FORWARD( FBPropertyListConstraintSolver );
00567
00569 class FBSDK_DLL FBPropertyListConstraintSolver : public FBPropertyListComponent
00570 {
00571 public:
00572 FBPropertyListConstraintSolver();
00577 FBConstraint* operator[](int pIndex);
00578 };
00579
00581
00583 FB_DEFINE_COMPONENT( FBSDK_DLL, PhysicalProperties );
00584
00592 #define FBRegisterPhysicalProperties( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00593 HIObject RegisterPhysicalProperties##ClassName##Create( HIObject ,char * pName,void * ) \
00594 { \
00595 ClassName *Class = new ClassName(pName); \
00596 if (Class->FBCreate()) { \
00597 return Class->GetHIObject(); \
00598 } else { \
00599 delete Class; \
00600 return NULL; \
00601 } \
00602 } \
00603 \
00604 FBLibraryModule( ClassName ) \
00605 { \
00606 FBRegisterObject( ClassName##R1,"Browsing/Templates/Physical Properties",Label,Description,RegisterPhysicalProperties##ClassName##Create,true, IconFilename ); \
00607 FBRegisterObject( ClassName##R2,"FbxStorable/Physical Properties",UniqueNameStr,Description,RegisterPhysicalProperties##ClassName##Create,true, IconFilename ); \
00608 }
00609
00615 #define FBPhysicalPropertiesDeclare( ClassName, Parent ) \
00616 FBClassDeclare( ClassName, Parent ); \
00617 public: \
00618 ClassName(char * pName):Parent(pName) { FBClassInit; } \
00619 private:
00620
00624 #define FBPhysicalPropertiesImplementation( ThisComponent ) \
00625 FBClassImplementation( ThisComponent )
00626
00627 __FB_FORWARD( FBPhysicalProperties );
00628
00632 class FBSDK_DLL FBPhysicalProperties : public FBBox {
00633 __FBClassDeclare( FBPhysicalProperties,FBBox );
00634 public:
00635
00636 FBPhysicalProperties(char *pName, HIObject pObject=NULL);
00637
00638 };
00639
00641
00643 FB_DEFINE_LIST( FBSDK_DLL, PhysicalProperties );
00644 FB_FORWARD( FBPropertyListPhysicalProperties );
00645
00647 class FBSDK_DLL FBPropertyListPhysicalProperties : public FBPropertyListComponent
00648 {
00649 public:
00650 FBPropertyListPhysicalProperties();
00655 FBPhysicalProperties* operator[](int pIndex);
00656 };
00657
00659
00661 __FB_FORWARD( FBConstraintManager );
00662
00664 class FBSDK_DLL FBConstraintManager : public FBComponent
00665 {
00666 __FBClassDeclare( FBConstraintManager, FBComponent );
00667 public:
00669 FBConstraintManager();
00670
00677 const char* TypeGetName ( int pTypeIndex );
00681 int TypeGetCount ();
00690 FBConstraint* TypeCreateConstraint( int pTypeIndex );
00691 };
00692
00693
00694 #ifdef FBSDKUseNamespace
00695 }
00696 #endif
00697 #endif