| 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 fbxblendshape.h |
| 13 | #ifndef _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_H_ |
| 14 | #define _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_H_ |
| 15 | |
| 16 | #include <fbxsdk/fbxsdk_def.h> |
| 17 | |
| 18 | #include <fbxsdk/scene/geometry/fbxdeformer.h> |
| 19 | |
| 20 | #include <fbxsdk/fbxsdk_nsbegin.h> |
| 21 | |
| 22 | class FbxGeometry; |
| 23 | class FbxBlendShapeChannel; |
| 24 | |
| 25 | /** Class for blend shape deformer. |
| 26 | * A blend shape deformer takes a base shape (polygonal surface, curve, or surface) |
| 27 | * and blends it with other target shapes based on weight values. |
| 28 | * Blend shape deformer organize all target shapes via blend shape channel. |
| 29 | * One blend shape deformer can contains multiple blend shape channels, then each |
| 30 | * channel can organize multiple target shapes, \see FbxBlendShapeChannel, FbxShape. |
| 31 | * \remarks The blend effect of each blend shape channel is additive, so the final blend |
| 32 | * effect of a blend shape deformer is the sum of blend effect of all blend shape |
| 33 | * channels it contains, the blend effect of each blend shape channel is controlled |
| 34 | * by the property DeformPercent of blend shape channel. |
| 35 | * \see FbxGeometry, FbxGeometryBase. |
| 36 | * \nosubgrouping |
| 37 | */ |
| 38 | |
| 39 | class FBXSDK_DLL FbxBlendShape : public FbxDeformer |
| 40 | { |
| 41 | FBXSDK_OBJECT_DECLARE(FbxBlendShape, FbxDeformer); |
| 42 | |
| 43 | public: |
| 44 | /** Set the geometry affected by this blend shape deformer. |
| 45 | * \param pGeometry Pointer to the geometry object to set. |
| 46 | * \return \c true on success, \c false otherwise. |
| 47 | * \remarks One blend shape deformer can only be used on one base geometry. |
| 48 | * So when SetGeometry is called, the pGeometry will replace the |
| 49 | * current base geometry connected to this blend shape deformer. |
| 50 | */ |
| 51 | bool SetGeometry(FbxGeometry* pGeometry); |
| 52 | |
| 53 | /** Get the geometry affected by this blend shape deformer. |
| 54 | * \return A pointer to the geometry if it is set or \c NULL if not set yet. |
| 55 | */ |
| 56 | FbxGeometry* GetGeometry(); |
| 57 | |
| 58 | /** Add a blend shape channel. |
| 59 | * \param pBlendShapeChannel Pointer to the blend shape channel object to add. |
| 60 | * \return \c true on success, \c false otherwise. |
| 61 | */ |
| 62 | bool AddBlendShapeChannel(FbxBlendShapeChannel* pBlendShapeChannel); |
| 63 | |
| 64 | /** Remove the given blend shape. |
| 65 | * \param pBlendShapeChannel Pointer to the blend shape channel to remove from this blend shape deformer. |
| 66 | * \return Pointer to the blend shape channel or \c NULL if pBlendShapeChannel is not owned by this blend shape deformer. |
| 67 | */ |
| 68 | FbxBlendShapeChannel* RemoveBlendShapeChannel(FbxBlendShapeChannel* pBlendShapeChannel); |
| 69 | |
| 70 | /** Get the number of blend shape channels. |
| 71 | * \return Number of blend shape channels that have been added to this object. |
| 72 | */ |
| 73 | int GetBlendShapeChannelCount() const; |
| 74 | |
| 75 | /** Get blend shape channel at given index. |
| 76 | * \param pIndex Index of the blend shape channel. |
| 77 | * \return Pointer to the blend shape channel or \c NULL if index is out of range. |
| 78 | */ |
| 79 | FbxBlendShapeChannel* GetBlendShapeChannel(int pIndex); |
| 80 | |
| 81 | /** Get the blend shape channel at given index. |
| 82 | * \param pIndex Index of the blend shape channel. |
| 83 | * \return Pointer to the blend shape channel or \c NULL if index is out of range. |
| 84 | */ |
| 85 | const FbxBlendShapeChannel* GetBlendShapeChannel(int pIndex) const; |
| 86 | |
| 87 | /** Get the type of the deformer. |
| 88 | * \return The deformer type identifier of blend shape deformer. |
| 89 | */ |
| 90 | EDeformerType GetDeformerType() const {return eBlendShape; }; |
| 91 | |
| 92 | /** Restore the blend shape deformer to the initial state. |
| 93 | * Calling this function will do the following: |
| 94 | * \li Clear the pointer to base geometry. |
| 95 | * \li Remove all the blend shape channels. |
| 96 | */ |
| 97 | void Reset(); |
| 98 | |
| 99 | /***************************************************************************************************************************** |
| 100 | ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** |
| 101 | *****************************************************************************************************************************/ |
| 102 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 103 | virtual FbxObject& Copy(const FbxObject& pObject); |
| 104 | virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; |
| 105 | |
| 106 | protected: |
| 107 | virtual FbxStringList GetTypeFlags() const; |
| 108 | #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ |
| 109 | }; |
| 110 | |
| 111 | #include <fbxsdk/fbxsdk_nsend.h> |
| 112 | |
| 113 | #endif /* _FBXSDK_SCENE_GEOMETRY_BLEND_SHAPE_H_ */ |
| 114 | |