Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_sculpt.c
| Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| OVERLAY_PrivateData *pd = vedata->stl->pd; | OVERLAY_PrivateData *pd = vedata->stl->pd; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| struct GPUBatch *sculpt_overlays; | struct GPUBatch *sculpt_overlays; | ||||
| PBVH *pbvh = ob->sculpt->pbvh; | PBVH *pbvh = ob->sculpt->pbvh; | ||||
| const bool use_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d); | const bool use_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d); | ||||
| if (pbvh_has_mask(pbvh) || pbvh_has_face_sets(pbvh)) { | if (!pbvh) { | ||||
| /* It is possible to have SculptSession without PBVH. This happens, for example, when toggling | |||||
EAW: `Happes` to `This happens`
`them` to `then` | |||||
| * object mode to sculpt then to edit mode. */ | |||||
| return; | |||||
| } | |||||
| if (!pbvh_has_mask(pbvh) && !pbvh_has_face_sets(pbvh)) { | |||||
| /* The SculptSession and the PBVH can be created without a Mask datalayer or Face Set | |||||
| * datalayer. (masks datalayers are created after using a mask tool), so in these cases there | |||||
| * is nothing to draw. */ | |||||
| return; | |||||
| } | |||||
| if (use_pbvh) { | if (use_pbvh) { | ||||
| DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true); | DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true); | ||||
| } | } | ||||
| else { | else { | ||||
| sculpt_overlays = DRW_mesh_batch_cache_get_sculpt_overlays(ob->data); | sculpt_overlays = DRW_mesh_batch_cache_get_sculpt_overlays(ob->data); | ||||
| if (sculpt_overlays) { | if (sculpt_overlays) { | ||||
| DRW_shgroup_call(pd->sculpt_mask_grp, sculpt_overlays, ob); | DRW_shgroup_call(pd->sculpt_mask_grp, sculpt_overlays, ob); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| void OVERLAY_sculpt_draw(OVERLAY_Data *vedata) | void OVERLAY_sculpt_draw(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; | ||||
| DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); | DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); | ||||
| if (DRW_state_is_fbo()) { | if (DRW_state_is_fbo()) { | ||||
| GPU_framebuffer_bind(pd->painting.in_front ? dfbl->in_front_fb : dfbl->default_fb); | GPU_framebuffer_bind(pd->painting.in_front ? dfbl->in_front_fb : dfbl->default_fb); | ||||
| } | } | ||||
| DRW_draw_pass(psl->sculpt_mask_ps); | DRW_draw_pass(psl->sculpt_mask_ps); | ||||
| } | } | ||||
Happes to This happens
them to then