From e1c3a0010307ccc83ee77b29c9fa8fef79aa6824 Mon Sep 17 00:00:00 2001 From: Falk David Date: Mon, 23 Oct 2023 19:39:47 +0200 Subject: [PATCH] GPv3: Draw strokes relative to the object origin The drawing plane was at the world origin not the object origin. This still needs to use the correct drawing plane in the future, but it's a good step in the right direction. --- source/blender/editors/sculpt_paint/grease_pencil_paint.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/sculpt_paint/grease_pencil_paint.cc b/source/blender/editors/sculpt_paint/grease_pencil_paint.cc index 2e43dc95b1e..e5d2d1a71a6 100644 --- a/source/blender/editors/sculpt_paint/grease_pencil_paint.cc +++ b/source/blender/editors/sculpt_paint/grease_pencil_paint.cc @@ -175,10 +175,11 @@ struct PaintOperationExecutor { float3 screen_space_to_drawing_plane(const float2 co) { /* TODO: Use correct plane/projection. */ - const float4 plane{0.0f, -1.0f, 0.0f, 0.0f}; + float4 plane; + plane_from_point_normal_v3( + plane, transforms_.layer_space_to_world_space.location(), float3{0, -1, 0}); float3 proj_point; - ED_view3d_win_to_3d_on_plane( - region_, transforms_.layer_space_to_world_space * plane, co, false, proj_point); + ED_view3d_win_to_3d_on_plane(region_, plane, co, false, proj_point); return math::transform_point(transforms_.world_space_to_layer_space, proj_point); }