OpenToonz - An open-source full-featured 2D animation creation software
C
fix style switch on raster
shun_iwasawae3df22b49e98
diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cppindex 808efaa60..5b7d27e25 100644--- a/toonz/sources/tnztools/fullcolorbrushtool.cpp+++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp@@ -184,20 +184,7 @@ void FullColorBrushTool::updateTranslation() {void FullColorBrushTool::onActivate() {if (!m_notifier) m_notifier = new FullColorBrushToolNotifier(this);- TTool::Application *app = getApplication();-- if (app->getCurrentObject()->isSpline()) {- m_currentColor = TPixel32::Red;- return;- }-- int styleIndex = app->getCurrentLevelStyleIndex();- TPalette *plt = app->getCurrentPalette()->getPalette();- if (plt) {- int style = app->getCurrentLevelStyleIndex();- TColorStyle *colorStyle = plt->getStyle(style);- m_currentColor = colorStyle->getMainColor();- }+ updateCurrentColor();if (m_firstTime) {m_firstTime = false;@@ -271,6 +258,10 @@ void FullColorBrushTool::leftButtonDown(const TPointD &pos,if (!ri) return;+ /* update color here since the current style might be switched with numpad+ * shortcut keys */+ updateCurrentColor();+TRasterP ras = ri->getRaster();TDimension dim = ras->getSize();@@ -511,18 +502,8 @@ void FullColorBrushTool::onEnter() {m_minThick = 0;m_maxThick = 0;}- Application *app = getApplication();- if (app->getCurrentObject()->isSpline()) {- m_currentColor = TPixel32::Red;- return;- }- TPalette *plt = app->getCurrentPalette()->getPalette();- if (!plt) return;-- int style = app->getCurrentLevelStyleIndex();- TColorStyle *colorStyle = plt->getStyle(style);- m_currentColor = colorStyle->getMainColor();+ updateCurrentColor();}//----------------------------------------------------------------------------------------------------------@@ -680,6 +661,22 @@ void FullColorBrushTool::removePreset() {m_preset.setValue(CUSTOM_WSTR);}+//------------------------------------------------------------------++void FullColorBrushTool::updateCurrentColor() {+ TTool::Application *app = getApplication();+ if (app->getCurrentObject()->isSpline()) {+ m_currentColor = TPixel32::Red;+ return;+ }+ TPalette *plt = app->getCurrentPalette()->getPalette();+ if (!plt) return;++ int style = app->getCurrentLevelStyleIndex();+ TColorStyle *colorStyle = plt->getStyle(style);+ m_currentColor = colorStyle->getMainColor();+}+//==========================================================================================================FullColorBrushToolNotifier::FullColorBrushToolNotifier(FullColorBrushTool *tool)diff --git a/toonz/sources/tnztools/fullcolorbrushtool.h b/toonz/sources/tnztools/fullcolorbrushtool.hindex 2eebc70b6..f6aff57b4 100644--- a/toonz/sources/tnztools/fullcolorbrushtool.h+++ b/toonz/sources/tnztools/fullcolorbrushtool.h@@ -23,6 +23,8 @@ class FullColorBrushToolNotifier;class FullColorBrushTool final : public TTool {Q_DECLARE_TR_FUNCTIONS(FullColorBrushTool)+ void updateCurrentColor();+public:FullColorBrushTool(std::string name);