Commit: b90646dc0e3dcfae6fe52eab32542cebf5a60b0e
Author: Campbell Barton
Date:   Wed Jul 11 18:09:19 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb90646dc0e3dcfae6fe52eab32542cebf5a60b0e

Transform Manipulator: fix scale handle selection

The scale handles couldn't be accessed when rotation was enabled and
they pointed away from the view.

===================================================================

M       source/blender/editors/transform/transform_manipulator_3d.c
M       source/blender/windowmanager/manipulators/WM_manipulator_types.h
M       source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c

===================================================================

diff --git a/source/blender/editors/transform/transform_manipulator_3d.c 
b/source/blender/editors/transform/transform_manipulator_3d.c
index fa56e8d10be..7dc72ddff6f 100644
--- a/source/blender/editors/transform/transform_manipulator_3d.c
+++ b/source/blender/editors/transform/transform_manipulator_3d.c
@@ -1248,6 +1248,8 @@ static ManipulatorGroup 
*manipulatorgroup_init(wmManipulatorGroup *mgroup)
        MANIPULATOR_NEW_PRIM(MAN_AXIS_TRANS_YZ, 
ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
        MANIPULATOR_NEW_PRIM(MAN_AXIS_TRANS_ZX, 
ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
 
+       man->manipulators[MAN_AXIS_ROT_T]->flag |= 
WM_MANIPULATOR_SELECT_BACKGROUND;
+
        return man;
 }
 
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_types.h 
b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
index e4482e797e3..ee2f833858a 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_types.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
@@ -84,6 +84,8 @@ typedef enum eWM_ManipulatorFlag {
         * Hide the cursor and lock it's position while interacting with this 
manipulator.
         */
        WM_MANIPULATOR_GRAB_CURSOR = (1 << 6),
+       /** Don't write into the depth buffer when selecting. */
+       WM_MANIPULATOR_SELECT_BACKGROUND  = (1 << 7),
 } eWM_ManipulatorFlag;
 
 /**
diff --git 
a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c 
b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
index 76668702bd1..2a3aa5df197 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
@@ -460,6 +460,7 @@ static void manipulator_draw_select_3D_loop(const bContext 
*C, ListBase *visible
 
        /* TODO(campbell): this depends on depth buffer being written to, 
currently broken for the 3D view. */
        bool is_depth_prev = false;
+       bool is_depth_skip_prev = false;
 
        for (LinkData *link = visible_manipulators->first; link; link = 
link->next) {
                mpr = link->data;
@@ -477,6 +478,14 @@ static void manipulator_draw_select_3D_loop(const bContext 
*C, ListBase *visible
                        }
                        is_depth_prev = is_depth;
                }
+               bool is_depth_skip = (mpr->flag & 
WM_MANIPULATOR_SELECT_BACKGROUND) != 0;
+               if (is_depth_skip == is_depth_skip_prev) {
+                       /* pass */
+               }
+               else {
+                       glDepthMask(!is_depth_skip);
+                       is_depth_skip_prev = is_depth_skip;
+               }
 
                /* pass the selection id shifted by 8 bits. Last 8 bits are 
used for selected manipulator part id */
 
@@ -489,6 +498,9 @@ static void manipulator_draw_select_3D_loop(const bContext 
*C, ListBase *visible
        if (is_depth_prev) {
                glDisable(GL_DEPTH_TEST);
        }
+       if (is_depth_skip_prev) {
+               glDepthMask(true);
+       }
 }
 
 static int manipulator_find_intersected_3d_intern(

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to