Page MenuHome

Fix T71379: Offset Edge Slide with Even option: random points on screen
AbandonedPublic

Authored by Campbell Barton (campbellbarton) on Thu, Nov 7, 6:53 PM.

Details

Summary

It is not garuanteed that the Offset Edge Slide ctrl point [red dot] is
actually drawing, so doing immBegin(GPU_PRIM_POINTS, 1) [when actually
not drawing a point -- no immVertex3fv called] will assert (or begin
drawing funky in release).

Using immBeginAtMost fixes.

Diff Detail

Repository
rB Blender
Branch
T71379 (branched from master)
Build Status
Buildable 5611
Build 5611: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Thu, Nov 7, 10:29 PM

Suggest not to draw the point if it's not needed:

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 9f53c38c403..dda61cb12c0 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -7576,20 +7576,27 @@ static void drawEdgeSlide(TransInfo *t)
         }
         immEnd();
 
-        immUniformThemeColorShadeAlpha(TH_SELECT, -30, alpha_shade);
-        GPU_point_size(ctrl_size);
-        immBegin(GPU_PRIM_POINTS, 1);
-        if (slp->flipped) {
-          if (curr_sv->v_side[1]) {
-            immVertex3fv(pos, curr_sv->v_side[1]->co);
+        {
+          const float *co = NULL;
+          if (slp->flipped) {
+            if (curr_sv->v_side[1]) {
+              co = curr_sv->v_side[1]->co;
+            }
           }
-        }
-        else {
-          if (curr_sv->v_side[0]) {
-            immVertex3fv(pos, curr_sv->v_side[0]->co);
+          else {
+            if (curr_sv->v_side[0]) {
+              co = curr_sv->v_side[0]->co;
+            }
+          }
+
+          if (co != NULL) {
+            immUniformThemeColorShadeAlpha(TH_SELECT, -30, alpha_shade);
+            GPU_point_size(ctrl_size);
+            immBegin(GPU_PRIM_POINTS, 1);
+            immVertex3fv(pos, co);
+            immEnd();
           }
         }
-        immEnd();
 
         immUniformThemeColorShadeAlpha(TH_SELECT, 255, alpha_shade);
         GPU_point_size(guide_size);

Suggest not to draw the point if it's not needed:

Sounds good [was thinking the same, but was also thinking it wasnt worth it since we have capable API for it...].
Go ahead :)