Fix T100502: GPencil Primitive apply offset when using `Stroke` mode

The offset was applied in stroke mode and this was wrong.
This commit is contained in:
Antonio Vazquez 2022-08-19 17:52:12 +02:00
parent 8f9b812d79
commit be5c296e52
Notes: blender-bot 2023-02-14 08:08:56 +01:00
Referenced by issue #100502, GPencil: Primitive drawing tools apply offset incorrectly when using `Stroke` mode
1 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,7 @@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BLT_translation.h"
#include "PIL_time.h"
@ -1024,8 +1025,10 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
gpd->runtime.sbuffer, &gpd->runtime.sbuffer_size, &gpd->runtime.sbuffer_used, false);
/* add small offset to keep stroke over the surface */
if ((depth_arr) && (gpd->zdepth_offset > 0.0f) && (depth_arr[i] != DEPTH_INVALID)) {
depth_arr[i] *= (1.0f - (gpd->zdepth_offset / 1000.0f));
if (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) {
if ((depth_arr) && (gpd->zdepth_offset > 0.0f) && (depth_arr[i] != DEPTH_INVALID)) {
depth_arr[i] *= (1.0f - (gpd->zdepth_offset / 1000.0f));
}
}
/* convert screen-coordinates to 3D coordinates */