| 1 | /**************************************************************************************** |
| 2 | |
| 3 | Copyright (C) 2015 Autodesk, Inc. |
| 4 | All rights reserved. |
| 5 | |
| 6 | Use of this software is subject to the terms of the Autodesk license agreement |
| 7 | provided at the time of installation or download, or which otherwise accompanies |
| 8 | this software in either electronic or hard copy form. |
| 9 | |
| 10 | ****************************************************************************************/ |
| 11 | |
| 12 | //! \file fbxconstraint.h |
| 13 | #ifndef _FBXSDK_SCENE_CONSTRAINT_H_ |
| 14 | #define _FBXSDK_SCENE_CONSTRAINT_H_ |
| 15 | |
| 16 | #include <fbxsdk/fbxsdk_def.h> |
| 17 | |
| 18 | #include <fbxsdk/core/fbxobject.h> |
| 19 | #include <fbxsdk/fbxsdk_nsbegin.h> |
| 20 | |
| 21 | /** Base class for weighted animation constraints. |
| 22 | * Constraints are primarily used to impose limits on properties of objects (e.g. position, orientation, scale) |
| 23 | * and to automate animation processes. |
| 24 | * A <b>constrained object</b> is an object with properties constrained by one or more weighted <b>constraint source</b>s. |
| 25 | * \nosubgrouping |
| 26 | */ |
| 27 | class FBXSDK_DLL FbxConstraint : public FbxObject |
| 28 | { |
| 29 | FBXSDK_OBJECT_DECLARE(FbxConstraint, FbxObject); |
| 30 | |
| 31 | public: |
| 32 | /** |
| 33 | * \name Properties |
| 34 | */ |
| 35 | //@{ |
| 36 | /** This property represents the degree of influence of a constraint from 0.0 (no influence) to 100.0 (full influence). |
| 37 | * |
| 38 | * Default value is 100.0. |
| 39 | */ |
| 40 | FbxPropertyT<FbxDouble> Weight; |
| 41 | |
| 42 | /** This property controls whether the constraint is applied or not. |
| 43 | * If the value is \c false the constraint will have no effect. The default value is \c true. |
| 44 | * |
| 45 | * Default value is true. |
| 46 | */ |
| 47 | FbxPropertyT<FbxBool> Active; |
| 48 | |
| 49 | /** This property handles the lock state of the constraint. |
| 50 | * |
| 51 | * When enabled, the constrained object cannot be moved away from its constrained location when the constraint is active. |
| 52 | * |
| 53 | * Default value is false. |
| 54 | */ |
| 55 | FbxPropertyT<FbxBool> Lock; |
| 56 | //@} |
| 57 | |
| 58 | /** \enum EType Constraint attribute types. |
| 59 | */ |
| 60 | enum EType |
| 61 | { |
| 62 | eUnknown, //! Invalid constraint. |
| 63 | ePosition, //! Position constraint (referred to as a point constraint in Maya). |
| 64 | eRotation, //! Rotation constraint (referred to as an orient constraint in Maya). |
| 65 | eScale, //! Scale constraint. |
| 66 | eParent, //! Parent constraint. |
| 67 | eSingleChainIK, //! Single chain IK constraint. |
| 68 | eAim, //! Aim constraint. |
| 69 | eCharacter, //! Character constraint. |
| 70 | eCustom //! User defined constraints. |
| 71 | }; |
| 72 | |
| 73 | /** Access the type of the constraint. |
| 74 | * \return This type of the constraint. |
| 75 | */ |
| 76 | virtual EType GetConstraintType() const { return eUnknown; } |
| 77 | |
| 78 | /** Retrieve the constrained object. |
| 79 | * \return The constrained object. |
| 80 | */ |
| 81 | virtual FbxObject* GetConstrainedObject() const { return NULL; } |
| 82 | |
| 83 | /** Retrieve the count of constraint source. |
| 84 | * \return The count of constraint source. |
| 85 | */ |
| 86 | virtual int GetConstraintSourceCount() const { return 0; } |
| 87 | |
| 88 | /** Retrieve a constraint source with the specified index. |
| 89 | * \param pIndex The specified index. |
| 90 | * \return The constraint source at the specified index. |
| 91 | */ |
| 92 | virtual FbxObject* GetConstraintSource(int /*pIndex*/) const { return NULL; } |
| 93 | |
| 94 | /** Get the weight associated with a constraint source. |
| 95 | * \param pObject The given constraint source. |
| 96 | * \return The weight of the constraint source. |
| 97 | */ |
| 98 | double GetSourceWeight(const FbxObject* pObject) const; |
| 99 | |
| 100 | /***************************************************************************************************************************** |
| 101 | ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** |
| 102 | *****************************************************************************************************************************/ |
| 103 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 104 | protected: |
| 105 | virtual void Construct(const FbxObject* pFrom); |
| 106 | virtual void ConstructProperties(bool pForceSet); |
| 107 | |
| 108 | #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ |
| 109 | }; |
| 110 | |
| 111 | /***************************************************************************************************************************** |
| 112 | ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** |
| 113 | *****************************************************************************************************************************/ |
| 114 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 115 | |
| 116 | const FbxString GetWeightPropertyName(const FbxObject * pObject); |
| 117 | void CreateWeightPropertyForSourceObject(FbxObject * pConstraint, const FbxObject * pSourceObject, double pWeightValue); |
| 118 | |
| 119 | #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ |
| 120 | |
| 121 | #include <fbxsdk/fbxsdk_nsend.h> |
| 122 | |
| 123 | #endif /* _FBXSDK_SCENE_CONSTRAINT_H_ */ |
| 124 | |