From d3c119f6722cd7042c8f0f07f91962df88c869a9 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Aug 09 2023 05:10:39 +0000 Subject: #assistants: fix ToonzRasterBrushTool::m_active --- diff --git a/toonz/sources/tnztools/toonzrasterbrushtool.cpp b/toonz/sources/tnztools/toonzrasterbrushtool.cpp index 39b295c..bbe67b1 100644 --- a/toonz/sources/tnztools/toonzrasterbrushtool.cpp +++ b/toonz/sources/tnztools/toonzrasterbrushtool.cpp @@ -1262,27 +1262,23 @@ void ToonzRasterBrushTool::leftButtonDown(const TPointD &pos, // todo: gestire autoenable if (!m_enabled) return; - TPointD centeredPos = getCenteredCursorPos(pos); - - m_active = !!getImage(true); - if (!m_active) { - m_active = !!touchImage(); - } + m_active = !!getImage(true); + if (!m_active) m_active = !!touchImage(); if (!m_active) return; - if (m_active) { - // nel caso che il colore corrente sia un cleanup/studiopalette color - // oppure il colore di un colorfield + // nel caso che il colore corrente sia un cleanup/studiopalette color + // oppure il colore di un colorfield + if (TColorStyle *cs = app->getCurrentLevelStyle()) { m_styleId = app->getCurrentLevelStyleIndex(); - TColorStyle *cs = app->getCurrentLevelStyle(); - if (cs) { - TRasterStyleFx *rfx = cs ? cs->getRasterStyleFx() : 0; - m_active = cs != 0 && (cs->isStrokeStyle() || (rfx && rfx->isInkStyle())); - } else { - m_styleId = 1; - } + TRasterStyleFx *rfx = cs->getRasterStyleFx(); + if (!cs->isStrokeStyle() && (!rfx || !rfx->isInkStyle())) + { m_active = false; return; } + } else { + m_styleId = 1; } + TPointD centeredPos = getCenteredCursorPos(pos); + // Modifier to do straight line if (e.isShiftPressed()) { m_isStraight = true; @@ -2036,12 +2032,7 @@ void ToonzRasterBrushTool::onEnter() { Application *app = getApplication(); - m_styleId = app->getCurrentLevelStyleIndex(); - TColorStyle *cs = app->getCurrentLevelStyle(); - if (cs) { - TRasterStyleFx *rfx = cs->getRasterStyleFx(); - m_active = cs->isStrokeStyle() || (rfx && rfx->isInkStyle()); - } + m_styleId = app->getCurrentLevelStyleIndex(); m_active = img; }