diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-11-25 16:17:31 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-11-25 16:18:57 +0300 |
commit | bc4c20d414e90c8e25e12cfee860e86adb06e961 (patch) | |
tree | add30daf5016f85991ab8999e0c393c4eb463d83 /source/blender/editors/gpencil/annotate_paint.c | |
parent | 447378753d320ea04d7c1ce00723fc02f35966f0 (diff) |
Fix T93360: 'Iteractive Light Track' do not work over empty background
Bug introduced in {rBaa0ac0035a0d}.
The invalid depth fallback was changed to `FLT_MAX` in order to match the
annotation and gpencil operations.
This broke the `Interactive Light Track` operator which invalidates the
operation if the depth value is `1.0f`.
The chosen solution was to change the value tested in the annotation and
gpencil operations.
Diffstat (limited to 'source/blender/editors/gpencil/annotate_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index bf53241a947..47af2cff0ce 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -78,6 +78,8 @@ /* ******************************************* */ /* 'Globals' and Defines */ +#define DEPTH_INVALID 1.0f + /* values for tGPsdata->status */ typedef enum eGPencil_PaintStatus { GP_STATUS_IDLING = 0, /* stroke isn't in progress yet */ @@ -324,6 +326,9 @@ static void annotation_stroke_convertcoords(tGPsdata *p, float *depth) { bGPdata *gpd = p->gpd; + if (depth && (*depth == DEPTH_INVALID)) { + depth = NULL; + } /* in 3d-space - pt->x/y/z are 3 side-by-side floats */ if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) { @@ -1003,14 +1008,14 @@ static void annotation_stroke_newfrombuffer(tGPsdata *p) int last_valid = 0; for (i = 0; i < gpd->runtime.sbuffer_used; i++) { - if (depth_arr[i] != FLT_MAX) { + if (depth_arr[i] != DEPTH_INVALID) { break; } } first_valid = i; for (i = gpd->runtime.sbuffer_used - 1; i >= 0; i--) { - if (depth_arr[i] != FLT_MAX) { + if (depth_arr[i] != DEPTH_INVALID) { break; } } @@ -1018,14 +1023,14 @@ static void annotation_stroke_newfrombuffer(tGPsdata *p) /* invalidate non-endpoints, so only blend between first and last */ for (i = first_valid + 1; i < last_valid; i++) { - depth_arr[i] = FLT_MAX; + depth_arr[i] = DEPTH_INVALID; } interp_depth = true; } if (interp_depth) { - interp_sparse_array(depth_arr, gpd->runtime.sbuffer_used, FLT_MAX); + interp_sparse_array(depth_arr, gpd->runtime.sbuffer_used, DEPTH_INVALID); } } } |