Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix cursor offset of "Draw Cursor at Stroke End"

Abel You92f5e5e410bd
diff --git a/toonz/sources/include/tools/toolutils.h b/toonz/sources/include/tools/toolutils.h
index bee595516..27adacf9e 100644
--- a/toonz/sources/include/tools/toolutils.h
+++ b/toonz/sources/include/tools/toolutils.h
@@ -111,7 +111,7 @@ QRadialGradient getBrushPad(int size, double hardness);
void drawCursor(TToolViewer* viewer, TTool* tool,
- TPointD pos, int toolCursorId);
+ TPointD pos, int toolCursorId, bool addOffSet = false);
//! Divide il primo rettangolo in piu' sottorettsngoli, in base all'intersezione
//! con il secondo
diff --git a/toonz/sources/tnztools/toolutils.cpp b/toonz/sources/tnztools/toolutils.cpp
index 80a7e3024..cadbb4f70 100644
--- a/toonz/sources/tnztools/toolutils.cpp
+++ b/toonz/sources/tnztools/toolutils.cpp
@@ -354,10 +354,13 @@ QRadialGradient ToolUtils::getBrushPad(int size, double hardness) {
//-----------------------------------------------------------------------------
void ToolUtils::drawCursor(TToolViewer* viewer, TTool* tool,
- TPointD pos, int toolCursorId)
+ TPointD pos, int toolCursorId, bool addOffSet)
{
if (!viewer || !tool) return;
-
+ if(addOffSet){
+ pos.x += 0.5;
+ pos.y += 0.5;
+ }
QCursor cursor = getToolCursor(toolCursorId);
QPixmap cursorPixmap = cursor.pixmap();
if (cursorPixmap.isNull()) return;
diff --git a/toonz/sources/tnztools/toonzrasterbrushtool.cpp b/toonz/sources/tnztools/toonzrasterbrushtool.cpp
index d26c1f5c7..edccb5e6e 100644
--- a/toonz/sources/tnztools/toonzrasterbrushtool.cpp
+++ b/toonz/sources/tnztools/toonzrasterbrushtool.cpp
@@ -1349,8 +1349,8 @@ void ToonzRasterBrushTool::inputPaintTrackPoint(const TTrackPoint &point,
// Pencilモードでなく、Hardness=100 の場合のブラシサイズを1段階下げる
double thickness = computeThickness(pressure, m_rasThickness);
- //if (!m_painting.pencil.realPencil && !m_modifierLine->getManager())
- // thickness -= 1.0;
+ // if (!m_painting.pencil.realPencil && !m_modifierLine->getManager())
+ // thickness -= 1.0;
TThickPoint thickPoint(fixedPosition + rasCenter, thickness);
// init brush
@@ -1410,10 +1410,10 @@ void ToonzRasterBrushTool::inputPaintTrackPoint(const TTrackPoint &point,
// paint stroke
double thickness = computeThickness(pressure, m_rasThickness);
TThickPoint thickPoint(fixedPosition + rasCenter, thickness);
- TRect strokeRect( tfloor(thickPoint.x - maxThick - 0.999),
- tfloor(thickPoint.y - maxThick - 0.999),
- tceil(thickPoint.x + maxThick + 0.999),
- tceil(thickPoint.y + maxThick + 0.999) );
+ TRect strokeRect(tfloor(thickPoint.x - maxThick - 0.999),
+ tfloor(thickPoint.y - maxThick - 0.999),
+ tceil(thickPoint.x + maxThick + 0.999),
+ tceil(thickPoint.y + maxThick + 0.999));
strokeRect *= ras->getBounds();
m_painting.affectedRect += strokeRect;
updateWorkAndBackupRasters(m_painting.affectedRect);
@@ -1523,11 +1523,11 @@ void ToonzRasterBrushTool::draw() {
if (getApplication()->getCurrentObject()->isSpline()) return;
if (Preferences::instance()->isUseStrokeEndCursor())
- ToolUtils::drawCursor(m_viewer, this, m_brushPos, ToolCursor::PenCursor);
+ ToolUtils::drawCursor(m_viewer, this, m_brushPos, ToolCursor::PenCursor,
+ true);
// If toggled off, don't draw brush outline
- if (!Preferences::instance()->isCursorOutlineEnabled())
- return;
+ if (!Preferences::instance()->isCursorOutlineEnabled()) return;
// Draw the brush outline - change color when the Ink / Paint check is
// activated