Move TVL Savebox Limit Preference to toolbar option
This commit is contained in:
parent
b9ea823143
commit
563c022795
7 changed files with 67 additions and 28 deletions
|
@ -570,7 +570,8 @@ protected slots:
|
|||
class EraserToolOptionsBox final : public ToolOptionsBox {
|
||||
Q_OBJECT
|
||||
|
||||
ToolOptionCheckbox *m_pencilMode, *m_invertMode, *m_multiFrameMode;
|
||||
ToolOptionCheckbox *m_pencilMode, *m_invertMode, *m_multiFrameMode,
|
||||
*m_eraseOnlySavebox;
|
||||
ToolOptionCombo *m_toolType, *m_colorMode;
|
||||
QLabel *m_hardnessLabel, *m_colorModeLabel;
|
||||
ToolOptionSlider *m_hardnessField;
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
TPoint m_p;
|
||||
TPalette *m_palette;
|
||||
bool m_prevailing;
|
||||
bool m_fillOnlySavebox;
|
||||
|
||||
FillParameters()
|
||||
: m_styleId(0)
|
||||
|
@ -39,7 +40,8 @@ public:
|
|||
, m_p()
|
||||
, m_shiftFill(false)
|
||||
, m_palette(0)
|
||||
, m_prevailing(true) {}
|
||||
, m_prevailing(true)
|
||||
, m_fillOnlySavebox(false) {}
|
||||
FillParameters(const FillParameters ¶ms)
|
||||
: m_styleId(params.m_styleId)
|
||||
, m_fillType(params.m_fillType)
|
||||
|
@ -50,7 +52,8 @@ public:
|
|||
, m_p(params.m_p)
|
||||
, m_shiftFill(params.m_shiftFill)
|
||||
, m_palette(params.m_palette)
|
||||
, m_prevailing(params.m_prevailing) {}
|
||||
, m_prevailing(params.m_prevailing)
|
||||
, m_fillOnlySavebox(params.m_fillOnlySavebox) {}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -69,6 +69,7 @@ TEnv::IntVar FillSelective("InknpaintFillSelective", 0);
|
|||
TEnv::IntVar FillOnion("InknpaintFillOnion", 0);
|
||||
TEnv::IntVar FillSegment("InknpaintFillSegment", 0);
|
||||
TEnv::IntVar FillRange("InknpaintFillRange", 0);
|
||||
TEnv::IntVar FillOnlySavebox("InknpaintFillOnlySavebox", 0);
|
||||
|
||||
TEnv::StringVar RasterGapSetting("RasterGapSetting", "Ignore Gaps");
|
||||
extern TEnv::DoubleVar AutocloseDistance;
|
||||
|
@ -1103,7 +1104,7 @@ void doFill(const TImageP &img, const TPointD &pos, FillParameters ¶ms,
|
|||
TPoint offs(0, 0);
|
||||
TRasterCM32P ras = ti->getRaster();
|
||||
|
||||
if (Preferences::instance()->getFillOnlySavebox()) {
|
||||
if (params.m_fillOnlySavebox) {
|
||||
TRectD bbox = ti->getBBox();
|
||||
TRect ibbox = convert(bbox);
|
||||
offs = ibbox.getP00();
|
||||
|
@ -1164,9 +1165,8 @@ void doFill(const TImageP &img, const TPointD &pos, FillParameters ¶ms,
|
|||
t->m_rasterBounds = t->m_rasterBounds + offs;
|
||||
}
|
||||
TUndoManager::manager()->add(new RasterFillUndo(
|
||||
tileSet, params, sl, fid,
|
||||
Preferences::instance()->getFillOnlySavebox(), fillGaps, closeGaps,
|
||||
closeStyleIndex, AutocloseDistance));
|
||||
tileSet, params, sl, fid, params.m_fillOnlySavebox, fillGaps,
|
||||
closeGaps, closeStyleIndex, AutocloseDistance));
|
||||
}
|
||||
|
||||
// instead of updateFrame :
|
||||
|
@ -1962,7 +1962,8 @@ FillTool::FillTool(int targetType)
|
|||
, m_rasterGapDistance("Distance:", 1, 100, 10)
|
||||
, m_closeRasterGaps("Gaps:")
|
||||
, m_firstTime(true)
|
||||
, m_autopaintLines("Autopaint Lines", true) {
|
||||
, m_autopaintLines("Autopaint Lines", true)
|
||||
, m_fillOnlySavebox("Savebox", false) {
|
||||
m_rectFill = new AreaFillTool(this);
|
||||
m_normalLineFillTool = new NormalLineFillTool(this);
|
||||
|
||||
|
@ -1999,7 +2000,11 @@ FillTool::FillTool(int targetType)
|
|||
m_prop.bind(m_maxGapDistance);
|
||||
m_maxGapDistance.setId("MaxGapDistance");
|
||||
}
|
||||
if (targetType == TTool::ToonzImage) m_prop.bind(m_autopaintLines);
|
||||
if (targetType == TTool::ToonzImage) {
|
||||
m_prop.bind(m_fillOnlySavebox);
|
||||
m_prop.bind(m_autopaintLines);
|
||||
}
|
||||
|
||||
m_selective.setId("Selective");
|
||||
m_onion.setId("OnionSkin");
|
||||
m_frameRange.setId("FrameRange");
|
||||
|
@ -2007,6 +2012,7 @@ FillTool::FillTool(int targetType)
|
|||
m_fillType.setId("Type");
|
||||
m_colorType.setId("Mode");
|
||||
m_autopaintLines.setId("AutopaintLines");
|
||||
m_fillOnlySavebox.setId("FillOnlySavebox");
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -2055,6 +2061,7 @@ void FillTool::updateTranslation() {
|
|||
m_segment.setQStringName(tr("Segment"));
|
||||
m_maxGapDistance.setQStringName(tr("Maximum Gap"));
|
||||
m_autopaintLines.setQStringName(tr("Autopaint Lines"));
|
||||
m_fillOnlySavebox.setQStringName(tr("Savebox"));
|
||||
m_rasterGapDistance.setQStringName(tr("Distance:"));
|
||||
m_closeStyleIndex.setQStringName(tr("Style Index:"));
|
||||
m_closeRasterGaps.setQStringName(tr("Gaps:"));
|
||||
|
@ -2070,11 +2077,12 @@ FillParameters FillTool::getFillParameters() const {
|
|||
int styleId = TTool::getApplication()->getCurrentLevelStyleIndex();
|
||||
params.m_styleId = styleId;
|
||||
/*---紛らわしいことに、colorTypeをfillTypeに名前を変えて保存している。間違いではない。---*/
|
||||
params.m_fillType = m_colorType.getValue();
|
||||
params.m_emptyOnly = m_selective.getValue();
|
||||
params.m_segment = m_segment.getValue();
|
||||
params.m_minFillDepth = (int)m_fillDepth.getValue().first;
|
||||
params.m_maxFillDepth = (int)m_fillDepth.getValue().second;
|
||||
params.m_fillType = m_colorType.getValue();
|
||||
params.m_emptyOnly = m_selective.getValue();
|
||||
params.m_segment = m_segment.getValue();
|
||||
params.m_minFillDepth = (int)m_fillDepth.getValue().first;
|
||||
params.m_maxFillDepth = (int)m_fillDepth.getValue().second;
|
||||
params.m_fillOnlySavebox = m_fillOnlySavebox.getValue();
|
||||
return params;
|
||||
}
|
||||
|
||||
|
@ -2372,6 +2380,9 @@ bool FillTool::onPropertyChanged(std::string propertyName) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (propertyName == m_fillOnlySavebox.getName()) {
|
||||
FillOnlySavebox = (int)(m_fillOnlySavebox.getValue());
|
||||
}
|
||||
|
||||
/*--- fillType, frameRange, selective, colorTypeが変わったとき ---*/
|
||||
if (rectPropChangedflag && m_fillType.getValue() != NORMALFILL) {
|
||||
|
@ -2434,7 +2445,7 @@ void FillTool::onFrameSwitched() {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FillTool::draw() {
|
||||
if (Preferences::instance()->getFillOnlySavebox()) {
|
||||
if (m_fillOnlySavebox.getValue()) {
|
||||
TToonzImageP ti = (TToonzImageP)getImage(false);
|
||||
if (ti) {
|
||||
TRectD bbox =
|
||||
|
@ -2575,6 +2586,7 @@ void FillTool::onActivate() {
|
|||
m_onion.setValue(FillOnion ? 1 : 0);
|
||||
m_segment.setValue(FillSegment ? 1 : 0);
|
||||
m_frameRange.setValue(FillRange ? 1 : 0);
|
||||
m_fillOnlySavebox.setValue(FillOnlySavebox ? 1 : 0);
|
||||
m_firstTime = false;
|
||||
|
||||
if (m_fillType.getValue() != NORMALFILL) {
|
||||
|
|
|
@ -112,6 +112,7 @@ class FillTool final : public QObject, public TTool {
|
|||
// For the raster fill tool, autopaint lines is optional and can be temporary
|
||||
// disabled
|
||||
TBoolProperty m_autopaintLines;
|
||||
TBoolProperty m_fillOnlySavebox;
|
||||
|
||||
public:
|
||||
FillTool(int targetType);
|
||||
|
|
|
@ -73,6 +73,7 @@ TEnv::IntVar EraseRange("InknpaintEraseRange", 0);
|
|||
TEnv::StringVar EraseColorType("InknpaintEraseColorType", "Lines");
|
||||
TEnv::DoubleVar EraseHardness("EraseHardness", 100);
|
||||
TEnv::IntVar ErasePencil("InknpaintErasePencil", 0);
|
||||
TEnv::IntVar EraseOnlySavebox("InknpaintEraseOnlySavebox", 0);
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -354,7 +355,8 @@ void eraseStroke(const TToonzImageP &ti, TStroke *stroke,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void eraseSegment(const TImageP &img, const TPointD &pos, TXshSimpleLevel *sl,
|
||||
const TFrameId &fid, bool selective, int styleId) {
|
||||
const TFrameId &fid, bool selective, int styleId,
|
||||
bool eraseOnlySavebox) {
|
||||
TTool::Application *app = TTool::getApplication();
|
||||
if (!app) return;
|
||||
|
||||
|
@ -362,7 +364,7 @@ void eraseSegment(const TImageP &img, const TPointD &pos, TXshSimpleLevel *sl,
|
|||
TPoint offs(0, 0);
|
||||
TRasterCM32P ras = ti->getRaster();
|
||||
|
||||
if (Preferences::instance()->getFillOnlySavebox()) {
|
||||
if (eraseOnlySavebox) {
|
||||
TRectD bbox = ti->getBBox();
|
||||
TRect ibbox = convert(bbox);
|
||||
offs = ibbox.getP00();
|
||||
|
@ -405,8 +407,7 @@ void eraseSegment(const TImageP &img, const TPointD &pos, TXshSimpleLevel *sl,
|
|||
t->m_rasterBounds = t->m_rasterBounds + offs;
|
||||
}
|
||||
TUndoManager::manager()->add(new RasterSegmentEraseUndo(
|
||||
tileSet, newPoint, sl, fid,
|
||||
Preferences::instance()->getFillOnlySavebox()));
|
||||
tileSet, newPoint, sl, fid, eraseOnlySavebox));
|
||||
}
|
||||
|
||||
// instead of updateFrame :
|
||||
|
@ -652,6 +653,7 @@ private:
|
|||
TBoolProperty m_multi;
|
||||
TBoolProperty m_pencil;
|
||||
TEnumProperty m_colorType;
|
||||
TBoolProperty m_eraseOnlySavebox;
|
||||
|
||||
Type m_type;
|
||||
|
||||
|
@ -729,7 +731,8 @@ EraserTool::EraserTool(std::string name)
|
|||
, m_isXsheetCell(false)
|
||||
, m_firstTime(true)
|
||||
, m_workingFrameId(TFrameId())
|
||||
, m_isLeftButtonPressed(false) {
|
||||
, m_isLeftButtonPressed(false)
|
||||
, m_eraseOnlySavebox("Savebox", false) {
|
||||
bind(TTool::ToonzImage);
|
||||
|
||||
m_toolSize.setNonLinearSlider();
|
||||
|
@ -752,6 +755,7 @@ EraserTool::EraserTool(std::string name)
|
|||
m_prop.bind(m_invertOption);
|
||||
m_prop.bind(m_multi);
|
||||
m_prop.bind(m_pencil);
|
||||
m_prop.bind(m_eraseOnlySavebox);
|
||||
|
||||
m_currentStyle.setId("Selective");
|
||||
m_invertOption.setId("Invert");
|
||||
|
@ -759,6 +763,7 @@ EraserTool::EraserTool(std::string name)
|
|||
m_pencil.setId("PencilMode");
|
||||
m_colorType.setId("Mode");
|
||||
m_eraseType.setId("Type");
|
||||
m_eraseOnlySavebox.setId("EraseOnlySavebox");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -783,6 +788,7 @@ void EraserTool::updateTranslation() {
|
|||
m_invertOption.setQStringName(tr("Invert"));
|
||||
m_multi.setQStringName(tr("Frame Range"));
|
||||
m_pencil.setQStringName(tr("Pencil Mode"));
|
||||
m_eraseOnlySavebox.setQStringName(tr("Savebox"));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
@ -1562,7 +1568,7 @@ void EraserTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e) {
|
|||
if ((selective && pix.getInk() != styleId) || pix.isPurePaint())
|
||||
continue;
|
||||
eraseSegment(getImage(true), tmpPos, sl, getCurrentFid(), selective,
|
||||
styleId);
|
||||
styleId, m_eraseOnlySavebox.getValue());
|
||||
}
|
||||
|
||||
TPointD mousePos = pos;
|
||||
|
@ -1694,6 +1700,8 @@ bool EraserTool::onPropertyChanged(std::string propertyName) {
|
|||
EraseHardness = m_hardness.getValue();
|
||||
m_brushPad = ToolUtils::getBrushPad(m_toolSize.getValue(),
|
||||
m_hardness.getValue() * 0.01);
|
||||
} else if (propertyName == m_eraseOnlySavebox.getName()) {
|
||||
EraseOnlySavebox = (int)(m_eraseOnlySavebox.getValue());
|
||||
}
|
||||
|
||||
if (propertyName == m_hardness.getName() ||
|
||||
|
@ -1769,6 +1777,7 @@ void EraserTool::onEnter() {
|
|||
m_multi.setValue(EraseRange ? 1 : 0);
|
||||
m_hardness.setValue(EraseHardness);
|
||||
m_pencil.setValue(ErasePencil);
|
||||
m_eraseOnlySavebox.setValue(EraseOnlySavebox ? 1 : 0);
|
||||
m_firstTime = false;
|
||||
}
|
||||
double x = m_toolSize.getValue();
|
||||
|
@ -1887,7 +1896,8 @@ void EraserTool::doMultiSegmentEraser(const TImageP &img, double t,
|
|||
if (!ras->getBounds().contains(ipos)) continue;
|
||||
TPixelCM32 pix = ras->pixels(ipos.y)[ipos.x];
|
||||
if ((selective && pix.getInk() != styleId) || pix.isPurePaint()) continue;
|
||||
eraseSegment(img, tmpPos, sl.getPointer(), fid, selective, styleId);
|
||||
eraseSegment(img, tmpPos, sl.getPointer(), fid, selective, styleId,
|
||||
m_eraseOnlySavebox.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1908,7 +1918,8 @@ void EraserTool::doMultiSegmentEraser(const TImageP &img, double t,
|
|||
if (!ras->getBounds().contains(ipos)) continue;
|
||||
TPixelCM32 pix = ras->pixels(ipos.y)[ipos.x];
|
||||
if ((selective && pix.getInk() != styleId) || pix.isPurePaint()) continue;
|
||||
eraseSegment(img, tmpPos, sl.getPointer(), fid, selective, styleId);
|
||||
eraseSegment(img, tmpPos, sl.getPointer(), fid, selective, styleId,
|
||||
m_eraseOnlySavebox.getValue());
|
||||
}
|
||||
} else {
|
||||
assert(firstImage->getStrokeCount() == 1);
|
||||
|
@ -1931,7 +1942,8 @@ void EraserTool::doMultiSegmentEraser(const TImageP &img, double t,
|
|||
if (!ras->getBounds().contains(ipos)) continue;
|
||||
TPixelCM32 pix = ras->pixels(ipos.y)[ipos.x];
|
||||
if ((selective && pix.getInk() != styleId) || pix.isPurePaint()) continue;
|
||||
eraseSegment(img, tmpPos, sl.getPointer(), fid, selective, styleId);
|
||||
eraseSegment(img, tmpPos, sl.getPointer(), fid, selective, styleId,
|
||||
m_eraseOnlySavebox.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2032,6 +2032,8 @@ EraserToolOptionsBox::EraserToolOptionsBox(QWidget *parent, TTool *tool,
|
|||
dynamic_cast<ToolOptionCheckbox *>(m_controls.value("Frame Range"));
|
||||
m_pencilMode =
|
||||
dynamic_cast<ToolOptionCheckbox *>(m_controls.value("Pencil Mode"));
|
||||
m_eraseOnlySavebox =
|
||||
dynamic_cast<ToolOptionCheckbox *>(m_controls.value("Savebox"));
|
||||
|
||||
bool ret = true;
|
||||
if (m_pencilMode) {
|
||||
|
@ -2063,6 +2065,13 @@ EraserToolOptionsBox::EraserToolOptionsBox(QWidget *parent, TTool *tool,
|
|||
m_invertMode->setEnabled(false);
|
||||
}
|
||||
|
||||
if (m_eraseOnlySavebox) {
|
||||
if (m_toolType->getProperty()->getValue() == L"Segment")
|
||||
m_eraseOnlySavebox->setEnabled(true);
|
||||
else
|
||||
m_eraseOnlySavebox->setEnabled(false);
|
||||
}
|
||||
|
||||
if (m_colorMode && m_colorMode->getProperty()->getValue() == L"Areas") {
|
||||
assert(m_hardnessField && m_hardnessLabel && m_pencilMode);
|
||||
m_pencilMode->setEnabled(false);
|
||||
|
@ -2100,6 +2109,7 @@ void EraserToolOptionsBox::onToolTypeChanged(int index) {
|
|||
m_colorModeLabel->setDisabled(isSegment);
|
||||
}
|
||||
m_invertMode->setEnabled(!isSegment && value);
|
||||
if (m_eraseOnlySavebox) m_eraseOnlySavebox->setEnabled(isSegment);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -1076,7 +1076,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {
|
|||
|
||||
// Tools
|
||||
// {dropdownShortcutsCycleOptions, tr("Dropdown Shortcuts:")}, // removed
|
||||
{FillOnlysavebox, tr("Use the TLV Savebox to Limit Filling Operations")},
|
||||
// {FillOnlysavebox, tr("Use the TLV Savebox to Limit Filling Operations")}, // Moved to tools that need it
|
||||
{multiLayerStylePickerEnabled,
|
||||
tr("Multi Layer Style Picker: Switch Levels by Picking")},
|
||||
{cursorBrushType, tr("Basic Cursor Type:")},
|
||||
|
@ -1707,7 +1707,7 @@ QWidget* PreferencesPopup::createToolsPage() {
|
|||
|
||||
// insertUI(dropdownShortcutsCycleOptions, lay,
|
||||
// getComboItemList(dropdownShortcutsCycleOptions));
|
||||
insertUI(FillOnlysavebox, lay);
|
||||
// insertUI(FillOnlysavebox, lay);
|
||||
insertUI(multiLayerStylePickerEnabled, lay);
|
||||
QGridLayout* cursorOptionsLay = insertGroupBox(tr("Cursor Options"), lay);
|
||||
{
|
||||
|
@ -1725,8 +1725,8 @@ QWidget* PreferencesPopup::createToolsPage() {
|
|||
lay->setRowStretch(lay->rowCount(), 1);
|
||||
widget->setLayout(lay);
|
||||
|
||||
m_onEditedFuncMap.insert(FillOnlysavebox,
|
||||
&PreferencesPopup::notifySceneChanged);
|
||||
// m_onEditedFuncMap.insert(FillOnlysavebox,
|
||||
// &PreferencesPopup::notifySceneChanged);
|
||||
m_onEditedFuncMap.insert(levelBasedToolsDisplay,
|
||||
&PreferencesPopup::onLevelBasedToolsDisplayChanged);
|
||||
|
||||
|
|
Loading…
Reference in a new issue