Page MenuHome

Fix T76902: face sets checkbox broken
AbandonedPublic

Authored by Sebastian Parborg (zeddb) on Wed, May 20, 12:15 PM.

Details

Summary

The previous code had a dummy function that didn't check for actual user settings and instead just turned on every drawing option.

Now we instead check if the drawing options are actually set or not.

Diff Detail

Event Timeline

Note, I didn't seem to be able to find any option related to SHOW_VCOL so I guess we can't toggle this option from the UI?
Or am I missing something here?

This bug was introduced in https://developer.blender.org/rB7d38f5036794e7bf2678c8138b940257b152435b because all the buffers need to be always initialized to avoid artifacts when changing shading modes. When show mask and show face sets are disable it just renders them white, but the data is still there. Maybe @Jeroen Bakker (jbakker) can tell if this will also work after that change, but probably we should try to refactor and rename these variables to avoid these kind of bugs in the future.

I was not able to reproduce most of the reported glitching artifacts even before that fix, so I would rather have someone else to check if it is still working

Jeroen Bakker (jbakker) added a comment.EditedMon, May 25, 7:51 PM

The idea behind my change was to always create the GPU buffers with all data inside. Glitches started to appear when you have 2 viewports and both of them started to ask different updates (one with masks, other without masks). the first viewport would update the buffers, but without the data needs of the second viewport. The second viewport then could not have the correct data and on an AMD card would render unallocated memory.

So to keep that in mind the checkboxes should be evaluated during drawing so perhaps in the overlay_engine.c.

diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c
index e875f2c8291..586b99c14da 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -46,6 +46,8 @@ static void OVERLAY_engine_init(void *vedata)
   const DRWContextState *draw_ctx = DRW_context_state_get();
   const RegionView3D *rv3d = draw_ctx->rv3d;
   const View3D *v3d = draw_ctx->v3d;
+  const Scene *scene = draw_ctx->scene;
+  const ToolSettings *ts = scene->toolsettings;
 
   if (!stl->pd) {
     /* Alloc transient pointers */
@@ -76,6 +78,12 @@ static void OVERLAY_engine_init(void *vedata)
   if (v3d->shading.type == OB_WIRE) {
     pd->overlay.flag |= V3D_OVERLAY_WIREFRAMES;
   }
+  if (ts->sculpt->flags & SCULPT_HIDE_FACE_SETS) {
+    pd->overlay.sculpt_mode_face_sets_opacity = 0.0f;
+  }
+  if (ts->sculpt->flags & SCULPT_HIDE_MASK) {
+    pd->overlay.sculpt_mode_mask_opacity = 0.0f;
+  }
 
   pd->use_in_front = (v3d->shading.type <= OB_SOLID) ||
                      BKE_scene_uses_blender_workbench(draw_ctx->scene);