Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_primitive.c
| Show First 20 Lines • Show All 707 Lines • ▼ Show 20 Lines | static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) | ||||
| Brush *brush = tgpi->brush; | Brush *brush = tgpi->brush; | ||||
| BrushGpencilSettings *brush_settings = brush->gpencil_settings; | BrushGpencilSettings *brush_settings = brush->gpencil_settings; | ||||
| GpRandomSettings random_settings = tgpi->random_settings; | GpRandomSettings random_settings = tgpi->random_settings; | ||||
| bGPDstroke *gps = tgpi->gpf->strokes.first; | bGPDstroke *gps = tgpi->gpf->strokes.first; | ||||
| GP_Sculpt_Settings *gset = &ts->gp_sculpt; | GP_Sculpt_Settings *gset = &ts->gp_sculpt; | ||||
| int depth_margin = (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 4 : 0; | int depth_margin = (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 4 : 0; | ||||
| const char align_flag = ts->gpencil_v3d_align; | const char align_flag = ts->gpencil_v3d_align; | ||||
| bool is_depth = (bool)(align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)); | 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); | ||||
| (tgpi->rv3d->persp == RV3D_CAMOB) && (!is_depth); | const bool is_camera = is_lock_axis_view && (tgpi->rv3d->persp == RV3D_CAMOB) && (!is_depth); | ||||
| if (tgpi->type == GP_STROKE_BOX) { | if (tgpi->type == GP_STROKE_BOX) { | ||||
| tgpi->tot_edges--; | tgpi->tot_edges--; | ||||
| gps->totpoints = (tgpi->tot_edges * 4 + tgpi->tot_stored_edges); | gps->totpoints = (tgpi->tot_edges * 4 + tgpi->tot_stored_edges); | ||||
| } | } | ||||
| else { | else { | ||||
| gps->totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges); | gps->totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 347 Lines • ▼ Show 20 Lines | static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) | ||||
| /* if parented change position relative to parent object */ | /* if parented change position relative to parent object */ | ||||
| for (int i = 0; i < gps->totpoints; i++) { | for (int i = 0; i < gps->totpoints; i++) { | ||||
| bGPDspoint *pt = &gps->points[i]; | bGPDspoint *pt = &gps->points[i]; | ||||
| gpencil_apply_parent_point(tgpi->depsgraph, tgpi->ob, tgpi->gpl, pt); | gpencil_apply_parent_point(tgpi->depsgraph, tgpi->ob, tgpi->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(C, tgpi->gpl, gps); | ED_gpencil_project_stroke_to_view(C, tgpi->gpl, gps); | ||||
| } | } | ||||
| /* Calc geometry data. */ | /* Calc geometry data. */ | ||||
| BKE_gpencil_stroke_geometry_update(gpd, gps); | BKE_gpencil_stroke_geometry_update(gpd, gps); | ||||
| /* Update evaluated data. */ | /* Update evaluated data. */ | ||||
| ED_gpencil_sbuffer_update_eval(tgpi->gpd, tgpi->ob_eval); | ED_gpencil_sbuffer_update_eval(tgpi->gpd, tgpi->ob_eval); | ||||
| ▲ Show 20 Lines • Show All 1,023 Lines • Show Last 20 Lines | |||||