diff --git a/toonz/sources/tnztools/pumptool.cpp b/toonz/sources/tnztools/pumptool.cpp index c2192d8c..33168dd9 100644 --- a/toonz/sources/tnztools/pumptool.cpp +++ b/toonz/sources/tnztools/pumptool.cpp @@ -13,6 +13,7 @@ #include "tvectorrenderdata.h" #include "tstrokedeformations.h" #include "tmathutil.h" +#include "tenv.h" // Toonz includes #include "toonz/tobjecthandle.h" @@ -26,6 +27,9 @@ // Qt includes #include // For Qt translation support +TEnv::DoubleVar PumpSize("PumpToolSize", 20.0); +TEnv::IntVar PumpAccuracy("PumpToolAccuracy", 40); + using namespace ToolUtils; //***************************************************************************** @@ -35,6 +39,7 @@ using namespace ToolUtils; class PumpTool final : public TTool { Q_DECLARE_TR_FUNCTIONS(PumpTool) + bool m_firstTime; int m_strokeStyleId, m_strokeIndex; //!< Edited stroke indices TStroke *m_inStroke, *m_outStroke; //!< Input/Output strokes std::vector @@ -88,7 +93,8 @@ public: , m_undo(0) , m_toolSize("Size:", 1, 100, 20) , m_accuracy("Accuracy:", 0, 100, 40) - , m_enabled(false) { + , m_enabled(false) + , m_firstTime(false) { bind(TTool::VectorImage); m_splitPars.resize(2); @@ -125,6 +131,8 @@ public: } void invalidateCursorArea(); + bool onPropertyChanged(std::string propertyName) override; + void onActivate() override; void onDeactivate() override; private: @@ -529,6 +537,28 @@ bool PumpTool::moveCursor(const TPointD &pos) { return false; } +//----------------------------------------------------------------------------- + +bool PumpTool::onPropertyChanged(std::string propertyName) { + if (propertyName == m_toolSize.getName()) + PumpSize = m_toolSize.getValue(); + else if (propertyName == m_accuracy.getName()) + PumpAccuracy = m_accuracy.getValue(); + else + return false; + return true; +} + +//----------------------------------------------------------------------------- + +void PumpTool::onActivate() { + if (!m_firstTime) { + m_firstTime = true; + m_toolSize.setValue(PumpSize); + m_accuracy.setValue(PumpAccuracy); + } +} + //---------------------------------------------------------------------- void PumpTool::onDeactivate() {