Fix failure to draw onto a surface with GPv3

GP_PROJECT_DEPTH_VIEW never used a surface depth and would
always use object-origin instead.
This commit is contained in:
Campbell Barton 2024-05-02 22:34:43 +10:00
parent 17f2cdd104
commit f15646df59

@ -75,13 +75,13 @@ DrawingPlacement::DrawingPlacement(const Scene &scene,
surface_offset_ = 0.0f;
placement_loc_ = float3(scene.cursor.location);
}
if (align_flag & GP_PROJECT_DEPTH_VIEW) {
else if (align_flag & GP_PROJECT_DEPTH_VIEW) {
depth_ = DrawingPlacementDepth::Surface;
surface_offset_ = scene.toolsettings->gpencil_surface_offset;
/* Default to view placement with the object origin if we don't hit a surface. */
placement_loc_ = layer_space_to_world_space_.location();
}
if (align_flag & GP_PROJECT_DEPTH_STROKE) {
else if (align_flag & GP_PROJECT_DEPTH_STROKE) {
depth_ = DrawingPlacementDepth::NearestStroke;
surface_offset_ = 0.0f;
/* Default to view placement with the object origin if we don't hit a stroke. */