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 ,const 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(const 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(const char* pName, HIObject pObject=NULL);
00142
00143 IObject_Declare(K_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( FBModel* pModel );
00158
00163 virtual bool Enable( FBModel* pModel );
00164
00171 virtual bool AnimationNodeNotify( FBAnimationNode* pAnimationNode, FBEvaluateInfo* pEvaluateInfo, FBConstraintInfo* pConstraintInfo );
00172
00174
00182 FBAnimationNode* AnimationNodeOutCreate ( kReference pUserId, FBModel* pModel, const char* pAttribute );
00183 FBAnimationNode* AnimationNodeInCreate ( kReference pUserId, FBModel* pModel, const char* pAttribute );
00191 FBAnimationNode* AnimationNodeInCreate ( kReference pUserId, FBProperty* pProperty );
00193
00200 virtual void SaveModelState( FBModel* pModel, bool pS, bool pR, bool pT );
00201
00205 virtual void RestoreModelState( FBModel* pModel );
00206
00213 virtual void FreezeSRT( FBModel* pModel, bool pS, bool pR, bool pT );
00214
00218 virtual FBConstraint* Clone();
00219
00223 int ReferenceGroupGetCount();
00224
00230 int ReferenceGroupAdd( const char* pGroupName, int pMaxItemCount );
00231
00236 const char* ReferenceGroupGetName( int pGroupIndex );
00237
00243 int ReferenceGroupGetMaxCount( int pGroupIndex );
00244
00250 FBModel* ReferenceGet( int pGroupIndex, int pItemIndex=0 );
00251
00256 int ReferenceGetCount( int pGroupIndex );
00257
00265 bool ReferenceAdd( int pGroupIndex, FBModel* pModel );
00266
00272 bool ReferenceRemove( int pGroupIndex, FBModel* pModel );
00273
00275 void ReferenceRemoveAll();
00276
00278
00283 virtual bool ReferenceAddNotify ( int pGroupIndex, FBModel* pModel );
00284 virtual bool ReferenceRemoveNotify ( int pGroupIndex, FBModel* pModel );
00286
00299 virtual bool DeformerPreNotify( FBModel* pModel, FBEvaluateInfo* pEvaluateInfo, FBVertex* pBBoxMin,FBVertex* pBBoxMax);
00300
00310 virtual bool DeformerNotify( FBModel* pModel, const FBVertex* pSrcVertex, const FBVertex* pSrcNormal,
00311 int pCount,
00312 FBVertex* pDstVertex,FBVertex* pDstNormal);
00313
00315
00321 virtual bool DeformerBind ( FBModel* pModel );
00322 virtual bool DeformerUnBind ( FBModel* pModel );
00324
00326
00331 virtual bool FbxStore ( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat );
00332 virtual bool FbxRetrieve( FBFbxObject* 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( FBBox* pItem );
00380 virtual void RemoveAt( int pIndex );
00385 virtual FBBox* 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(const char* pName, HIObject pObject=NULL);
00461
00462 IObject_Declare(K_IMPLEMENTATION);
00463
00469 FBBox* SetAsSource ( FBBox* pSource );
00470
00476 FBBox* ConstrainObject( FBBox* pConstrainedObject );
00477
00484 FBBox* CreateFunctionBox( const char* pGroup, const char* pName );
00485
00494 bool GetBoxPosition( FBBox* pBox, int& pX, int& pY );
00495
00503 bool SetBoxPosition( FBBox* 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 ,const 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(const 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(const char* pName, HIObject pObject=NULL);
00564
00565 static bool BackgroundEvaluate( FBModel* pModel, FBComponent* pTrackOrTake, FBTime pTime, FBVector3d& pT, FBVector3d& pR, FBVector3d& pS, FBEvaluateInfo* pEvaluateInfo = NULL, bool pGlobal = true );
00566
00573 FBEvaluateInfo* BackgroundEvaluateInfoBegin(FBEvaluateInfo* pSourceEvaluateInfo, bool pEvaluateCandidates=false);
00574
00581 FBEvaluateInfo* BackgroundEvaluateInfoRecursiveBegin(FBEvaluateInfo* pSourceEvaluateInfo, bool pForceUpdateLocals=false);
00582
00584 void BackgroundEvaluateInfoEnd(FBEvaluateInfo* pBackgroundEvaluateInfo);
00585
00593 bool BackgroundEvaluateInfoNotify(FBEvaluateInfo* pBackgroundEvaluateInfo, kBackgroundEvaluationCallback pFunction, void* pCustomData=NULL);
00594
00595 void MultiThreaded( bool pActive );
00596 bool IsMultiThreaded();
00597
00598 FBPropertyInt SampleRecordingPrecision;
00599 FBPropertyBool SyncAnimationPlay;
00600
00601 virtual void LiveChanged();
00602 };
00603
00605
00607 FB_FORWARD( FBPropertyListConstraintSolver );
00608
00610 class FBSDK_DLL FBPropertyListConstraintSolver : public FBPropertyListComponent
00611 {
00612 public:
00613 FBPropertyListConstraintSolver();
00618 FBConstraint* operator[](int pIndex);
00619 };
00620
00622
00624 FB_DEFINE_COMPONENT( FBSDK_DLL, PhysicalProperties );
00625
00633 #define FBRegisterPhysicalProperties( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00634 HIObject RegisterPhysicalProperties##ClassName##Create( HIObject ,const char* pName,void * ) \
00635 { \
00636 ClassName *Class = new ClassName(pName); \
00637 if (Class->FBCreate()) { \
00638 return Class->GetHIObject(); \
00639 } else { \
00640 delete Class; \
00641 return NULL; \
00642 } \
00643 } \
00644 \
00645 FBLibraryModule( ClassName ) \
00646 { \
00647 FBRegisterObject( ClassName##R1,"Browsing/Templates/Physical Properties",Label,Description,RegisterPhysicalProperties##ClassName##Create,true, IconFilename ); \
00648 FBRegisterObject( ClassName##R2,"FbxStorable/Physical Properties",UniqueNameStr,Description,RegisterPhysicalProperties##ClassName##Create,true, IconFilename ); \
00649 }
00650
00656 #define FBPhysicalPropertiesDeclare( ClassName, Parent ) \
00657 FBClassDeclare( ClassName, Parent ); \
00658 public: \
00659 ClassName(const char* pName):Parent(pName) { FBClassInit; } \
00660 private:
00661
00665 #define FBPhysicalPropertiesImplementation( ThisComponent ) \
00666 FBClassImplementation( ThisComponent )
00667
00668 __FB_FORWARD( FBPhysicalProperties );
00669
00673 class FBSDK_DLL FBPhysicalProperties : public FBBox {
00674 __FBClassDeclare( FBPhysicalProperties,FBBox );
00675 public:
00676
00677 FBPhysicalProperties(const char* pName, HIObject pObject=NULL);
00678
00679 };
00680
00682
00684 FB_DEFINE_LIST( FBSDK_DLL, PhysicalProperties );
00685 FB_FORWARD( FBPropertyListPhysicalProperties );
00686
00688 class FBSDK_DLL FBPropertyListPhysicalProperties : public FBPropertyListComponent
00689 {
00690 public:
00691 FBPropertyListPhysicalProperties();
00696 FBPhysicalProperties* operator[](int pIndex);
00697 };
00698
00700
00702 __FB_FORWARD( FBConstraintManager );
00703
00705 class FBSDK_DLL FBConstraintManager : public FBComponent
00706 {
00707 __FBClassDeclare( FBConstraintManager, FBComponent );
00708 public:
00712 K_DEPRECATED_2014 FBConstraintManager();
00713
00717 static FBConstraintManager& TheOne();
00718
00725 const char* TypeGetName ( int pTypeIndex ) const;
00726
00730 int TypeGetCount () const;
00731
00739 FBConstraint* TypeCreateConstraint( int pTypeIndex );
00740
00748 FBConstraint* TypeCreateConstraint( const char* pName );
00749 };
00750
00751
00752 #ifdef FBSDKUseNamespace
00753 }
00754 #endif
00755 #endif