OpenToonz - An open-source full-featured 2D animation creation software
C
Add preference:Paint under/over INK in refer fill
Abel You139ccc85cec9
diff --git a/toonz/sources/include/toonz/fill.h b/toonz/sources/include/toonz/fill.hindex 2b14c7092..640fe0565 100644--- a/toonz/sources/include/toonz/fill.h+++ b/toonz/sources/include/toonz/fill.h@@ -26,6 +26,8 @@#include "preferences.h"#define DEF_REGION_WITH_PAINT \Preferences::instance()->getBoolValue(PreferencesItemId::DefRegionWithPaint)+#define USE_PREVAILING_REFER_FILL \+ Preferences::instance()->getBoolValue(PreferencesItemId::ReferFillPrevailing)class TPalette;diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.hindex 44c388d6d..a2b36de5b 100644--- a/toonz/sources/include/toonz/preferencesitemids.h+++ b/toonz/sources/include/toonz/preferencesitemids.h@@ -111,6 +111,7 @@ enum PreferencesItemId {// dropdownShortcutsCycleOptions, // removedFillOnlysavebox,DefRegionWithPaint,+ ReferFillPrevailing,multiLayerStylePickerEnabled,cursorBrushType,cursorBrushStyle,diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cppindex c320c5e33..fbeb26373 100644--- a/toonz/sources/toonz/preferencespopup.cpp+++ b/toonz/sources/toonz/preferencespopup.cpp@@ -1310,6 +1310,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {{FillOnlysavebox, tr("Use the TLV Savebox to Limit Filling Operations")},{DefRegionWithPaint,tr("Define filling region with both PAINT and INK")},+ { ReferFillPrevailing, tr("Paint under/over INK in refer fill") },{multiLayerStylePickerEnabled,tr("Multi Layer Style Picker: Switch Levels by Picking")},{cursorBrushType, tr("Basic Cursor Type:")},@@ -2059,6 +2060,7 @@ QWidget* PreferencesPopup::createToolsPage() {// insertUI(dropdownShortcutsCycleOptions, lay,// getComboItemList(dropdownShortcutsCycleOptions));insertUI(PreferencesItemId::DefRegionWithPaint, lay);+ insertUI(PreferencesItemId::ReferFillPrevailing, lay);insertUI(FillOnlysavebox, lay);insertUI(multiLayerStylePickerEnabled, lay);QGridLayout* cursorOptionsLay = insertGroupBox(tr("Cursor Options"), lay);diff --git a/toonz/sources/toonzlib/fill.cpp b/toonz/sources/toonzlib/fill.cppindex 45b552099..996bf9ad3 100644--- a/toonz/sources/toonzlib/fill.cpp+++ b/toonz/sources/toonzlib/fill.cpp@@ -91,6 +91,10 @@ void fillRow(const TRasterCM32P &r, const TPoint &p, int &xa, int &xb,tmp_limit = pix + 10; // edge stop fill == 10 per defaultif (limit > tmp_limit) limit = tmp_limit;for (; pix <= limit; pix++) {+ if (refImagePut && !USE_PREVAILING_REFER_FILL &&+ pix->getInk() == TPixelCM32::getMaxInk() &&+ limit - pix <= (DEF_REGION_WITH_PAINT ? 10 : 9))+ break;if (DEF_REGION_WITH_PAINT && pix->getPaint() != paintAtClickPos) break;if (pix->getPaint() == paint) break;if (pix->getTone() != 0) break;@@ -143,6 +147,10 @@ void fillRow(const TRasterCM32P &r, const TPoint &p, int &xa, int &xb,tmp_limit = pix - 10;if (limit < tmp_limit) limit = tmp_limit;for (; pix >= limit; pix--) {+ if (refImagePut && !USE_PREVAILING_REFER_FILL &&+ pix->getInk() == TPixelCM32::getMaxInk() &&+ pix - limit <= (DEF_REGION_WITH_PAINT ? 10 : 9))+ break;if (DEF_REGION_WITH_PAINT && pix->getPaint() != paintAtClickPos) break;if (pix->getPaint() == paint) break;if (pix->getTone() != 0) break;@@ -320,7 +328,7 @@ void fullColorFindSegment(const TRaster32P &r, const TPoint &p, int &xa,//-----------------------------------------------------------------------------class FillSeed {- public:+public:int m_xa, m_xb;int m_y, m_dy;FillSeed(int xa, int xb, int y, int dy)@@ -534,14 +542,14 @@ bool fill(const TRasterCM32P &r, const FillParameters ¶ms,assert(fillDepth >= 0 && fillDepth < 16);switch (TPixelCM32::getMaxTone()) {- case 15:- fillDepth = (15 - fillDepth);- break;- case 255:- fillDepth = ((15 - fillDepth) << 4) | (15 - fillDepth);- break;- default:- assert(false);+ case 15:+ fillDepth = (15 - fillDepth);+ break;+ case 255:+ fillDepth = ((15 - fillDepth) << 4) | (15 - fillDepth);+ break;+ default:+ assert(false);}/*--Look at the colors in the four corners and update the saveBox if any of* the colors change. --*/diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cppindex ee8aae57c..227eaf8db 100644--- a/toonz/sources/toonzlib/preferences.cpp+++ b/toonz/sources/toonzlib/preferences.cpp@@ -545,6 +545,7 @@ void Preferences::definePreferenceItems() {// int)define(FillOnlysavebox, "FillOnlysavebox", QMetaType::Bool, false);define(DefRegionWithPaint, "FillDefRegionWithPaint", QMetaType::Bool, true);+ define(ReferFillPrevailing, "ReferFillPrevailing", QMetaType::Bool, false);define(multiLayerStylePickerEnabled, "multiLayerStylePickerEnabled",QMetaType::Bool, false);define(cursorBrushType, "cursorBrushType", QMetaType::QString, "Small");