Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/annotate_paint.c
| Show First 20 Lines • Show All 654 Lines • ▼ Show 20 Lines | if (annotation_stroke_added_check(p)) { | ||||
| * depth is needed only when creating new stroke from buffer, | * depth is needed only when creating new stroke from buffer, | ||||
| * but poly lines are converting to stroke instantly, | * but poly lines are converting to stroke instantly, | ||||
| * so initialize depth buffer before converting coordinates | * so initialize depth buffer before converting coordinates | ||||
| */ | */ | ||||
| if (annotation_project_check(p)) { | if (annotation_project_check(p)) { | ||||
| View3D *v3d = p->area->spacedata.first; | View3D *v3d = p->area->spacedata.first; | ||||
| view3d_region_operator_needs_opengl(p->win, p->region); | view3d_region_operator_needs_opengl(p->win, p->region); | ||||
| ED_view3d_autodist_init(p->depsgraph, | ED_view3d_depth_override(p->depsgraph, | ||||
| p->region, | p->region, | ||||
| v3d, | v3d, | ||||
| (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); | NULL, | ||||
| (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? | |||||
| V3D_DEPTH_GPENCIL_ONLY : | |||||
| V3D_DEPTH_NO_GPENCIL, | |||||
| false); | |||||
| } | } | ||||
| /* convert screen-coordinates to appropriate coordinates (and store them) */ | /* convert screen-coordinates to appropriate coordinates (and store them) */ | ||||
| annotation_stroke_convertcoords(p, &pt->x, &pts->x, NULL); | annotation_stroke_convertcoords(p, &pt->x, &pts->x, NULL); | ||||
| /* copy pressure and time */ | /* copy pressure and time */ | ||||
| pts->pressure = pt->pressure; | pts->pressure = pt->pressure; | ||||
| pts->strength = pt->strength; | pts->strength = pt->strength; | ||||
| ▲ Show 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | static void annotation_stroke_doeraser(tGPsdata *p) | ||||
| rect.ymin = p->mval[1] - p->radius; | rect.ymin = p->mval[1] - p->radius; | ||||
| rect.xmax = p->mval[0] + p->radius; | rect.xmax = p->mval[0] + p->radius; | ||||
| rect.ymax = p->mval[1] + p->radius; | rect.ymax = p->mval[1] + p->radius; | ||||
| if (p->area->spacetype == SPACE_VIEW3D) { | if (p->area->spacetype == SPACE_VIEW3D) { | ||||
| if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) { | if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) { | ||||
| View3D *v3d = p->area->spacedata.first; | View3D *v3d = p->area->spacedata.first; | ||||
| view3d_region_operator_needs_opengl(p->win, p->region); | view3d_region_operator_needs_opengl(p->win, p->region); | ||||
| ED_view3d_autodist_init(p->depsgraph, p->region, v3d, 0); | ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); | ||||
| } | } | ||||
| } | } | ||||
| /* loop over strokes of active layer only (session init already took care of ensuring validity), | /* loop over strokes of active layer only (session init already took care of ensuring validity), | ||||
| * checking segments for intersections to remove | * checking segments for intersections to remove | ||||
| */ | */ | ||||
| for (gps = gpf->strokes.first; gps; gps = gpn) { | for (gps = gpf->strokes.first; gps; gps = gpn) { | ||||
| gpn = gps->next; | gpn = gps->next; | ||||
| ▲ Show 20 Lines • Show All 456 Lines • ▼ Show 20 Lines | static void annotation_paint_strokeend(tGPsdata *p) | ||||
| /* for surface sketching, need to set the right OpenGL context stuff so that | /* for surface sketching, need to set the right OpenGL context stuff so that | ||||
| * the conversions will project the values correctly... | * the conversions will project the values correctly... | ||||
| */ | */ | ||||
| if (annotation_project_check(p)) { | if (annotation_project_check(p)) { | ||||
| View3D *v3d = p->area->spacedata.first; | View3D *v3d = p->area->spacedata.first; | ||||
| /* 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(p->win, p->region); | view3d_region_operator_needs_opengl(p->win, p->region); | ||||
| ED_view3d_autodist_init( | ED_view3d_depth_override(p->depsgraph, | ||||
| p->depsgraph, p->region, v3d, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0); | p->region, | ||||
| v3d, | |||||
| NULL, | |||||
| (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? | |||||
| V3D_DEPTH_GPENCIL_ONLY : | |||||
| V3D_DEPTH_NO_GPENCIL, | |||||
| false); | |||||
| } | } | ||||
| /* check if doing eraser or not */ | /* check if doing eraser or not */ | ||||
| if ((p->gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) { | if ((p->gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) { | ||||
| /* transfer stroke to frame */ | /* transfer stroke to frame */ | ||||
| annotation_stroke_newfrombuffer(p); | annotation_stroke_newfrombuffer(p); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,196 Lines • Show Last 20 Lines | |||||