| #pragma once |
| |
| #ifndef PLASTICSKELETONDEFORMATION_H |
| #define PLASTICSKELETONDEFORMATION_H |
| |
| #include <memory> |
| |
| |
| #include "tsmartpointer.h" |
| #include "tdoubleparam.h" |
| #include "tdoublekeyframe.h" |
| |
| |
| #include "ext/plastichandle.h" |
| #include "ext/plasticskeleton.h" |
| |
| |
| #include "tcg/tcg_any_iterator.h" |
| |
| |
| #include <QString> |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TNZEXT_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| |
| |
| |
| class ParamsObserver; |
| class ParamChange; |
| |
| |
| |
| |
| |
| |
| |
| |
| typedef struct DVAPI PlasticSkeletonVertexDeformation final : public TPersist { |
| PERSIST_DECLARATION(PlasticSkeletonVertexDeformation) |
| |
| public: |
| enum Params { |
| ANGLE = 0, |
| DISTANCE, |
| SO, |
| PARAMS_COUNT |
| }; |
| |
| struct Keyframe { |
| TDoubleKeyframe m_keyframes[PARAMS_COUNT]; |
| }; |
| |
| public: |
| TDoubleParamP m_params[PARAMS_COUNT]; |
| |
| public: |
| Keyframe getKeyframe(double frame) const; |
| |
| void setKeyframe(double frame); |
| bool setKeyframe(const Keyframe &values); |
| bool setKeyframe(const Keyframe &values, double frame, double easeIn = -1.0, |
| double easeOut = -1.0); |
| |
| bool isKeyframe(double frame) const; |
| bool isFullKeyframe(double frame) const; |
| void deleteKeyframe(double frame); |
| |
| void saveData(TOStream &os) override; |
| void loadData(TIStream &is) override; |
| |
| } SkVD; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| typedef struct PlasticSkeletonDeformationKeyframe { |
| std::map<QString, SkVD::Keyframe> |
| m_vertexKeyframes; |
| TDoubleKeyframe m_skelIdKeyframe; |
| |
| } SkDKey; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI PlasticSkeletonDeformation final : public TSmartObject, |
| public TPersist { |
| DECLARE_CLASS_CODE |
| PERSIST_DECLARATION(PlasticSkeletonDeformation) |
| |
| private: |
| class Imp; |
| std::unique_ptr<Imp> m_imp; |
| |
| public: |
| typedef tcg::any_it<int, int, void *>::bidirectional skelId_iterator; |
| typedef tcg::any_it<std::pair<const QString *, SkVD *>, |
| std::pair<const QString *, SkVD *>, void *>::bidirectional |
| vd_iterator; |
| typedef tcg::any_it<std::pair<int, int>, std::pair<int, int>, |
| void *>::bidirectional vx_iterator; |
| |
| public: |
| PlasticSkeletonDeformation(); |
| PlasticSkeletonDeformation( |
| const PlasticSkeletonDeformation |
| &other); |
| ~PlasticSkeletonDeformation(); |
| |
| PlasticSkeletonDeformation &operator=( |
| const PlasticSkeletonDeformation &other); |
| |
| |
| |
| bool empty() const; |
| int skeletonsCount() const; |
| |
| |
| |
| void attach(int skeletonId, PlasticSkeleton *skeleton); |
| |
| |
| void detach(int skeletonId); |
| |
| PlasticSkeletonP skeleton(int skeletonId) const; |
| int skeletonId(PlasticSkeleton *skeleton) const; |
| |
| |
| void skeletonIds(skelId_iterator &begin, skelId_iterator &end) const; |
| |
| TDoubleParamP skeletonIdsParam() |
| const; |
| |
| PlasticSkeletonP skeleton( |
| double frame) const; |
| int skeletonId(double frame) |
| const; |
| |
| |
| |
| int vertexDeformationsCount() const; |
| |
| SkVD *vertexDeformation(const QString &vertexName) |
| const; |
| |
| |
| SkVD *vertexDeformation(int skelId, int v) const; |
| |
| void vertexDeformations(vd_iterator &begin, vd_iterator &end) |
| const; |
| |
| void vdSkeletonVertices(const QString &vertexName, vx_iterator &begin, |
| vx_iterator &end) |
| const; |
| |
| |
| |
| |
| int hookNumber(const QString &name) const; |
| int hookNumber(int skelId, int v) const; |
| |
| QString vertexName(int hookNumber) const; |
| int vertexIndex(int hookNumber, int skelId) const; |
| |
| |
| |
| void addObserver(TParamObserver *observer); |
| void removeObserver(TParamObserver *observer); |
| |
| void setGrammar(TSyntax::Grammar *grammar); |
| |
| |
| |
| void getKeyframeAt(double frame, SkDKey &keysMap) |
| const; |
| |
| void setKeyframe(double frame); |
| bool setKeyframe(const SkDKey &keyframe); |
| bool setKeyframe(const SkDKey &keyframe, double frame, double easeIn = -1.0, |
| double easeOut = -1.0); |
| |
| bool isKeyframe(double frame) const; |
| bool isFullKeyframe(double frame) const; |
| void deleteKeyframe(double frame); |
| |
| |
| |
| |
| void storeDeformedSkeleton(int skeletonId, double frame, |
| PlasticSkeleton &skeleton) const; |
| |
| void updatePosition(const PlasticSkeleton &originalSkeleton, |
| PlasticSkeleton &deformedSkeleton, double frame, int v, |
| const TPointD &pos); |
| void updateAngle(const PlasticSkeleton &originalSkeleton, |
| PlasticSkeleton &deformedSkeleton, double frame, int v, |
| const TPointD &pos); |
| |
| protected: |
| void saveData(TOStream &os) override; |
| void loadData(TIStream &is) override; |
| |
| private: |
| friend class PlasticSkeleton; |
| |
| void addVertex( |
| PlasticSkeleton *sk, |
| int v); |
| void insertVertex(PlasticSkeleton *sk, int v); |
| |
| |
| void deleteVertex( |
| PlasticSkeleton *sk, |
| int v); |
| void vertexNameChange( |
| PlasticSkeleton *sk, int v, |
| const QString &newName); |
| void clear(PlasticSkeleton *sk); |
| |
| void loadData_prerelease( |
| TIStream &is); |
| |
| }; |
| |
| typedef PlasticSkeletonDeformation SkD; |
| |
| |
| |
| #ifdef _WIN32 |
| #ifndef TFX_EXPORTS |
| template class DVAPI TSmartPointerT<PlasticSkeletonDeformation>; |
| #endif |
| #endif |
| |
| typedef TSmartPointerT<PlasticSkeletonDeformation> PlasticSkeletonDeformationP; |
| typedef PlasticSkeletonDeformationP SkDP; |
| |
| #endif // PLASTICSKELETONDEFORMATION_H |