Skip to content

Commit

Permalink
Pass tilt and rotation to MyPaint brush properly
Browse files Browse the repository at this point in the history
It doesn't take it in degrees, but as a fractional value.
  • Loading branch information
askmeaboutlo0m committed Nov 29, 2024
1 parent c6f0023 commit e0a0077
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Unreleased Version 2.2.2-pre
* Feature: Show icons on dock tabs by default, rather than text that gets squashed. In desktop mode, this can be toggled via View > Docks > Show Icons on Tabs.
* Feature: Replace "hold shift to arrange" with View > Docks > Arrange Docks, which doesn't require a keyboard. Thanks 3rd_EFNO for suggesting.
* Feature: Allow configuring temporary tool switch hold time. Thanks 3rd_EFNO and pachuco for suggesting.
* Fix: Properly pass tilt and barrel rotation values to MyPaint brushes. Thanks MorrowShore for reporting.

2024-11-06 Version 2.2.2-beta.4
* Fix: Solve rendering glitches with selection outlines that happen on some systems. Thanks xxxx for reporting.
Expand Down
11 changes: 7 additions & 4 deletions src/drawdance/libengine/dpengine/brush_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,9 @@ static void stroke_to_mypaint(DP_BrushEngine *be, DP_BrushPoint bp)
MyPaintBrush *mb = be->mypaint_brush;
MyPaintSurface2 *surface = &be->mypaint_surface2;
float zoom = be->stroke.zoom;
float xtilt = bp.xtilt / 60.0f;
float ytilt = bp.ytilt / 60.0f;
float rotation = bp.rotation / 360.0f;

double delta_sec;
if (be->stroke.in_progress) {
Expand All @@ -1380,13 +1383,13 @@ static void stroke_to_mypaint(DP_BrushEngine *be, DP_BrushPoint bp)
// you crank up the smoothing really high there and move the pen
// really fast, you can get strokes from when your pen wasn't on the
// tablet, which is just weird.
mypaint_brush_stroke_to_2(mb, surface, bp.x, bp.y, 0.0f, bp.xtilt,
bp.ytilt, 1000.0f, zoom, 0.0f, bp.rotation);
mypaint_brush_stroke_to_2(mb, surface, bp.x, bp.y, 0.0f, xtilt, ytilt,
1000.0f, zoom, 0.0f, rotation);
delta_sec = 0.0;
}

mypaint_brush_stroke_to_2(mb, surface, bp.x, bp.y, bp.pressure, bp.xtilt,
bp.ytilt, delta_sec, zoom, 0.0f, bp.rotation);
mypaint_brush_stroke_to_2(mb, surface, bp.x, bp.y, bp.pressure, xtilt,
ytilt, delta_sec, zoom, 0.0f, rotation);
}

static DP_LayerContent *search_layer(DP_CanvasState *cs, int layer_id)
Expand Down

0 comments on commit e0a0077

Please sign in to comment.