Manipulator: tweak shape drawing
authorCampbell Barton <ideasman42@gmail.com>
Sat, 20 Jan 2018 08:41:41 +0000 (19:41 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 20 Jan 2018 08:41:41 +0000 (19:41 +1100)
Draw triangles over wire for a more subtle outline.

source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
source/blender/editors/space_view3d/view3d_manipulator_navigate.c

index 2951ad84c0d397c0d765d6b21fe8e9f64a6638b7..ce6992e7ad982f1934433500161f7051a0f65671 100644 (file)
@@ -114,8 +114,8 @@ static void button2d_draw_intern(
                        /* We shouldn't need the +1, but a NULL char is set. */
                        char *polys = MEM_mallocN(polys_len + 1, __func__);
                        RNA_property_string_get(mpr->ptr, prop, polys);
-                       button->shape_batch[0] = GPU_batch_tris_from_poly_2d_encoded((uchar *)polys, polys_len, NULL);
-                       button->shape_batch[1] = GPU_batch_wire_from_poly_2d_encoded((uchar *)polys, polys_len, NULL);
+                       button->shape_batch[0] = GPU_batch_wire_from_poly_2d_encoded((uchar *)polys, polys_len, NULL);
+                       button->shape_batch[1] = GPU_batch_tris_from_poly_2d_encoded((uchar *)polys, polys_len, NULL);
                        MEM_freeN(polys);
                }
        }
@@ -137,17 +137,17 @@ static void button2d_draw_intern(
                        glEnable(GL_LINE_SMOOTH);
                        glLineWidth(1.0f);
                        for (uint i = 0; i < ARRAY_SIZE(button->shape_batch) && button->shape_batch[i]; i++) {
+                               /* Invert line color for wire. */
+                               color[0] = 1.0f - color[0];
+                               color[1] = 1.0f - color[1];
+                               color[2] = 1.0f - color[2];
+
                                GWN_batch_program_set_builtin(button->shape_batch[i], GPU_SHADER_2D_UNIFORM_COLOR);
                                GWN_batch_uniform_4f(button->shape_batch[i], "color", UNPACK4(color));
                                GWN_batch_draw(button->shape_batch[i]);
-                               if (i == 0) {
-                                       /* Invert line color. */
-                                       color[0] = 1.0f - color[0];
-                                       color[1] = 1.0f - color[1];
-                                       color[2] = 1.0f - color[2];
-                               }
                        }
                        glDisable(GL_POLYGON_SMOOTH);
+                       glDisable(GL_LINE_SMOOTH);
                        gpuPopMatrix();
                }
                else if (button->icon != ICON_NONE) {
index 3fc3300e2c1ee8a1dbfaa96c4dfdd392a95ce78c..0f7df8fe6aa37dd66d99decb6f5e4699fd67ec37 100644 (file)
@@ -201,7 +201,6 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG
                                mpr->ptr, prop,
                                (const char *)info->shape, info->shape_size);
                        /* don't fade icons so much */
-                       copy_v3_fl(mpr->color, 0.0f);
                        mpr->color[3] = 0.5f;
                }