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/overlay/overlay_sculpt.c')
-rw-r--r--source/blender/draw/engines/overlay/overlay_sculpt.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_sculpt.c b/source/blender/draw/engines/overlay/overlay_sculpt.c
index b36252ead30..24c52ec427d 100644
--- a/source/blender/draw/engines/overlay/overlay_sculpt.c
+++ b/source/blender/draw/engines/overlay/overlay_sculpt.c
@@ -22,6 +22,7 @@
#include "DRW_render.h"
+#include "draw_cache_impl.h"
#include "overlay_private.h"
#include "BKE_paint.h"
@@ -48,13 +49,31 @@ void OVERLAY_sculpt_cache_populate(OVERLAY_Data *vedata, Object *ob)
{
OVERLAY_PrivateData *pd = vedata->stl->pd;
const DRWContextState *draw_ctx = DRW_context_state_get();
+ struct GPUBatch *sculpt_overlays;
PBVH *pbvh = ob->sculpt->pbvh;
const bool use_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d);
- if (use_pbvh || !ob->sculpt->deform_modifiers_active || ob->sculpt->shapekey_active) {
- if (!use_pbvh || pbvh_has_mask(pbvh) || pbvh_has_face_sets(pbvh)) {
- DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true);
+ if (!pbvh) {
+ /* It is possible to have SculptSession without PBVH. This happens, for example, when toggling
+ * 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 data-layer or Face Set
+ * data-layer. (masks data-layers are created after using a mask tool), so in these cases there
+ * is nothing to draw. */
+ return;
+ }
+
+ if (use_pbvh) {
+ DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true);
+ }
+ else {
+ sculpt_overlays = DRW_mesh_batch_cache_get_sculpt_overlays(ob->data);
+ if (sculpt_overlays) {
+ DRW_shgroup_call(pd->sculpt_mask_grp, sculpt_overlays, ob);
}
}
}