Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Mon, 9 Apr 2018 10:44:25 +0000 (12:44 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 9 Apr 2018 10:44:25 +0000 (12:44 +0200)
1  2 
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_generics.c

index a4bce5b0f1d70c0de106e85151f38db7b342b57b,90014667b438ed76d8a72de7523f566530a0fafa..3aeb38970d2b1c2374c8e392340a49ede7a700e1
@@@ -1706,57 -1693,16 +1706,47 @@@ static void drawHelpline(bContext *UNUS
  {
        TransInfo *t = (TransInfo *)customdata;
  
 -      if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) {
 +      if (t->helpline != HLP_NONE) {
-               float vecrot[3], cent[2];
+               float cent[2];
 -              int mval[2];
 -
 -              mval[0] = x;
 -              mval[1] = y;
 +              float mval[3] = { x, y, 0.0f };
  
-               copy_v3_v3(vecrot, t->center);
-               if (t->flag & T_EDIT) {
-                       Object *ob = t->obedit;
-                       if (ob) mul_m4_v3(ob->obmat, vecrot);
-               }
-               else if (t->flag & T_POSE) {
-                       Object *ob = t->poseobj;
-                       if (ob) mul_m4_v3(ob->obmat, vecrot);
-               }
-               projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO);
+               projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
  
 -              glPushMatrix();
 +              gpuPushMatrix();
 +
 +              /* Dashed lines first. */
 +              if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE)) {
 +                      const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
 +
 +                      UNUSED_VARS_NDEBUG(shdr_pos); /* silence warning */
 +                      BLI_assert(shdr_pos == POS_INDEX);
 +
 +                      glLineWidth(1.0f);
 +
 +                      immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
 +
 +                      float viewport_size[4];
 +                      glGetFloatv(GL_VIEWPORT, viewport_size);
 +                      immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
 +
 +                      immUniform1i("num_colors", 0);  /* "simple" mode */
 +                      immUniformThemeColor(TH_VIEW_OVERLAY);
 +                      immUniform1f("dash_width", 6.0f);
 +                      immUniform1f("dash_factor", 0.5f);
 +
 +                      immBegin(GWN_PRIM_LINES, 2);
 +                      immVertex2fv(POS_INDEX, cent);
 +                      immVertex2f(POS_INDEX, (float)t->mval[0], (float)t->mval[1]);
 +                      immEnd();
 +
 +                      immUnbindProgram();
 +              }
 +
 +              /* And now, solid lines. */
 +              unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
 +              UNUSED_VARS_NDEBUG(pos); /* silence warning */
 +              BLI_assert(pos == POS_INDEX);
 +              immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
  
                switch (t->helpline) {
                        case HLP_SPRING: