Open Reality Reference Guide
 
Loading...
Searching...
No Matches
fbconstraint.h
Go to the documentation of this file.
1#ifndef __FBCONSTRAINT_H__
2#define __FBCONSTRAINT_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
45#include <kaydaradef.h>
46#ifndef FBSDK_DLL
50 #define FBSDK_DLL K_DLLIMPORT
51#endif
52
53#include <fbsdk/fbcomponent.h>
54#include <fbsdk/fbcore.h>
55
56#ifdef FBSDKUseNamespace
57 namespace FBSDKNamespace {
58#endif
59
60FB_DEFINE_COMPONENT( FBSDK_DLL, Constraint );
61
69#define FBRegisterConstraint( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
70 HIObject RegisterConstraint##ClassName##Create( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
71 { \
72 ClassName *Class = new ClassName(pName); \
73 Class->UniqueName = UniqueNameStr; \
74 if (Class->FBCreate()) { \
75 return Class->GetHIObject(); \
76 } else { \
77 delete Class; \
78 return NULL; \
79 } \
80 } \
81\
82 FBLibraryModule( ClassName ) \
83 { \
84 FBRegisterObject( ClassName##R1,"Constraints",Label,Description,RegisterConstraint##ClassName##Create,true, IconFilename ); \
85 FBRegisterObject( ClassName##R2,"FbxStorable/Constraint",UniqueNameStr,Description,RegisterConstraint##ClassName##Create,true, IconFilename ); \
86 }
87
93#define FBConstraintDeclare( ClassName, Parent ) \
94 FBClassDeclare( ClassName, Parent ); \
95 public: \
96 ClassName(const char* pName):Parent(pName) { FBClassInit; } \
97 private:
98
102#define FBConstraintImplementation( ThisComponent ) \
103 FBClassImplementation( ThisComponent )
104
106// FBConstraintInfo
109
115{
116public:
121
126};
127
129// FBConstraint
132
136public:
141 FBConstraint(const char* pName, HIObject pObject=NULL);
142
143 IObject_Declare(override); // Interface to IObject
144
145 virtual void ActiveChanged();
146
147 virtual void RemoveAllAnimationNodes();
148 virtual void SetupAllAnimationNodes();
149
150 virtual void SnapSuggested();
151 virtual void FreezeSuggested();
152
157 virtual bool Disable( FBModel* pModel );
158
163 virtual bool Enable( FBModel* pModel );
164
171 virtual bool AnimationNodeNotify( FBAnimationNode* pAnimationNode, FBEvaluateInfo* pEvaluateInfo, FBConstraintInfo* pConstraintInfo );
172
174
182 FBAnimationNode* AnimationNodeOutCreate ( kReference pUserId, FBModel* pModel, const char* pAttribute );
183 FBAnimationNode* AnimationNodeInCreate ( kReference pUserId, FBModel* pModel, const char* pAttribute );
191 FBAnimationNode* AnimationNodeInCreate ( kReference pUserId, FBProperty* pProperty );
193
200 virtual void SaveModelState( FBModel* pModel, bool pS, bool pR, bool pT );
201
205 virtual void RestoreModelState( FBModel* pModel );
206
213 virtual void FreezeSRT( FBModel* pModel, bool pS, bool pR, bool pT );
214
218 virtual FBConstraint* Clone();
219
224
230 int ReferenceGroupAdd( const char* pGroupName, int pMaxItemCount );
231
236 const char* ReferenceGroupGetName( int pGroupIndex );
237
243 int ReferenceGroupGetMaxCount( int pGroupIndex );
244
250 FBModel* ReferenceGet( int pGroupIndex, int pItemIndex=0 );
251
256 int ReferenceGetCount( int pGroupIndex );
257
265 bool ReferenceAdd( int pGroupIndex, FBModel* pModel );
266
272 bool ReferenceRemove( int pGroupIndex, FBModel* pModel );
273
276
278
283 virtual bool ReferenceAddNotify ( int pGroupIndex, FBModel* pModel );
284 virtual bool ReferenceRemoveNotify ( int pGroupIndex, FBModel* pModel );
286
299 virtual bool DeformerPreNotify( FBModel* pModel, FBEvaluateInfo* pEvaluateInfo, FBVertex* pBBoxMin,FBVertex* pBBoxMax);
300
310 virtual bool DeformerNotify( FBModel* pModel, const FBVertex* pSrcVertex, const FBVertex* pSrcNormal,
311 int pCount,
312 FBVertex* pDstVertex,FBVertex* pDstNormal);
313
315
321 virtual bool DeformerBind ( FBModel* pModel );
322 virtual bool DeformerUnBind ( FBModel* pModel );
324
326
331 virtual bool FbxStore ( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat ) override;
332 virtual bool FbxRetrieve( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat ) override;
334
338
343};
344
346// FBPropertyListConstraint
350{
351public:
358};
359
361// FBPropertyListBox
366
369{
370public:
376 int Add( FBBox* pItem );
380 virtual void RemoveAt( int pIndex );
385 virtual FBBox* operator[](int pIndex);
389 virtual int GetCount();
390
391#ifndef DOXYGEN_SHOULD_SKIP_THIS
392 inline virtual FBComponent* GetAt(int pIndex) { return (FBComponent*)operator[](pIndex); }
393private:
394 inline virtual int Add ( FBComponent* pItem ) { return Add((FBBox*)pItem); }
395#endif
396};
397
399// FBBoxPlaceHolder
403
412public:
416 FBBoxPlaceHolder(HIObject pObject);
417
418 FBPropertyBox Box;
419};
420
422// FBModelPlaceHolder
426
434public:
438 FBModelPlaceHolder(HIObject pObject);
439
440 FBPropertyModel Model;
442};
443
445// FBConstraintRelation
448
455public:
460 FBConstraintRelation(const char* pName, HIObject pObject=NULL);
461
462 IObject_Declare(override); // Interface to IObject
463
469 FBBox* SetAsSource ( FBBox* pSource );
470
476 FBBox* ConstrainObject( FBBox* pConstrainedObject ); // Receiver
477
484 FBBox* CreateFunctionBox( const char* pGroup, const char* pName );
485
494 bool GetBoxPosition( FBBox* pBox, int& pX, int& pY );
495
503 bool SetBoxPosition( FBBox* pBox, int pX, int pY );
504
506};
507
509// FBConstraintSolver
511FB_DEFINE_COMPONENT( FBSDK_DLL, ConstraintSolver );
512
520#define FBRegisterConstraintSolver( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
521 HIObject RegisterConstraintSolver##ClassName##Create( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
522 { \
523 ClassName *Class = new ClassName(pName); \
524 Class->UniqueName = UniqueNameStr; \
525 if (Class->FBCreate()) { \
526 return Class->GetHIObject(); \
527 } else { \
528 delete Class; \
529 return NULL; \
530 } \
531 } \
532\
533 FBLibraryModule( ClassName ) \
534 { \
535 FBRegisterObject( ClassName##R1,"Browsing/Templates/Solvers",Label,Description,RegisterConstraintSolver##ClassName##Create,true, IconFilename ); \
536 FBRegisterObject( ClassName##R2,"FbxStorable/Constraint",UniqueNameStr,Description,RegisterConstraintSolver##ClassName##Create,true, IconFilename ); \
537 }
538
544#define FBConstraintSolverDeclare( ClassName, Parent ) \
545 FBClassDeclare( ClassName, Parent ); \
546 public: \
547 ClassName(const char* pName):Parent(pName) { FBClassInit; } \
548 private:
549
553#define FBConstraintSolverImplementation( ThisComponent ) \
554 FBClassImplementation( ThisComponent )
555
557
561public:
562
563 FBConstraintSolver(const char* pName, HIObject pObject=NULL);
564
565 static bool BackgroundEvaluate( FBModel* pModel, FBComponent* pTrackOrTake, FBTime pTime, FBVector3d& pT, FBVector3d& pR, FBVector3d& pS, FBEvaluateInfo* pEvaluateInfo = NULL, bool pGlobal = true );
566
573 FBEvaluateInfo* BackgroundEvaluateInfoBegin(FBEvaluateInfo* pSourceEvaluateInfo, bool pEvaluateCandidates=false);
574
581 FBEvaluateInfo* BackgroundEvaluateInfoRecursiveBegin(FBEvaluateInfo* pSourceEvaluateInfo, bool pForceUpdateLocals=false);
582
584 void BackgroundEvaluateInfoEnd(FBEvaluateInfo* pBackgroundEvaluateInfo);
585
593 bool BackgroundEvaluateInfoNotify(FBEvaluateInfo* pBackgroundEvaluateInfo, kBackgroundEvaluationCallback pFunction, void* pCustomData=NULL);
594
595 void MultiThreaded( bool pActive );
596 bool IsMultiThreaded();
597
600
601 virtual void LiveChanged();
602};
603
605// FBPropertyListConstraintSolver
608
611{
612public:
619};
620
622// FBPhysicalProperties
624FB_DEFINE_COMPONENT( FBSDK_DLL, PhysicalProperties );
625
633#define FBRegisterPhysicalProperties( UniqueNameStr, ClassName, Label, Description, IconFilename ) \
634 HIObject RegisterPhysicalProperties##ClassName##Create( HIObject /*pOwner*/,const char* pName,void * /*pData*/) \
635 { \
636 ClassName *Class = new ClassName(pName); \
637 if (Class->FBCreate()) { \
638 return Class->GetHIObject(); \
639 } else { \
640 delete Class; \
641 return NULL; \
642 } \
643 } \
644\
645 FBLibraryModule( ClassName ) \
646 { \
647 FBRegisterObject( ClassName##R1,"Browsing/Templates/Physical Properties",Label,Description,RegisterPhysicalProperties##ClassName##Create,true, IconFilename ); \
648 FBRegisterObject( ClassName##R2,"FbxStorable/Physical Properties",UniqueNameStr,Description,RegisterPhysicalProperties##ClassName##Create,true, IconFilename ); \
649 }
650
656#define FBPhysicalPropertiesDeclare( ClassName, Parent ) \
657 FBClassDeclare( ClassName, Parent ); \
658 public: \
659 ClassName(const char* pName):Parent(pName) { FBClassInit; } \
660 private:
661
665#define FBPhysicalPropertiesImplementation( ThisComponent ) \
666 FBClassImplementation( ThisComponent )
667
669
675public:
676
677 FBPhysicalProperties(const char* pName, HIObject pObject=NULL);
678
679};
680
682// FBPropertyListPhysicalProperties
684FB_DEFINE_LIST( FBSDK_DLL, PhysicalProperties );
686
689{
690public:
697};
698
700// FBConstraintManager
703
706{
708public:
713
720 const char* TypeGetName ( int pTypeIndex ) const;
721
725 int TypeGetCount () const;
726
735
743 FBConstraint* TypeCreateConstraint( const char* pName );
744protected:
748};
749
750
751#ifdef FBSDKUseNamespace
752 }
753#endif
754#endif
A box is a fundamental building block in the application architecture.
Definition fbcore.h:218
Wrapper around a specific instance of a FBBox object.
FBBoxPlaceHolder(HIObject pObject)
Constructor.
FBPropertyBox Box
Read Only Property: Underlying box object.
MotionBuilder SDK base class.
Base class for constraints.
virtual void SaveModelState(FBModel *pModel, bool pS, bool pR, bool pT)
Save current state of pModel.
virtual void SnapSuggested()
Suggest 'snap'.
FBPropertyBool Lock
Read Write Property: Lock state.
virtual void SetupAllAnimationNodes()
Setup animation nodes.
const char * ReferenceGroupGetName(int pGroupIndex)
Get the name of the reference group.
bool ReferenceRemove(int pGroupIndex, FBModel *pModel)
Remove a reference to pModel from the group at pGroupIndex.
void ReferenceRemoveAll()
Remove All References.
virtual bool DeformerPreNotify(FBModel *pModel, FBEvaluateInfo *pEvaluateInfo, FBVertex *pBBoxMin, FBVertex *pBBoxMax)
Deformation pre-notification function This function pass the evaluation information for deformation (...
bool ReferenceAdd(int pGroupIndex, FBModel *pModel)
Add a reference to a specified group.
int ReferenceGroupGetMaxCount(int pGroupIndex)
Get the maximum number of items that can exist in the reference group in question.
FBPropertyString Description
Read Write Property: Long description of constraint.
FBConstraint(const char *pName, HIObject pObject=NULL)
Constructor.
virtual bool Enable(FBModel *pModel)
Enable constraint on pModel.
FBAnimationNode * AnimationNodeInCreate(kReference pUserId, FBProperty *pProperty)
Animation Node Creations (IN).
virtual bool FbxStore(FBFbxObject *pFbxObject, kFbxObjectStore pStoreWhat) override
Store/Retrieve data to/from FBX files.
virtual bool AnimationNodeNotify(FBAnimationNode *pAnimationNode, FBEvaluateInfo *pEvaluateInfo, FBConstraintInfo *pConstraintInfo)
Notification callback for connectors.
FBPropertyBool HasLayout
Read Write Property: Does the constraint have a layout?
virtual bool DeformerBind(FBModel *pModel)
Bind/Unbind pModel to deformation constraint.
virtual void FreezeSRT(FBModel *pModel, bool pS, bool pR, bool pT)
Freeze current model state.
virtual bool DeformerNotify(FBModel *pModel, const FBVertex *pSrcVertex, const FBVertex *pSrcNormal, int pCount, FBVertex *pDstVertex, FBVertex *pDstNormal)
Deformation notification function.
virtual void ActiveChanged()
Notification for Activation Status Change.
FBPropertyAction Snap
Function Property: Snap constraint.
int ReferenceGroupGetCount()
Return the number of reference groups.
FBPropertyBool Deformer
Read Write Property: Is a deformer constraint?
virtual FBConstraint * Clone()
Clone the constraint.
int ReferenceGetCount(int pGroupIndex)
Get number of references in a specified group.
FBModel * ReferenceGet(int pGroupIndex, int pItemIndex=0)
Get a reference.
FBPropertyBool Active
Read Write Property: Active state.
FBAnimationNode * AnimationNodeOutCreate(kReference pUserId, FBModel *pModel, const char *pAttribute)
Animation Node Creations (IN/OUT).
virtual void RemoveAllAnimationNodes()
Remove animation nodes.
virtual bool ReferenceAddNotify(int pGroupIndex, FBModel *pModel)
Notification callbacks for when a reference is added or removed.
FBPropertyAnimatableDouble Weight
Read Write Property: Weight of constraint.
virtual bool Disable(FBModel *pModel)
Disable constraint on pModel.
virtual void RestoreModelState(FBModel *pModel)
Restore the saved model state onto pModel.
int ReferenceGroupAdd(const char *pGroupName, int pMaxItemCount)
Add a group of references.
virtual void FreezeSuggested()
Suggest 'freeze'.
Constraint information class.
bool GetZeroRequested()
Was a 'zero' requested?
bool GetSnapRequested()
Was a 'snap' requested?
Constraint manager.
FBConstraint * TypeCreateConstraint(int pTypeIndex)
Create a constraint by index.
static FBConstraintManager & TheOne()
Get the global FBConstraintManager object.
FBConstraint * TypeCreateConstraint(const char *pName)
Create a constraint by name.
const char * TypeGetName(int pTypeIndex) const
Get the name of a registered type of constraint.
FBConstraintManager()
Constructor.
int TypeGetCount() const
Get the number of registered constraint types.
ConstraintRelation class.
bool GetBoxPosition(FBBox *pBox, int &pX, int &pY)
Get a box position in the GUI.
FBBox * ConstrainObject(FBBox *pConstrainedObject)
Create a receiver box.
bool SetBoxPosition(FBBox *pBox, int pX, int pY)
Set a box position in the GUI.
FBPropertyListBox Boxes
List: Boxes used in this constraint.
FBBox * SetAsSource(FBBox *pSource)
Create a sender box.
FBConstraintRelation(const char *pName, HIObject pObject=NULL)
Constructor.
FBBox * CreateFunctionBox(const char *pGroup, const char *pName)
Create a function box.
Base class for constraint solver.
bool BackgroundEvaluateInfoNotify(FBEvaluateInfo *pBackgroundEvaluateInfo, kBackgroundEvaluationCallback pFunction, void *pCustomData=NULL)
Enable evaluation notification.
void BackgroundEvaluateInfoEnd(FBEvaluateInfo *pBackgroundEvaluateInfo)
Release background evaluation info - very important.
FBEvaluateInfo * BackgroundEvaluateInfoBegin(FBEvaluateInfo *pSourceEvaluateInfo, bool pEvaluateCandidates=false)
Start background evaluation.
FBPropertyInt SampleRecordingPrecision
Read Write Property: Sample Recording Precision?
FBEvaluateInfo * BackgroundEvaluateInfoRecursiveBegin(FBEvaluateInfo *pSourceEvaluateInfo, bool pForceUpdateLocals=false)
Start recursive background evaluation.
FBPropertyBool SyncAnimationPlay
Read Write Property: Sync animation play speed with solver? (for computation expensive scenes this wi...
AnimationNodeNotify evaluation information.
FBX file interface.
Definition fbfbx.h:80
Model class.
Definition fbmodel.h:274
Wrapper around a specific instance of a FBModel object.
FBPropertyBool UseGlobalTransforms
Read Write Property: Indicate if the translations are expressed in local or global mode.
FBModelPlaceHolder(HIObject pObject)
Constructor.
FBPropertyModel Model
Read Only Property: Underlying model object.
Base class for physical properties attach to a model.
Property: Action Action property to trigger function.
Property: Base property class.
List: Box informations for constraint relation.
virtual void RemoveAt(int pIndex)
Remove FBBox object from property list.
virtual int GetCount()
Get the number of objects.
virtual FBBox * operator[](int pIndex)
Get the FBBox object at pIndex.
int Add(FBBox *pItem)
Add a FBBox object to the property list.
PropertyList: Component.
PropertyList: Concrete class for PropertyList of component
PropertyList: Constraint
FBConstraint * operator[](int pIndex)
Get the constraint at pIndex.
PropertyList: Constraint solver
FBConstraint * operator[](int pIndex)
Get the model template at pIndex.
PropertyList: Physical properties
FBPhysicalProperties * operator[](int pIndex)
Get the model template at pIndex.
Property class: const char * (String).
Time data structure.
Definition fbtime.h:88
Basic class definitions.
#define __FBClassDeclare(Name, Parent)
For internal use only.
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Contains definitions for devices, boxes and models.
class K_DLLIMPORT FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
class K_DLLIMPORT FBPropertyBaseAnimatable< double, kFBPT_double > FBPropertyAnimatableDouble
FBPropertyBaseAnimatableDouble type definition.
class K_DLLIMPORT FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
#define FB_DEFINE_LIST(DllTag, Type)
Define a component list.
#define FB_DEFINE_COMPONENT(DllTag, Type)
Define a component and give it the ability to be a property.
class K_DLLIMPORT FBVector4< float > FBVertex
Vertex.
Definition fbtypes.h:597
kFbxObjectStore
Description of the different store/retrieve passes of the FBX format.
Definition fbtypes.h:74
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition fbtypes.h:62
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition fbtypes.h:68
class K_DLLIMPORT FBVector3< double > FBVector3d
3D vector.
Definition fbtypes.h:438