Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/draw/engines/gpencil/gpencil_draw_utils.c')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 2e9a212170c..f925f9fb506 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -357,7 +357,7 @@ bool DRW_gpencil_onion_active(bGPdata *gpd)
/* create shading group for strokes */
DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
- bGPdata *gpd, MaterialGPencilStyle *gp_style, int id, bool onion)
+ bGPdata *gpd, bGPDstroke *gps, MaterialGPencilStyle *gp_style, int id, bool onion)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const float *viewport_size = DRW_viewport_size_get();
@@ -391,6 +391,10 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
}
DRW_shgroup_uniform_int(grp, "color_type", &stl->shgroups[id].color_type, 1);
DRW_shgroup_uniform_float(grp, "pixfactor", &gpd->pixfactor, 1);
+
+ stl->shgroups[id].caps_mode[0] = gps->caps[0];
+ stl->shgroups[id].caps_mode[1] = gps->caps[1];
+ DRW_shgroup_uniform_int(grp, "caps_mode", &stl->shgroups[id].caps_mode[0], 2);
}
else {
stl->storage->obj_scale = 1.0f;
@@ -405,6 +409,8 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
else {
DRW_shgroup_uniform_float(grp, "pixfactor", &stl->storage->pixfactor, 1);
}
+ const int zero[2] = { 0, 0 };
+ DRW_shgroup_uniform_int(grp, "caps_mode", &zero[0], 2);
}
if ((gpd) && (id > -1)) {
@@ -1177,7 +1183,8 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
if (gpd->runtime.sbuffer_size > 1) {
if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_stroke_create(
- e_data, vedata, psl->drawing_pass, e_data->gpencil_stroke_sh, NULL, gpd, gp_style, -1, false);
+ e_data, vedata, psl->drawing_pass, e_data->gpencil_stroke_sh, NULL,
+ gpd, NULL, gp_style, -1, false);
}
else {
stl->g_data->shgrps_drawing_stroke = DRW_gpencil_shgroup_point_create(
@@ -1240,13 +1247,14 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
}
}
- /* control points */
- if ((overlay) && (gpd->runtime.tot_cp_points > 0) &&
- ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) &&
- ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) &&
- ((v3d->gizmo_flag & V3D_GIZMO_HIDE_TOOL) == 0))
- {
+ /* control points for primitives and speed guide */
+ const bool is_cppoint = (gpd->runtime.tot_cp_points > 0);
+ const bool is_speed_guide = (ts->gp_sculpt.guide.use_guide && (draw_ctx->object_mode == OB_MODE_PAINT_GPENCIL));
+ const bool is_show_gizmo = (((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) && ((v3d->gizmo_flag & V3D_GIZMO_HIDE_TOOL) == 0));
+ if ((overlay) && (is_cppoint || is_speed_guide) && (is_show_gizmo) &&
+ ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0))
+ {
DRWShadingGroup *shgrp = DRW_shgroup_create(
e_data->gpencil_edit_point_sh, psl->drawing_pass);
const float *viewport_size = DRW_viewport_size_get();
@@ -1357,7 +1365,7 @@ static void DRW_gpencil_shgroups_create(
shgrp = DRW_gpencil_shgroup_stroke_create(
e_data, vedata, psl->stroke_pass, e_data->gpencil_stroke_sh,
- ob, gpd, gp_style, stl->storage->shgroup_id, elm->onion);
+ ob, gpd, gps, gp_style, stl->storage->shgroup_id, elm->onion);
DRW_shgroup_call_range_add(
shgrp, cache->b_stroke.batch,
@@ -1472,7 +1480,7 @@ void DRW_gpencil_populate_multiedit(
ToolSettings *ts = scene->toolsettings;
/* check if playing animation */
- bool playing = stl->storage->is_playing;
+ const bool playing = stl->storage->is_playing;
/* calc max size of VBOs */
gpencil_calc_vertex(stl, cache_ob, cache, gpd, cfra_eval);
@@ -1541,7 +1549,7 @@ void DRW_gpencil_populate_datablock(
bGPDlayer *gpl_active = BKE_gpencil_layer_getactive(gpd);
/* check if playing animation */
- bool playing = stl->storage->is_playing;
+ const bool playing = stl->storage->is_playing;
GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval);
@@ -1567,6 +1575,10 @@ void DRW_gpencil_populate_datablock(
continue;
}
+ const bool is_solomode = GPENCIL_PAINT_MODE(gpd) &&
+ (!playing) && (!stl->storage->is_render) &&
+ (gpl->flag & GP_LAYER_SOLO_MODE);
+
/* filter view layer to gp layers in the same view layer (for compo) */
if ((stl->storage->is_render) && (gpl->viewlayername[0] != '\0')) {
if (!STREQ(view_layer->name, gpl->viewlayername)) {
@@ -1586,6 +1598,11 @@ void DRW_gpencil_populate_datablock(
if (gpf == NULL)
continue;
+ /* if solo mode, display only frames with keyframe in the current frame */
+ if ((is_solomode) && (gpf->framenum != remap_cfra)) {
+ continue;
+ }
+
opacity = gpl->opacity;
/* if pose mode, maybe the overlay to fade geometry is enabled */
if ((draw_ctx->obact) && (draw_ctx->object_mode == OB_MODE_POSE) &&