Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_fill.c
| Show First 20 Lines • Show All 742 Lines • ▼ Show 20 Lines | if (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) { | ||||
| /* need to restore the original projection settings before packing up */ | /* need to restore the original projection settings before packing up */ | ||||
| view3d_region_operator_needs_opengl(tgpf->win, tgpf->ar); | view3d_region_operator_needs_opengl(tgpf->win, tgpf->ar); | ||||
| ED_view3d_autodist_init(tgpf->depsgraph, tgpf->ar, tgpf->v3d, 0); | ED_view3d_autodist_init(tgpf->depsgraph, tgpf->ar, tgpf->v3d, 0); | ||||
| /* since strokes are so fine, when using their depth we need a margin otherwise they might get missed */ | /* since strokes are so fine, when using their depth we need a margin otherwise they might get missed */ | ||||
| int depth_margin = 0; | int depth_margin = 0; | ||||
| /* get an array of depths, far depths are blended */ | /* get an array of depths, far depths are blended */ | ||||
| int mval[2], mval_prev[2] = { 0 }; | int mval_prev[2] = { 0 }; | ||||
| int interp_depth = 0; | int interp_depth = 0; | ||||
| int found_depth = 0; | int found_depth = 0; | ||||
| tgpf->depth_arr = MEM_mallocN(sizeof(float) * totpoints, "depth_points"); | tgpf->depth_arr = MEM_mallocN(sizeof(float) * totpoints, "depth_points"); | ||||
| for (i = 0, ptc = tgpf->sbuffer; i < totpoints; i++, ptc++) { | for (i = 0, ptc = tgpf->sbuffer; i < totpoints; i++, ptc++) { | ||||
| copy_v2_v2_int(mval, &ptc->x); | |||||
| int mval_i[2]; | |||||
| round_v2i_v2fl(mval_i, &ptc->x); | |||||
| if ((ED_view3d_autodist_depth( | if ((ED_view3d_autodist_depth( | ||||
| tgpf->ar, mval, depth_margin, tgpf->depth_arr + i) == 0) && | tgpf->ar, mval_i, depth_margin, tgpf->depth_arr + i) == 0) && | ||||
| (i && (ED_view3d_autodist_depth_seg( | (i && (ED_view3d_autodist_depth_seg( | ||||
| tgpf->ar, mval, mval_prev, depth_margin + 1, tgpf->depth_arr + i) == 0))) | tgpf->ar, mval_i, mval_prev, depth_margin + 1, tgpf->depth_arr + i) == 0))) | ||||
| { | { | ||||
| interp_depth = true; | interp_depth = true; | ||||
| } | } | ||||
| else { | else { | ||||
| found_depth = true; | found_depth = true; | ||||
| } | } | ||||
| copy_v2_v2_int(mval_prev, mval); | copy_v2_v2_int(mval_prev, mval_i); | ||||
| } | } | ||||
| if (found_depth == false) { | if (found_depth == false) { | ||||
| /* eeh... not much we can do.. :/, ignore depth in this case */ | /* eeh... not much we can do.. :/, ignore depth in this case */ | ||||
| for (i = totpoints - 1; i >= 0; i--) | for (i = totpoints - 1; i >= 0; i--) | ||||
| tgpf->depth_arr[i] = 0.9999f; | tgpf->depth_arr[i] = 0.9999f; | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 506 Lines • Show Last 20 Lines | |||||