Skip to content
Snippets Groups Projects
Commit 9e82331a authored by Falk David's avatar Falk David Committed by Thomas Dinges
Browse files

Fix #130368: GPv3: Canvas overlay incorrect offset

The issue was that if the evaluated object doesn't have an active
layer, the canvas is offset by twice the objects position.

The reason was that the code scaled the whole transformation
matrix by two to match the code in 4.2, but then had to overwrite
the location of the transformation again to counteract the scaling.

The fix is to not counteract the scaling and just scale the 3x3 part
of the matrix instead. This way we can remove the part afterwards
that writes to the location of the transform.

Pull Request: https://projects.blender.org/blender/blender/pulls/130454
parent e23b710b
Branches
No related tags found
No related merge requests found
...@@ -244,16 +244,13 @@ void OVERLAY_grease_pencil_cache_init(OVERLAY_Data *vedata) ...@@ -244,16 +244,13 @@ void OVERLAY_grease_pencil_cache_init(OVERLAY_Data *vedata)
break; break;
} }
/* Note: This is here to match the legacy size. */
mat *= 2.0f;
if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) {
mat.location() = cursor->location; mat.location() = cursor->location;
} }
else if (grease_pencil.has_active_layer()) {
const bke::greasepencil::Layer &layer = *grease_pencil.get_active_layer(); /* Note: This is here to match the legacy size. */
mat.location() = layer.to_world_space(*ob).location(); mat.view<3, 3>() *= 2.0f;
}
/* Local transform of the grid from the overlay settings. */ /* Local transform of the grid from the overlay settings. */
const float3 offset = float3( const float3 offset = float3(
v3d->overlay.gpencil_grid_offset[0], v3d->overlay.gpencil_grid_offset[1], 0.0f); v3d->overlay.gpencil_grid_offset[0], v3d->overlay.gpencil_grid_offset[1], 0.0f);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment