| #pragma once |
| |
| #ifndef TDOUBLEPARAM_H |
| #define TDOUBLEPARAM_H |
| |
| #include <memory> |
| |
| |
| #include "tgeometry.h" |
| #include "tfilepath.h" |
| |
| |
| #include "tparam.h" |
| #include "tparamchange.h" |
| |
| |
| #include <set> |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TPARAM_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| |
| |
| |
| class TDoubleParam; |
| class TDoubleKeyframe; |
| class TMeasure; |
| class TExpression; |
| class TDoubleKeyframe; |
| |
| namespace TSyntax { |
| class Grammar; |
| class CalculatorNodeVisitor; |
| } |
| |
| #ifdef _WIN32 |
| template class DVAPI TPersistDeclarationT<TDoubleParam>; |
| #endif |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TDoubleParam final : public TParam { |
| PERSIST_DECLARATION(TDoubleParam) |
| |
| class Imp; |
| std::unique_ptr<Imp> m_imp; |
| |
| public: |
| TDoubleParam(double v = 0.0); |
| TDoubleParam(const TDoubleParam &src); |
| ~TDoubleParam(); |
| |
| TDoubleParam &operator=(const TDoubleParam &); |
| |
| TParam *clone() const override { return new TDoubleParam(*this); } |
| void copy(TParam *src) override; |
| |
| std::string getMeasureName() const; |
| void setMeasureName(std::string name); |
| TMeasure *getMeasure() const; |
| |
| void setValueRange(double min, double max, double step = 1.0); |
| bool getValueRange(double &min, double &max, double &step) const; |
| |
| double getDefaultValue() const; |
| void setDefaultValue(double value); |
| |
| double getValue(double frame, bool leftmost = false) const; |
| |
| |
| |
| |
| bool setValue(double frame, double value); |
| |
| |
| |
| |
| |
| |
| TPointD getSpeedIn(int kIndex) const; |
| |
| |
| |
| TPointD getSpeedOut(int kIndex) const; |
| |
| |
| |
| |
| |
| |
| const TSyntax::Grammar *getGrammar() const; |
| void setGrammar(const TSyntax::Grammar *grammar); |
| |
| void accept(TSyntax::CalculatorNodeVisitor &visitor); |
| |
| |
| void enableCycle(bool enabled); |
| bool isCycleEnabled() const; |
| |
| int getKeyframeCount() const; |
| void getKeyframes(std::set<double> &frames) const override; |
| double keyframeIndexToFrame(int index) const override; |
| |
| const TDoubleKeyframe &getKeyframe(int index) const; |
| const TDoubleKeyframe &getKeyframeAt(double frame) const; |
| |
| |
| |
| void setKeyframe(int kIndex, const TDoubleKeyframe &k); |
| |
| |
| |
| void setKeyframes(const std::map<int, TDoubleKeyframe> &ks); |
| |
| |
| void setKeyframe(const TDoubleKeyframe &k); |
| |
| bool isKeyframe(double frame) const override; |
| bool hasKeyframes() const override; |
| void deleteKeyframe(double frame) override; |
| void clearKeyframes() override; |
| |
| int getClosestKeyframe(double frame) const; |
| int getNextKeyframe(double frame) const override; |
| int getPrevKeyframe(double frame) const override; |
| |
| void assignKeyframe(double frame, const TParamP &src, double srcFrame, |
| bool changedOnly) override; |
| |
| bool isAnimatable() const override { return true; } |
| |
| void addObserver(TParamObserver *observer) override; |
| void removeObserver(TParamObserver *observer) override; |
| |
| const std::set<TParamObserver *> &observers() const; |
| |
| |
| bool isDefault() const; |
| |
| void loadData(TIStream &is) override; |
| void saveData(TOStream &os) override; |
| std::string getStreamTag() const; |
| |
| std::string getValueAlias(double frame, int precision) override; |
| }; |
| |
| DVAPI void splitSpeedInOutSegment(TDoubleKeyframe &k, TDoubleKeyframe &k0, |
| TDoubleKeyframe &k1); |
| |
| |
| |
| DEFINE_PARAM_SMARTPOINTER(TDoubleParam, double) |
| |
| #endif |