fbconstraint.h

Go to the documentation of this file.
00001 #ifndef __FBCONSTRAINT_H__
fbconstraint.h
00002 #define __FBCONSTRAINT_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
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 /*pOwner*/,char * pName,void * /*pData*/) \
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 // FBConstraintInfo
00108 FB_FORWARD( FBConstraintInfo );
00109 
00114 class FBSDK_DLL FBConstraintInfo 
00115 {
00116 public:
00120     bool GetSnapRequested();
00121 
00125     bool GetZeroRequested();
00126 };
00127 
00129 // FBConstraint
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);            // Interface to IObject
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 // FBPropertyListConstraint
00337 class FBSDK_DLL FBPropertyListConstraint : public FBPropertyListComponent
00338 {
00339 public:
00340     FBPropertyListConstraint();
00345     FBConstraint* operator[](int pIndex);
00346 };
00347 
00349 // FBPropertyListBox
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 // FBBoxPlaceHolder
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 // FBModelPlaceHolder
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 // FBConstraintRelation
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);            // Interface to IObject
00451 
00457     HFBBox SetAsSource    ( HFBBox pSource );
00458 
00464     HFBBox ConstrainObject( HFBBox pConstrainedObject ); // Receiver
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 // FBConstraintSolver
00499 FB_DEFINE_COMPONENT( FBSDK_DLL, ConstraintSolver );
00500 
00508 #define FBRegisterConstraintSolver( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00509     HIObject RegisterConstraintSolver##ClassName##Create( HIObject /*pOwner*/,char * pName,void * /*pData*/) \
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 // FBPropertyListConstraintSolver
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 // FBPhysicalProperties
00583 FB_DEFINE_COMPONENT( FBSDK_DLL, PhysicalProperties );
00584 
00592 #define FBRegisterPhysicalProperties( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
00593     HIObject RegisterPhysicalProperties##ClassName##Create( HIObject /*pOwner*/,char * pName,void * /*pData*/) \
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 // FBPropertyListPhysicalProperties
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 // FBConstraintManager
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

Please send us your comments about this page.