diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cpp index 1d01300..95a4e57 100644 --- a/toonz/sources/tnztools/fullcolorbrushtool.cpp +++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp @@ -578,6 +578,8 @@ void FullColorBrushTool::setWorkAndBackupImages() { //------------------------------------------------------------------ bool FullColorBrushTool::onPropertyChanged(std::string propertyName) { + if (m_propertyUpdating) return true; + updateCurrentStyle(); if (propertyName == "Preset:") { @@ -587,7 +589,9 @@ bool FullColorBrushTool::onPropertyChanged(std::string propertyName) { loadLastBrush(); FullcolorBrushPreset = m_preset.getValueAsString(); + m_propertyUpdating = true; getApplication()->getCurrentTool()->notifyToolChanged(); + m_propertyUpdating = false; return true; } @@ -605,7 +609,9 @@ bool FullColorBrushTool::onPropertyChanged(std::string propertyName) { if (m_preset.getValue() != CUSTOM_WSTR) { m_preset.setValue(CUSTOM_WSTR); FullcolorBrushPreset = m_preset.getValueAsString(); + m_propertyUpdating = true; getApplication()->getCurrentTool()->notifyToolChanged(); + m_propertyUpdating = false; } return true; diff --git a/toonz/sources/tnztools/fullcolorbrushtool.h b/toonz/sources/tnztools/fullcolorbrushtool.h index b4df3c9..414aff9 100644 --- a/toonz/sources/tnztools/fullcolorbrushtool.h +++ b/toonz/sources/tnztools/fullcolorbrushtool.h @@ -122,6 +122,8 @@ protected: bool m_firstTime; bool m_mousePressed = false; TMouseEvent m_mouseEvent; + + bool m_propertyUpdating = false; }; //------------------------------------------------------------ diff --git a/toonz/sources/tnztools/toonzrasterbrushtool.cpp b/toonz/sources/tnztools/toonzrasterbrushtool.cpp index ffb70f3..3009998 100644 --- a/toonz/sources/tnztools/toonzrasterbrushtool.cpp +++ b/toonz/sources/tnztools/toonzrasterbrushtool.cpp @@ -1936,14 +1936,18 @@ void ToonzRasterBrushTool::setWorkAndBackupImages() { //------------------------------------------------------------------ bool ToonzRasterBrushTool::onPropertyChanged(std::string propertyName) { + if (m_propertyUpdating) return true; + if (propertyName == m_preset.getName()) { if (m_preset.getValue() != CUSTOM_WSTR) loadPreset(); else // Chose , go back to last saved brush settings loadLastBrush(); - RasterBrushPreset = m_preset.getValueAsString(); + RasterBrushPreset = m_preset.getValueAsString(); + m_propertyUpdating = true; getApplication()->getCurrentTool()->notifyToolChanged(); + m_propertyUpdating = false; return true; } @@ -1980,8 +1984,10 @@ bool ToonzRasterBrushTool::onPropertyChanged(std::string propertyName) { if (m_preset.getValue() != CUSTOM_WSTR) { m_preset.setValue(CUSTOM_WSTR); - RasterBrushPreset = m_preset.getValueAsString(); + RasterBrushPreset = m_preset.getValueAsString(); + m_propertyUpdating = true; getApplication()->getCurrentTool()->notifyToolChanged(); + m_propertyUpdating = false; } return true; diff --git a/toonz/sources/tnztools/toonzrasterbrushtool.h b/toonz/sources/tnztools/toonzrasterbrushtool.h index ece7ca3..0e8eaef 100644 --- a/toonz/sources/tnztools/toonzrasterbrushtool.h +++ b/toonz/sources/tnztools/toonzrasterbrushtool.h @@ -223,6 +223,8 @@ protected: QElapsedTimer m_brushTimer; int m_minCursorThick, m_maxCursorThick; + bool m_propertyUpdating = false; + protected: static void drawLine(const TPointD &point, const TPointD ¢re, bool horizontal, bool isDecimal); diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.cpp b/toonz/sources/tnztools/toonzvectorbrushtool.cpp index bfaee36..2653acb 100644 --- a/toonz/sources/tnztools/toonzvectorbrushtool.cpp +++ b/toonz/sources/tnztools/toonzvectorbrushtool.cpp @@ -1438,6 +1438,8 @@ void ToonzVectorBrushTool::resetFrameRange() { //------------------------------------------------------------------ bool ToonzVectorBrushTool::onPropertyChanged(std::string propertyName) { + if (m_propertyUpdating) return true; + // Set the following to true whenever a different piece of interface must // be refreshed - done once at the end. bool notifyTool = false; @@ -1449,7 +1451,9 @@ bool ToonzVectorBrushTool::onPropertyChanged(std::string propertyName) { loadLastBrush(); V_VectorBrushPreset = m_preset.getValueAsString(); + m_propertyUpdating = true; getApplication()->getCurrentTool()->notifyToolChanged(); + m_propertyUpdating = false; return true; } @@ -1505,7 +1509,11 @@ bool ToonzVectorBrushTool::onPropertyChanged(std::string propertyName) { notifyTool = true; } - if (notifyTool) getApplication()->getCurrentTool()->notifyToolChanged(); + if (notifyTool) { + m_propertyUpdating = true; + getApplication()->getCurrentTool()->notifyToolChanged(); + m_propertyUpdating = false; + } return true; } diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.h b/toonz/sources/tnztools/toonzvectorbrushtool.h index 8978d8c..ea53182 100644 --- a/toonz/sources/tnztools/toonzvectorbrushtool.h +++ b/toonz/sources/tnztools/toonzvectorbrushtool.h @@ -197,6 +197,8 @@ protected: TPointD m_lastDragPos; //!< Position where mouse was last dragged. TMouseEvent m_lastDragEvent; //!< Previous mouse-drag event. + + bool m_propertyUpdating = false; }; #endif // TOONZVECTORBRUSHTOOL_H