Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_gpencil.cc
- This file was moved from source/blender/draw/engines/overlay/overlay_gpencil.c.
| Show All 11 Lines | |||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "overlay_private.h" | #include "overlay_private.hh" | ||||
| #include "draw_common.h" | #include "draw_common.h" | ||||
| #include "draw_manager_text.h" | #include "draw_manager_text.h" | ||||
| void OVERLAY_edit_gpencil_cache_init(OVERLAY_Data *vedata) | void OVERLAY_edit_gpencil_cache_init(OVERLAY_Data *vedata) | ||||
| { | { | ||||
| OVERLAY_PassList *psl = vedata->psl; | OVERLAY_PassList *psl = vedata->psl; | ||||
| OVERLAY_PrivateData *pd = vedata->stl->pd; | OVERLAY_PrivateData *pd = vedata->stl->pd; | ||||
| struct GPUShader *sh; | struct GPUShader *sh; | ||||
| DRWShadingGroup *grp; | DRWShadingGroup *grp; | ||||
| /* Default: Display nothing. */ | /* Default: Display nothing. */ | ||||
| pd->edit_gpencil_points_grp = NULL; | pd->edit_gpencil_points_grp = nullptr; | ||||
| pd->edit_gpencil_wires_grp = NULL; | pd->edit_gpencil_wires_grp = nullptr; | ||||
| psl->edit_gpencil_ps = NULL; | psl->edit_gpencil_ps = nullptr; | ||||
| pd->edit_gpencil_curve_handle_grp = NULL; | pd->edit_gpencil_curve_handle_grp = nullptr; | ||||
| pd->edit_gpencil_curve_points_grp = NULL; | pd->edit_gpencil_curve_points_grp = nullptr; | ||||
| psl->edit_gpencil_curve_ps = NULL; | psl->edit_gpencil_curve_ps = nullptr; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| View3D *v3d = draw_ctx->v3d; | View3D *v3d = draw_ctx->v3d; | ||||
| Object *ob = draw_ctx->obact; | Object *ob = draw_ctx->obact; | ||||
| bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL; | bGPdata *gpd = ob ? (bGPdata *)ob->data : nullptr; | ||||
| Scene *scene = draw_ctx->scene; | Scene *scene = draw_ctx->scene; | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| if (gpd == NULL || ob->type != OB_GPENCIL) { | if (gpd == nullptr || ob->type != OB_GPENCIL) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* For sculpt show only if mask mode, and only points if not stroke mode. */ | /* For sculpt show only if mask mode, and only points if not stroke mode. */ | ||||
| const bool use_sculpt_mask = (GPENCIL_SCULPT_MODE(gpd) && | const bool use_sculpt_mask = (GPENCIL_SCULPT_MODE(gpd) && | ||||
| GPENCIL_ANY_SCULPT_MASK(ts->gpencil_selectmode_sculpt)); | GPENCIL_ANY_SCULPT_MASK(ts->gpencil_selectmode_sculpt)); | ||||
| const bool show_sculpt_points = (GPENCIL_SCULPT_MODE(gpd) && | const bool show_sculpt_points = (GPENCIL_SCULPT_MODE(gpd) && | ||||
| (ts->gpencil_selectmode_sculpt & | (ts->gpencil_selectmode_sculpt & | ||||
| ▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | void OVERLAY_edit_gpencil_cache_init(OVERLAY_Data *vedata) | ||||
| if ((is_cppoint || is_speed_guide) && (is_show_gizmo)) { | if ((is_cppoint || is_speed_guide) && (is_show_gizmo)) { | ||||
| DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA; | DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA; | ||||
| DRW_PASS_CREATE(psl->edit_gpencil_gizmos_ps, state); | DRW_PASS_CREATE(psl->edit_gpencil_gizmos_ps, state); | ||||
| sh = OVERLAY_shader_edit_gpencil_guide_point(); | sh = OVERLAY_shader_edit_gpencil_guide_point(); | ||||
| grp = DRW_shgroup_create(sh, psl->edit_gpencil_gizmos_ps); | grp = DRW_shgroup_create(sh, psl->edit_gpencil_gizmos_ps); | ||||
| if (gpd->runtime.cp_points != NULL) { | if (gpd->runtime.cp_points != nullptr) { | ||||
| for (int i = 0; i < gpd->runtime.tot_cp_points; i++) { | for (int i = 0; i < gpd->runtime.tot_cp_points; i++) { | ||||
| bGPDcontrolpoint *cp = &gpd->runtime.cp_points[i]; | bGPDcontrolpoint *cp = &gpd->runtime.cp_points[i]; | ||||
| grp = DRW_shgroup_create_sub(grp); | grp = DRW_shgroup_create_sub(grp); | ||||
| DRW_shgroup_uniform_vec3_copy(grp, "pPosition", &cp->x); | DRW_shgroup_uniform_vec3_copy(grp, "pPosition", &cp->x); | ||||
| DRW_shgroup_uniform_float_copy(grp, "pSize", cp->size * 0.8f * G_draw.block.size_pixel); | DRW_shgroup_uniform_float_copy(grp, "pSize", cp->size * 0.8f * G_draw.block.size_pixel); | ||||
| DRW_shgroup_uniform_vec4_copy(grp, "pColor", cp->color); | DRW_shgroup_uniform_vec4_copy(grp, "pColor", cp->color); | ||||
| DRW_shgroup_call_procedural_points(grp, NULL, 1); | DRW_shgroup_call_procedural_points(grp, nullptr, 1); | ||||
| } | } | ||||
| } | } | ||||
| if (ts->gp_sculpt.guide.use_guide) { | if (ts->gp_sculpt.guide.use_guide) { | ||||
| float color[4]; | float color[4]; | ||||
| if (ts->gp_sculpt.guide.reference_point == GP_GUIDE_REF_CUSTOM) { | if (ts->gp_sculpt.guide.reference_point == GP_GUIDE_REF_CUSTOM) { | ||||
| UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color); | UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color); | ||||
| DRW_shgroup_uniform_vec3_copy(grp, "pPosition", ts->gp_sculpt.guide.location); | DRW_shgroup_uniform_vec3_copy(grp, "pPosition", ts->gp_sculpt.guide.location); | ||||
| } | } | ||||
| else if (ts->gp_sculpt.guide.reference_point == GP_GUIDE_REF_OBJECT && | else if (ts->gp_sculpt.guide.reference_point == GP_GUIDE_REF_OBJECT && | ||||
| ts->gp_sculpt.guide.reference_object != NULL) { | ts->gp_sculpt.guide.reference_object != nullptr) { | ||||
| UI_GetThemeColor4fv(TH_GIZMO_SECONDARY, color); | UI_GetThemeColor4fv(TH_GIZMO_SECONDARY, color); | ||||
| DRW_shgroup_uniform_vec3_copy(grp, "pPosition", ts->gp_sculpt.guide.reference_object->loc); | DRW_shgroup_uniform_vec3_copy(grp, "pPosition", ts->gp_sculpt.guide.reference_object->loc); | ||||
| } | } | ||||
| else { | else { | ||||
| UI_GetThemeColor4fv(TH_REDALERT, color); | UI_GetThemeColor4fv(TH_REDALERT, color); | ||||
| DRW_shgroup_uniform_vec3_copy(grp, "pPosition", scene->cursor.location); | DRW_shgroup_uniform_vec3_copy(grp, "pPosition", scene->cursor.location); | ||||
| } | } | ||||
| DRW_shgroup_uniform_vec4_copy(grp, "pColor", color); | DRW_shgroup_uniform_vec4_copy(grp, "pColor", color); | ||||
| DRW_shgroup_uniform_float_copy(grp, "pSize", 8.0f * G_draw.block.size_pixel); | DRW_shgroup_uniform_float_copy(grp, "pSize", 8.0f * G_draw.block.size_pixel); | ||||
| DRW_shgroup_call_procedural_points(grp, NULL, 1); | DRW_shgroup_call_procedural_points(grp, nullptr, 1); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata) | void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata) | ||||
| { | { | ||||
| OVERLAY_PassList *psl = vedata->psl; | OVERLAY_PassList *psl = vedata->psl; | ||||
| OVERLAY_PrivateData *pd = vedata->stl->pd; | OVERLAY_PrivateData *pd = vedata->stl->pd; | ||||
| struct GPUShader *sh; | struct GPUShader *sh; | ||||
| DRWShadingGroup *grp; | DRWShadingGroup *grp; | ||||
| /* Default: Display nothing. */ | /* Default: Display nothing. */ | ||||
| psl->gpencil_canvas_ps = NULL; | psl->gpencil_canvas_ps = nullptr; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| View3D *v3d = draw_ctx->v3d; | View3D *v3d = draw_ctx->v3d; | ||||
| Object *ob = draw_ctx->obact; | Object *ob = draw_ctx->obact; | ||||
| bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL; | bGPdata *gpd = ob ? (bGPdata *)ob->data : nullptr; | ||||
| Scene *scene = draw_ctx->scene; | Scene *scene = draw_ctx->scene; | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| const View3DCursor *cursor = &scene->cursor; | const View3DCursor *cursor = &scene->cursor; | ||||
| pd->edit_curve.show_handles = v3d->overlay.handle_display != CURVE_HANDLE_NONE; | pd->edit_curve.show_handles = v3d->overlay.handle_display != CURVE_HANDLE_NONE; | ||||
| pd->edit_curve.handle_display = v3d->overlay.handle_display; | pd->edit_curve.handle_display = v3d->overlay.handle_display; | ||||
| if (gpd == NULL || ob->type != OB_GPENCIL) { | if (gpd == nullptr || ob->type != OB_GPENCIL) { | ||||
| return; | return; | ||||
| } | } | ||||
| const bool show_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0; | const bool show_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0; | ||||
| const bool show_grid = (v3d->gp_flag & V3D_GP_SHOW_GRID) != 0 && | const bool show_grid = (v3d->gp_flag & V3D_GP_SHOW_GRID) != 0 && | ||||
| ((ts->gpencil_v3d_align & | ((ts->gpencil_v3d_align & | ||||
| (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)) == 0); | (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)) == 0); | ||||
| const bool grid_xray = (v3d->gp_flag & V3D_GP_SHOW_GRID_XRAY); | const bool grid_xray = (v3d->gp_flag & V3D_GP_SHOW_GRID_XRAY); | ||||
| if (show_grid && show_overlays) { | if (show_grid && show_overlays) { | ||||
| const char *grid_unit = NULL; | const char *grid_unit = nullptr; | ||||
| float mat[4][4]; | float mat[4][4]; | ||||
| float col_grid[4]; | float col_grid[4]; | ||||
| float size[2]; | float size[2]; | ||||
| /* set color */ | /* set color */ | ||||
| copy_v3_v3(col_grid, gpd->grid.color); | copy_v3_v3(col_grid, gpd->grid.color); | ||||
| col_grid[3] = max_ff(v3d->overlay.gpencil_grid_opacity, 0.01f); | col_grid[3] = max_ff(v3d->overlay.gpencil_grid_opacity, 0.01f); | ||||
| copy_m4_m4(mat, ob->obmat); | copy_m4_m4(mat, ob->obmat); | ||||
| /* Rotate and scale except align to cursor. */ | /* Rotate and scale except align to cursor. */ | ||||
| bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); | bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); | ||||
| if (gpl != NULL) { | if (gpl != nullptr) { | ||||
| if (ts->gp_sculpt.lock_axis != GP_LOCKAXIS_CURSOR) { | if (ts->gp_sculpt.lock_axis != GP_LOCKAXIS_CURSOR) { | ||||
| float matrot[3][3]; | float matrot[3][3]; | ||||
| copy_m3_m4(matrot, gpl->layer_mat); | copy_m3_m4(matrot, gpl->layer_mat); | ||||
| mul_m4_m4m3(mat, mat, matrot); | mul_m4_m4m3(mat, mat, matrot); | ||||
| } | } | ||||
| } | } | ||||
| float viewinv[4][4]; | float viewinv[4][4]; | ||||
| /* Set the grid in the selected axis */ | /* Set the grid in the selected axis */ | ||||
| switch (ts->gp_sculpt.lock_axis) { | switch (ts->gp_sculpt.lock_axis) { | ||||
| case GP_LOCKAXIS_X: | case GP_LOCKAXIS_X: | ||||
| swap_v4_v4(mat[0], mat[2]); | swap_v4_v4(mat[0], mat[2]); | ||||
| break; | break; | ||||
| case GP_LOCKAXIS_Y: | case GP_LOCKAXIS_Y: | ||||
| swap_v4_v4(mat[1], mat[2]); | swap_v4_v4(mat[1], mat[2]); | ||||
| break; | break; | ||||
| case GP_LOCKAXIS_Z: | case GP_LOCKAXIS_Z: | ||||
| /* Default. */ | /* Default. */ | ||||
| break; | break; | ||||
| case GP_LOCKAXIS_CURSOR: | case GP_LOCKAXIS_CURSOR: { | ||||
| loc_eul_size_to_mat4(mat, cursor->location, cursor->rotation_euler, (float[3]){1, 1, 1}); | const float3 size_vec = {1.0f, 1.0f, 1.0f}; | ||||
| loc_eul_size_to_mat4(mat, cursor->location, cursor->rotation_euler, size_vec); | |||||
| break; | break; | ||||
| } | |||||
| case GP_LOCKAXIS_VIEW: | case GP_LOCKAXIS_VIEW: | ||||
| /* view aligned */ | /* view aligned */ | ||||
| DRW_view_viewmat_get(NULL, viewinv, true); | DRW_view_viewmat_get(nullptr, viewinv, true); | ||||
| copy_v3_v3(mat[0], viewinv[0]); | copy_v3_v3(mat[0], viewinv[0]); | ||||
| copy_v3_v3(mat[1], viewinv[1]); | copy_v3_v3(mat[1], viewinv[1]); | ||||
| break; | break; | ||||
| } | } | ||||
| /* Move the grid to the right location depending of the align type. | /* Move the grid to the right location depending of the align type. | ||||
| * This is required only for 3D Cursor or Origin. */ | * This is required only for 3D Cursor or Origin. */ | ||||
| if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { | if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) { | ||||
| copy_v3_v3(mat[3], cursor->location); | copy_v3_v3(mat[3], cursor->location); | ||||
| } | } | ||||
| else if (ts->gpencil_v3d_align & GP_PROJECT_VIEWSPACE) { | else if (ts->gpencil_v3d_align & GP_PROJECT_VIEWSPACE) { | ||||
| copy_v3_v3(mat[3], ob->obmat[3]); | copy_v3_v3(mat[3], ob->obmat[3]); | ||||
| } | } | ||||
| translate_m4(mat, gpd->grid.offset[0], gpd->grid.offset[1], 0.0f); | translate_m4(mat, gpd->grid.offset[0], gpd->grid.offset[1], 0.0f); | ||||
| mul_v2_v2fl(size, gpd->grid.scale, 2.0f * ED_scene_grid_scale(scene, &grid_unit)); | mul_v2_v2fl(size, gpd->grid.scale, 2.0f * ED_scene_grid_scale(scene, &grid_unit)); | ||||
| rescale_m4(mat, (float[3]){size[0], size[1], 0.0f}); | const float3 scale_vec = {size[0], size[1], 0.0f}; | ||||
| rescale_m4(mat, scale_vec); | |||||
| /* Apply layer loc transform, except cursor mode. */ | /* Apply layer loc transform, except cursor mode. */ | ||||
| if ((gpl != NULL) && (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) == 0) { | if ((gpl != nullptr) && (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) == 0) { | ||||
| add_v3_v3(mat[3], gpl->layer_mat[3]); | add_v3_v3(mat[3], gpl->layer_mat[3]); | ||||
| } | } | ||||
| const int gridlines = (gpd->grid.lines <= 0) ? 1 : gpd->grid.lines; | const int gridlines = (gpd->grid.lines <= 0) ? 1 : gpd->grid.lines; | ||||
| const int line_count = gridlines * 4 + 2; | const int line_count = gridlines * 4 + 2; | ||||
| DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA; | DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA; | ||||
| state |= (grid_xray) ? DRW_STATE_DEPTH_ALWAYS : DRW_STATE_DEPTH_LESS_EQUAL; | state |= (grid_xray) ? DRW_STATE_DEPTH_ALWAYS : DRW_STATE_DEPTH_LESS_EQUAL; | ||||
| DRW_PASS_CREATE(psl->gpencil_canvas_ps, state); | DRW_PASS_CREATE(psl->gpencil_canvas_ps, state); | ||||
| sh = OVERLAY_shader_gpencil_canvas(); | sh = OVERLAY_shader_gpencil_canvas(); | ||||
| grp = DRW_shgroup_create(sh, psl->gpencil_canvas_ps); | grp = DRW_shgroup_create(sh, psl->gpencil_canvas_ps); | ||||
| DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); | DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); | ||||
| DRW_shgroup_uniform_vec4_copy(grp, "color", col_grid); | DRW_shgroup_uniform_vec4_copy(grp, "color", col_grid); | ||||
| DRW_shgroup_uniform_vec3_copy(grp, "xAxis", mat[0]); | DRW_shgroup_uniform_vec3_copy(grp, "xAxis", mat[0]); | ||||
| DRW_shgroup_uniform_vec3_copy(grp, "yAxis", mat[1]); | DRW_shgroup_uniform_vec3_copy(grp, "yAxis", mat[1]); | ||||
| DRW_shgroup_uniform_vec3_copy(grp, "origin", mat[3]); | DRW_shgroup_uniform_vec3_copy(grp, "origin", mat[3]); | ||||
| DRW_shgroup_uniform_int_copy(grp, "halfLineCount", line_count / 2); | DRW_shgroup_uniform_int_copy(grp, "halfLineCount", line_count / 2); | ||||
| DRW_shgroup_call_procedural_lines(grp, NULL, line_count); | DRW_shgroup_call_procedural_lines(grp, nullptr, line_count); | ||||
| } | } | ||||
| } | } | ||||
| static void OVERLAY_edit_gpencil_cache_populate(OVERLAY_Data *vedata, Object *ob) | static void OVERLAY_edit_gpencil_cache_populate(OVERLAY_Data *vedata, Object *ob) | ||||
| { | { | ||||
| OVERLAY_PrivateData *pd = vedata->stl->pd; | OVERLAY_PrivateData *pd = vedata->stl->pd; | ||||
| bGPdata *gpd = (bGPdata *)ob->data; | bGPdata *gpd = (bGPdata *)ob->data; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| Show All 39 Lines | |||||
| static void overlay_gpencil_draw_stroke_color_name(bGPDlayer *UNUSED(gpl), | static void overlay_gpencil_draw_stroke_color_name(bGPDlayer *UNUSED(gpl), | ||||
| bGPDframe *UNUSED(gpf), | bGPDframe *UNUSED(gpf), | ||||
| bGPDstroke *gps, | bGPDstroke *gps, | ||||
| void *thunk) | void *thunk) | ||||
| { | { | ||||
| Object *ob = (Object *)thunk; | Object *ob = (Object *)thunk; | ||||
| Material *ma = BKE_object_material_get_eval(ob, gps->mat_nr + 1); | Material *ma = BKE_object_material_get_eval(ob, gps->mat_nr + 1); | ||||
| if (ma == NULL) { | if (ma == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| MaterialGPencilStyle *gp_style = ma->gp_style; | MaterialGPencilStyle *gp_style = ma->gp_style; | ||||
| /* skip stroke if it doesn't have any valid data */ | /* skip stroke if it doesn't have any valid data */ | ||||
| if ((gps->points == NULL) || (gps->totpoints < 1) || (gp_style == NULL)) { | if ((gps->points == nullptr) || (gps->totpoints < 1) || (gp_style == nullptr)) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* check if the color is visible */ | /* check if the color is visible */ | ||||
| if (gp_style->flag & GP_MATERIAL_HIDE) { | if (gp_style->flag & GP_MATERIAL_HIDE) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* only if selected */ | /* only if selected */ | ||||
| if (gps->flag & GP_STROKE_SELECT) { | if (gps->flag & GP_STROKE_SELECT) { | ||||
| 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]; | ||||
| /* Draw name at the first selected point. */ | /* Draw name at the first selected point. */ | ||||
| if (pt->flag & GP_SPOINT_SELECT) { | if (pt->flag & GP_SPOINT_SELECT) { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| ViewLayer *view_layer = draw_ctx->view_layer; | ViewLayer *view_layer = draw_ctx->view_layer; | ||||
| int theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL); | int theme_id = DRW_object_wire_theme_get(ob, view_layer, nullptr); | ||||
| uchar color[4]; | uchar color[4]; | ||||
| UI_GetThemeColor4ubv(theme_id, color); | UI_GetThemeColor4ubv(theme_id, color); | ||||
| float fpt[3]; | float fpt[3]; | ||||
| mul_v3_m4v3(fpt, ob->obmat, &pt->x); | mul_v3_m4v3(fpt, ob->obmat, &pt->x); | ||||
| struct DRWTextStore *dt = DRW_text_cache_ensure(); | struct DRWTextStore *dt = DRW_text_cache_ensure(); | ||||
| DRW_text_cache_add(dt, | DRW_text_cache_add(dt, | ||||
| Show All 11 Lines | |||||
| } | } | ||||
| static void OVERLAY_gpencil_color_names(Object *ob) | static void OVERLAY_gpencil_color_names(Object *ob) | ||||
| { | { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| int cfra = DEG_get_ctime(draw_ctx->depsgraph); | int cfra = DEG_get_ctime(draw_ctx->depsgraph); | ||||
| BKE_gpencil_visible_stroke_advanced_iter( | BKE_gpencil_visible_stroke_advanced_iter( | ||||
| NULL, ob, NULL, overlay_gpencil_draw_stroke_color_name, ob, false, cfra); | nullptr, ob, nullptr, overlay_gpencil_draw_stroke_color_name, ob, false, cfra); | ||||
| } | } | ||||
| void OVERLAY_gpencil_cache_populate(OVERLAY_Data *vedata, Object *ob) | void OVERLAY_gpencil_cache_populate(OVERLAY_Data *vedata, Object *ob) | ||||
| { | { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| View3D *v3d = draw_ctx->v3d; | View3D *v3d = draw_ctx->v3d; | ||||
| bGPdata *gpd = (bGPdata *)ob->data; | bGPdata *gpd = (bGPdata *)ob->data; | ||||
| if (gpd == NULL) { | if (gpd == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (GPENCIL_ANY_MODE(gpd)) { | if (GPENCIL_ANY_MODE(gpd)) { | ||||
| OVERLAY_edit_gpencil_cache_populate(vedata, ob); | OVERLAY_edit_gpencil_cache_populate(vedata, ob); | ||||
| } | } | ||||
| /* don't show object extras in set's */ | /* don't show object extras in set's */ | ||||
| Show All 34 Lines | |||||