Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_fill.c
| Show First 20 Lines • Show All 1,149 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* create a grease pencil stroke using points in buffer */ | /* create a grease pencil stroke using points in buffer */ | ||||
| static void gpencil_stroke_from_buffer(tGPDfill *tgpf) | static void gpencil_stroke_from_buffer(tGPDfill *tgpf) | ||||
| { | { | ||||
| ToolSettings *ts = tgpf->scene->toolsettings; | ToolSettings *ts = tgpf->scene->toolsettings; | ||||
| const char align_flag = ts->gpencil_v3d_align; | const char align_flag = ts->gpencil_v3d_align; | ||||
| const bool is_depth = (bool)(align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)); | const bool is_depth = (bool)(align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)); | ||||
| const bool is_camera = (bool)(ts->gp_sculpt.lock_axis == 0) && | const bool is_lock_axis_view = (bool)(ts->gp_sculpt.lock_axis == 0); | ||||
| (tgpf->rv3d->persp == RV3D_CAMOB) && (!is_depth); | const bool is_camera = is_lock_axis_view && (tgpf->rv3d->persp == RV3D_CAMOB) && (!is_depth); | ||||
antoniov: Are you sure you need change `is_camera`? Test in different modes in camera view to be sure we… | |||||
| Brush *brush = BKE_paint_brush(&ts->gp_paint->paint); | Brush *brush = BKE_paint_brush(&ts->gp_paint->paint); | ||||
| if (brush == NULL) { | if (brush == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| bGPDspoint *pt; | bGPDspoint *pt; | ||||
| MDeformVert *dvert = NULL; | MDeformVert *dvert = NULL; | ||||
| tGPspoint *point2D; | tGPspoint *point2D; | ||||
| ▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | static void gpencil_stroke_from_buffer(tGPDfill *tgpf) | ||||
| /* if parented change position relative to parent object */ | /* if parented change position relative to parent object */ | ||||
| for (int a = 0; a < tgpf->sbuffer_used; a++) { | for (int a = 0; a < tgpf->sbuffer_used; a++) { | ||||
| pt = &gps->points[a]; | pt = &gps->points[a]; | ||||
| gpencil_apply_parent_point(tgpf->depsgraph, tgpf->ob, tgpf->gpl, pt); | gpencil_apply_parent_point(tgpf->depsgraph, tgpf->ob, tgpf->gpl, pt); | ||||
| } | } | ||||
| /* If camera view or view projection, reproject flat to view to avoid perspective effect. */ | /* If camera view or view projection, reproject flat to view to avoid perspective effect. */ | ||||
| if ((align_flag & GP_PROJECT_VIEWSPACE) || is_camera) { | if (((align_flag & GP_PROJECT_VIEWSPACE) && is_lock_axis_view) || is_camera) { | ||||
| ED_gpencil_project_stroke_to_view(tgpf->C, tgpf->gpl, gps); | ED_gpencil_project_stroke_to_view(tgpf->C, tgpf->gpl, gps); | ||||
| } | } | ||||
| /* simplify stroke */ | /* simplify stroke */ | ||||
| for (int b = 0; b < tgpf->fill_simplylvl; b++) { | for (int b = 0; b < tgpf->fill_simplylvl; b++) { | ||||
| BKE_gpencil_stroke_simplify_fixed(tgpf->gpd, gps); | BKE_gpencil_stroke_simplify_fixed(tgpf->gpd, gps); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 407 Lines • Show Last 20 Lines | |||||
Are you sure you need change is_camera? Test in different modes in camera view to be sure we don't break anything.