diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cpp index 1585aa8..6b5a5b2 100644 --- a/toonz/sources/tnztools/brushtool.cpp +++ b/toonz/sources/tnztools/brushtool.cpp @@ -1616,28 +1616,40 @@ void BrushTool::mouseMove(const TPointD &pos, const TMouseEvent &e) { setValue(prop, value); } - } locals = {this}; + void addMinMaxSeparate(TDoublePairProperty &prop, double min, double max) { + if (min == 0.0 && max == 0.0) return; + const TDoublePairProperty::Range &range = prop.getRange(); - switch (e.getModifiersMask()) { - /*-- - * Altキー+マウス移動で、ブラシサイズ(Min/Maxとも)を変える(CtrlやShiftでは誤操作の恐れがある) - * --*/ - case TMouseEvent::ALT_KEY: { - // User wants to alter the minimum brush size - const TPointD &diff = pos - m_mousePos; - double add = (fabs(diff.x) > fabs(diff.y)) ? diff.x : diff.y; + TDoublePairProperty::Value value = prop.getValue(); + value.first += min; + value.second += max; + if (value.first > value.second) value.first = value.second; + value.first = tcrop(value.first, range.first, range.second); + value.second = tcrop(value.second, range.first, range.second); - locals.addMinMax( - TToonzImageP(getImage(false, 1)) ? m_rasThickness : m_thickness, add); + setValue(prop, value); + } - break; - } + } locals = {this}; - default: + // if (e.isAltPressed() && !e.isCtrlPressed()) { + // const TPointD &diff = pos - m_mousePos; + // double add = (fabs(diff.x) > fabs(diff.y)) ? diff.x : diff.y; + + // locals.addMinMax( + // TToonzImageP(getImage(false, 1)) ? m_rasThickness : m_thickness, add); + //} else + if (e.isCtrlPressed() && e.isAltPressed()) { + const TPointD &diff = pos - m_mousePos; + double max = diff.x / 2; + double min = diff.y / 2; + + locals.addMinMaxSeparate( + (m_targetType & TTool::ToonzImage) ? m_rasThickness : m_thickness, min, + max); + } else { m_brushPos = pos; - break; } - m_mousePos = pos; invalidate(); diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cpp index 5b7d27e..bfb3494 100644 --- a/toonz/sources/tnztools/fullcolorbrushtool.cpp +++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp @@ -130,9 +130,9 @@ public: FullColorBrushTool::FullColorBrushTool(std::string name) : TTool(name) - , m_thickness("Thickness", 1, 100, 1, 5, false) - , m_pressure("Pressure Sensitivity", true) - , m_opacity("Opacity:", 0, 100, 100, 100, true) + , m_thickness("Size", 1, 100, 1, 5, false) + , m_pressure("Pressure", true) + , m_opacity("Opacity", 0, 100, 100, 100, true) , m_hardness("Hardness:", 0, 100, 100) , m_preset("Preset:") , m_styleId(0) @@ -172,9 +172,9 @@ void FullColorBrushTool::onCanvasSizeChanged() { //--------------------------------------------------------------------------------------------------- void FullColorBrushTool::updateTranslation() { - m_thickness.setQStringName(tr("Thickness")); - m_pressure.setQStringName(tr("Pressure Sensitivity")); - m_opacity.setQStringName(tr("Opacity:")); + m_thickness.setQStringName(tr("Size")); + m_pressure.setQStringName(tr("Pressure")); + m_opacity.setQStringName(tr("Opacity")); m_hardness.setQStringName(tr("Hardness:")); m_preset.setQStringName(tr("Preset:")); } @@ -452,25 +452,36 @@ void FullColorBrushTool::mouseMove(const TPointD &pos, const TMouseEvent &e) { setValue(prop, value); } - } locals = {this}; + void addMinMaxSeparate(TIntPairProperty &prop, double min, double max) { + if (min == 0.0 && max == 0.0) return; + const TIntPairProperty::Range &range = prop.getRange(); - switch (e.getModifiersMask()) { - /*-- - * Altキー+マウス移動で、ブラシサイズ(Min/Maxとも)を変える(CtrlやShiftでは誤操作の恐れがある) - * --*/ - case TMouseEvent::ALT_KEY: { - // User wants to alter the minimum brush size - const TPointD &diff = pos - m_mousePos; - double add = (fabs(diff.x) > fabs(diff.y)) ? diff.x : diff.y; + TIntPairProperty::Value value = prop.getValue(); + value.first += min; + value.second += max; + if (value.first > value.second) value.first = value.second; + value.first = tcrop(value.first, range.first, range.second); + value.second = tcrop(value.second, range.first, range.second); + + setValue(prop, value); + } - locals.addMinMax(m_thickness, int(add)); + } locals = {this}; - break; - } + // if (e.isAltPressed() && !e.isCtrlPressed()) { + // const TPointD &diff = pos - m_mousePos; + // double add = (fabs(diff.x) > fabs(diff.y)) ? diff.x : diff.y; - default: + // locals.addMinMax(m_thickness, int(add)); + //} else + if (e.isCtrlPressed() && e.isAltPressed()) { + const TPointD &diff = pos - m_mousePos; + double max = diff.x / 2; + double min = diff.y / 2; + + locals.addMinMaxSeparate(m_thickness, int(min), int(max)); + } else { m_brushPos = pos; - break; } m_mousePos = pos; @@ -552,7 +563,8 @@ void FullColorBrushTool::setWorkAndBackupImages() { bool FullColorBrushTool::onPropertyChanged(std::string propertyName) { m_minThick = m_thickness.getValue().first; m_maxThick = m_thickness.getValue().second; - if (propertyName == "Hardness:" || propertyName == "Thickness") { + if (propertyName == "Hardness:" || propertyName == "Thickness" || + propertyName == "Size") { m_brushPad = ToolUtils::getBrushPad(m_thickness.getValue().second, m_hardness.getValue() * 0.01); TRectD rect(m_brushPos - TPointD(m_maxThick + 2, m_maxThick + 2), diff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cpp index 399b876..5bb6d7a 100644 --- a/toonz/sources/tnztools/tooloptions.cpp +++ b/toonz/sources/tnztools/tooloptions.cpp @@ -214,7 +214,6 @@ void ToolOptionControlBuilder::visit(TDoublePairProperty *p) { m_tool, p, QObject::tr("Min:"), QObject::tr("Max:"), m_toolHandle); hLayout()->addWidget(control, 150); m_panel->addControl(control); - if (p->getName() == "Size:" || p->getName() == "Size") { CommandManager *cm = CommandManager::instance(); QAction *a; @@ -244,8 +243,8 @@ void ToolOptionControlBuilder::visit(TIntPairProperty *p) { m_tool, p, QObject::tr("Min:"), QObject::tr("Max:"), m_toolHandle); hLayout()->addWidget(control, 100); m_panel->addControl(control); - - if (p->getName() == "Size:") { + if (p->getName() == "Size:" || p->getName() == "Thickness" || + p->getName() == "Size") { CommandManager *cm = CommandManager::instance(); QAction *a; a = cm->getAction("A_IncreaseMaxBrushThickness"); @@ -278,7 +277,6 @@ void ToolOptionControlBuilder::visit(TIntProperty *p) { control->enableSlider(false); control->setFixedWidth(45); } - hLayout()->addWidget(control, 100); m_panel->addControl(control); if (p->getName() == "Size:") {