Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix current brush preset tracking (#401)

manongjohn8b8d417aff6d
diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cpp
index 765cbbd6b..7c74d8bda 100644
--- a/toonz/sources/tnztools/fullcolorbrushtool.cpp
+++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp
@@ -203,7 +203,9 @@ void FullColorBrushTool::onActivate() {
QString::fromStdString(FullcolorBrushPreset.getValue()).toStdWString();
if (wpreset != CUSTOM_WSTR) {
initPresets();
+ if (!m_preset.isValue(wpreset)) wpreset = CUSTOM_WSTR;
m_preset.setValue(wpreset);
+ FullcolorBrushPreset = m_preset.getValueAsString();
loadPreset();
} else
loadLastBrush();
@@ -707,6 +709,7 @@ void FullColorBrushTool::addPreset(QString name) {
// Set the value to the specified one
m_preset.setValue(preset.m_name);
+ FullcolorBrushPreset = m_preset.getValueAsString();
}
//------------------------------------------------------------------
@@ -720,6 +723,7 @@ void FullColorBrushTool::removePreset() {
// No parameter change, and set the preset value to custom
m_preset.setValue(CUSTOM_WSTR);
+ FullcolorBrushPreset = m_preset.getValueAsString();
}
//------------------------------------------------------------------
diff --git a/toonz/sources/tnztools/toonzrasterbrushtool.cpp b/toonz/sources/tnztools/toonzrasterbrushtool.cpp
index 56178a61d..3ff0afd85 100644
--- a/toonz/sources/tnztools/toonzrasterbrushtool.cpp
+++ b/toonz/sources/tnztools/toonzrasterbrushtool.cpp
@@ -1135,7 +1135,9 @@ void ToonzRasterBrushTool::onActivate() {
QString::fromStdString(RasterBrushPreset.getValue()).toStdWString();
if (wpreset != CUSTOM_WSTR) {
initPresets();
+ if (!m_preset.isValue(wpreset)) wpreset = CUSTOM_WSTR;
m_preset.setValue(wpreset);
+ RasterBrushPreset = m_preset.getValueAsString();
loadPreset();
} else
loadLastBrush();
@@ -2071,6 +2073,7 @@ void ToonzRasterBrushTool::addPreset(QString name) {
// Set the value to the specified one
m_preset.setValue(preset.m_name);
+ RasterBrushPreset = m_preset.getValueAsString();
}
//------------------------------------------------------------------
@@ -2084,6 +2087,7 @@ void ToonzRasterBrushTool::removePreset() {
// No parameter change, and set the preset value to custom
m_preset.setValue(CUSTOM_WSTR);
+ RasterBrushPreset = m_preset.getValueAsString();
}
//------------------------------------------------------------------
diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.cpp b/toonz/sources/tnztools/toonzvectorbrushtool.cpp
index cd5f55f64..196d565bd 100644
--- a/toonz/sources/tnztools/toonzvectorbrushtool.cpp
+++ b/toonz/sources/tnztools/toonzvectorbrushtool.cpp
@@ -619,7 +619,9 @@ void ToonzVectorBrushTool::onActivate() {
QString::fromStdString(V_VectorBrushPreset.getValue()).toStdWString();
if (wpreset != CUSTOM_WSTR) {
initPresets();
+ if (!m_preset.isValue(wpreset)) wpreset = CUSTOM_WSTR;
m_preset.setValue(wpreset);
+ V_VectorBrushPreset = m_preset.getValueAsString();
loadPreset();
} else
loadLastBrush();
@@ -1743,6 +1745,7 @@ void ToonzVectorBrushTool::addPreset(QString name) {
// Set the value to the specified one
m_preset.setValue(preset.m_name);
+ V_VectorBrushPreset = m_preset.getValueAsString();
}
//------------------------------------------------------------------
@@ -1756,6 +1759,7 @@ void ToonzVectorBrushTool::removePreset() {
// No parameter change, and set the preset value to custom
m_preset.setValue(CUSTOM_WSTR);
+ V_VectorBrushPreset = m_preset.getValueAsString();
}
//------------------------------------------------------------------