Manipulator: changes for overlay options
authorCampbell Barton <ideasman42@gmail.com>
Wed, 11 Jul 2018 08:38:01 +0000 (10:38 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 11 Jul 2018 08:49:18 +0000 (10:49 +0200)
There are now 3 categories in the overlay popover:

- Navigation
- Active (camera, lamp... etc)
- Tool (manipulator)

The user preference for mini axis now controls if the mini axis
displays minimal or a full-interactive widget.

Part of design: T55863

28 files changed:
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenloader/intern/versioning_defaults.c
source/blender/draw/intern/draw_manager.c
source/blender/editors/interface/resources.c
source/blender/editors/manipulator_library/manipulator_draw_utils.c
source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
source/blender/editors/mesh/editmesh_add_manipulator.c
source/blender/editors/mesh/editmesh_bevel.c
source/blender/editors/mesh/editmesh_bisect.c
source/blender/editors/mesh/editmesh_extrude_spin.c
source/blender/editors/mesh/editmesh_inset.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_manipulator_armature.c
source/blender/editors/space_view3d/view3d_manipulator_camera.c
source/blender/editors/space_view3d/view3d_manipulator_empty.c
source/blender/editors/space_view3d/view3d_manipulator_forcefield.c
source/blender/editors/space_view3d/view3d_manipulator_lamp.c
source/blender/editors/space_view3d/view3d_manipulator_navigate.c
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_manipulator_3d.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_userdef.c

index e44fd6e09db1826cad18b68cbf1d7347b6b87b67..ca96c79b2b4601757b6804f6e9c5e6b8f9fcdbf5 100644 (file)
@@ -238,15 +238,15 @@ class USERPREF_PT_interface(Panel):
 
         col.separator()
 
-        col.prop(view, "show_manipulator_navigate")
+        col.prop(view, "show_manipulator_navigate")
 
         sub = col.column(align=True)
 
-        sub.prop(view, "show_mini_axis", text="Display Mini Axis")
-        sub.active = not view.show_manipulator_navigate
+        sub.label("3D Viewport Axis:")
+        sub.row().prop(view, "mini_axis_type", expand=True)
 
         sub = col.column(align=True)
-        sub.active = view.show_mini_axis
+        sub.active = view.mini_axis_type == 'MINIMAL'
         sub.prop(view, "mini_axis_size", text="Size")
         sub.prop(view, "mini_axis_brightness", text="Brightness")
 
@@ -258,9 +258,7 @@ class USERPREF_PT_interface(Panel):
         #col.label(text="Open Toolbox Delay:")
         #col.prop(view, "open_left_mouse_delay", text="Hold LMB")
         #col.prop(view, "open_right_mouse_delay", text="Hold RMB")
-        col.prop(view, "show_manipulator", text="Transform Manipulator")
-        # Currently not working
-        # col.prop(view, "show_manipulator_shaded")
+        col.prop(view, "show_manipulator", text="Manipulators")
         sub = col.column()
         sub.active = view.show_manipulator
         sub.prop(view, "manipulator_size", text="Size")
index b484bf08c3b74ad35f3d7ca7b3fc36f2c85d4032..3e97877c115546eb7f62461f6b66b4f5acb33104 100644 (file)
@@ -3882,6 +3882,20 @@ class VIEW3D_PT_overlay(Panel):
 
         sub = split.column()
         sub.prop(view, "show_manipulator", text="Manipulators")
+        has_manipulator = view.show_manipulator
+        subsub = sub.column()
+        subsub.active = has_manipulator
+        subsub.prop(view, "show_manipulator_navigate", text="Navigate")
+        del subsub
+        sub = split.column()
+        sub.active = has_manipulator
+        sub.prop(view, "show_manipulator_context", text="Active Object")
+        sub.prop(view, "show_manipulator_tool", text="Active Tools")
+
+        col.separator()
+
+        split = col.split()
+        sub = split.column()
         sub.prop(overlay, "show_text", text="Text")
         sub.prop(overlay, "show_cursor", text="3D Cursor")
         sub.prop(overlay, "show_outline_selected")
index d43000e859e226312ef0e757273a9d6bab607f54..bd7334516cadab282648cad8b3d13570c8ac5fd0 100644 (file)
@@ -71,7 +71,6 @@ void BLO_update_defaults_userpref_blend(void)
        /* Defaults from T54943 (phase 1). */
        U.flag &= ~USER_TOOLTIPS_PYTHON;
        U.uiflag |= USER_AUTOPERSP;
-       U.manipulator_flag |= USER_MANIPULATOR_DRAW_NAVIGATE;
        U.uiflag2 |= USER_REGION_OVERLAP;
 
        U.versions = 1;
index 30f7742fd3533ee4c41f25d6560a76333ebe0811..be067b0464de9b6187d87ac711d854bcc358881c 100644 (file)
@@ -1440,7 +1440,7 @@ void DRW_draw_render_loop_ex(
        if (DST.draw_ctx.evil_C) {
                /* needed so manipulator isn't obscured */
                if (((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
-                   ((v3d->twflag & V3D_MANIPULATOR_DRAW) != 0))
+                   ((v3d->mpr_flag & V3D_MANIPULATOR_HIDE) == 0))
                {
                        glDisable(GL_DEPTH_TEST);
                        DRW_draw_manipulator_3d();
index aa71c31c541d724a3e9afec55ac4aca6efbcba39..c279c949e625e71e5cc60a06e205b04b6e0a9a70 100644 (file)
@@ -1383,7 +1383,7 @@ void init_userdef_do_versions(Main *bmain)
                if (U.rvisize == 0) {
                        U.rvisize = 15;
                        U.rvibright = 8;
-                       U.uiflag |= USER_SHOW_ROTVIEWICON;
+                       U.uiflag |= USER_SHOW_MANIPULATOR_AXIS;
                }
 
        }
index a0b226b7502d7e7b5134b9c0ba5eddc7a85f2977..80181c571159edc730c98b56f6dd55b464b8b90b 100644 (file)
 /**
  * Main draw call for ManipulatorGeomInfo data
  */
-void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const bool select, const float color[4])
+void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const bool UNUSED(select), const float color[4])
 {
        /* TODO store the Batches inside the ManipulatorGeomInfo and updated it when geom changes
         * So we don't need to re-created and discard it every time */
 
-       const bool use_lighting = true || (!select && ((U.manipulator_flag & USER_MANIPULATOR_SHADED) != 0));
        Gwn_VertBuf *vbo;
        Gwn_IndexBuf *el;
        Gwn_Batch *batch;
@@ -72,11 +71,6 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo
 
        Gwn_VertFormat format = {0};
        uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
-       uint nor_id;
-
-       if (use_lighting) {
-               nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
-       }
 
        /* Elements */
        GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, info->ntris, info->nverts);
@@ -91,11 +85,6 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo
 
        GWN_vertbuf_attr_fill(vbo, pos_id, info->verts);
 
-       if (use_lighting) {
-               /* Normals are expected to be smooth. */
-               GWN_vertbuf_attr_fill(vbo, nor_id, info->normals);
-       }
-
        batch = GWN_batch_create_ex(GWN_PRIM_TRIS, vbo, el, GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX);
        GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR);
 
index a5bcef7ed5e3805b5b3853cea20ee10b5cd2313a..0430a12bc99bfe5d1773e6e8e9de73626674c7ba 100644 (file)
@@ -163,16 +163,10 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
 
                        const float len = 0.25f;
                        const float width = 0.06f;
-                       const bool use_lighting = (!select && ((U.manipulator_flag & USER_MANIPULATOR_SHADED) != 0));
 
                        /* translate to line end */
                        gpuTranslate3f(0.0f, 0.0f, arrow_length);
 
-                       if (use_lighting) {
-                               immUnbindProgram();
-                               immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
-                       }
-
                        imm_draw_circle_fill_3d(pos, 0.0, 0.0, width, 8);
                        imm_draw_cylinder_fill_3d(pos, width, 0.0, len, 8, 1);
                }
index bfeccfe33a40a32cf167a0cee32ecde48a2458c7..f1704972e816407620e5518de91453a0934fb4e7 100644 (file)
@@ -379,7 +379,7 @@ static int add_primitive_cube_manipulator_invoke(bContext *C, wmOperator *op, co
        int ret = add_primitive_cube_manipulator_exec(C, op);
        if (ret & OPERATOR_FINISHED) {
                /* Setup manipulators */
-               if (v3d && (v3d->twflag & V3D_MANIPULATOR_DRAW)) {
+               if (v3d && ((v3d->mpr_flag & V3D_MANIPULATOR_HIDE) == 0)) {
                        ARegion *ar = CTX_wm_region(C);
                        wmManipulatorMap *mmap = ar->manipulator_map;
                        wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find("MESH_WGT_add_bounds", false);
index 6c5133c93c82688875629448560ffb7a8dd89cc9..2b6f8914a02356dd5e7a87649a97addc00de3c1e 100644 (file)
@@ -95,7 +95,7 @@ typedef struct {
        /* modal only */
        float mcenter[2];
        void *draw_handle_pixel;
-       short twflag;
+       short mpr_flag;
        short value_mode;  /* Which value does mouse movement and numeric input affect? */
        float segments;     /* Segments as float so smooth mouse pan works in small increments */
 } BevelData;
@@ -201,8 +201,8 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
                G.moving = G_TRANSFORM_EDIT;
 
                if (v3d) {
-                       opdata->twflag = v3d->twflag;
-                       v3d->twflag = 0;
+                       opdata->mpr_flag = v3d->mpr_flag;
+                       v3d->mpr_flag = 0;
                }
        }
 
@@ -284,7 +284,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
                }
                ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel);
                if (v3d) {
-                       v3d->twflag = opdata->twflag;
+                       v3d->mpr_flag = opdata->mpr_flag;
                }
                G.moving = 0;
        }
index 568983e47ee55396aacfc2dc04d4e10e2eb29412..ee8adeb2c52c7fbb24c4b1e5c2fec2b5b38924b9 100644 (file)
@@ -70,7 +70,7 @@ typedef struct {
        /* modal only */
        BMBackup mesh_backup;
        bool is_first;
-       short twflag;
+       short mpr_flag;
 } BisectData;
 
 static bool mesh_bisect_interactive_calc(
@@ -156,8 +156,8 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
                /* misc other vars */
                G.moving = G_TRANSFORM_EDIT;
-               opdata->twflag = v3d->twflag;
-               v3d->twflag = 0;
+               opdata->mpr_flag = v3d->mpr_flag;
+               v3d->mpr_flag = 0;
 
                /* initialize modal callout */
                ED_workspace_status_text(C, IFACE_("LMB: Click and drag to draw cut line"));
@@ -169,7 +169,7 @@ static void edbm_bisect_exit(bContext *C, BisectData *opdata)
 {
        View3D *v3d = CTX_wm_view3d(C);
        EDBM_redo_state_free(&opdata->mesh_backup, NULL, false);
-       v3d->twflag = opdata->twflag;
+       v3d->mpr_flag = opdata->mpr_flag;
        G.moving = 0;
 }
 
@@ -199,7 +199,7 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event)
                /* Setup manipulators */
                {
                        View3D *v3d = CTX_wm_view3d(C);
-                       if (v3d && (v3d->twflag & V3D_MANIPULATOR_DRAW)) {
+                       if (v3d && (v3d->mpr_flag & V3D_MANIPULATOR_HIDE) == 0) {
                                WM_manipulator_group_type_ensure("MESH_WGT_bisect");
                        }
                }
index f98d7dacac8bd0f6b3c304c977476fb10fe43a6e..5c1b9ccc178de857d2025da31b4fbc2ffca0dc19 100644 (file)
@@ -511,7 +511,7 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
 #ifdef USE_MANIPULATOR
        if (ret & OPERATOR_FINISHED) {
                /* Setup manipulators */
-               if (v3d && (v3d->twflag & V3D_MANIPULATOR_DRAW)) {
+               if (v3d && ((v3d->mpr_flag & V3D_MANIPULATOR_HIDE) == 0)) {
                        WM_manipulator_group_type_ensure("MESH_WGT_spin");
                }
        }
index 8758fa66a1450c1836477d6eb7e48b3900ce4d56..251e328ee846c49a86914c2c7b7e3a170d619d41 100644 (file)
@@ -78,7 +78,7 @@ typedef struct {
        /* modal only */
        float mcenter[2];
        void *draw_handle_pixel;
-       short twflag;
+       short mpr_flag;
 } InsetData;
 
 
@@ -173,8 +173,8 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
                        ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
                G.moving = G_TRANSFORM_EDIT;
                if (v3d) {
-                       opdata->twflag = v3d->twflag;
-                       v3d->twflag = 0;
+                       opdata->mpr_flag = v3d->mpr_flag;
+                       v3d->mpr_flag = 0;
                }
        }
 
@@ -196,7 +196,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op)
                }
                ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel);
                if (v3d) {
-                       v3d->twflag = opdata->twflag;
+                       v3d->mpr_flag = opdata->mpr_flag;
                }
                G.moving = 0;
        }
index 9aaced3e583ee9bb3740aab8f7a81ab75f29660e..39315dcd64f4bd7db287dea9842a67696690b79b 100644 (file)
@@ -348,8 +348,6 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
        v3d->near = 0.01f;
        v3d->far = 1000.0f;
 
-       v3d->twflag |= U.manipulator_flag & V3D_MANIPULATOR_DRAW;
-
        v3d->bundle_size = 0.2f;
        v3d->bundle_drawtype = OB_PLAINAXES;
 
index 2c7325866066658510087dda0b548325ec603c61..62e9d4ee3bf7923e03678208a0bea92513310f62 100644 (file)
@@ -1203,11 +1203,14 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int UNUSED(of
 
        BLF_batch_draw_begin();
 
-       if (((U.uiflag & USER_SHOW_ROTVIEWICON) != 0) &&
-           ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
+       if ((U.uiflag & USER_SHOW_MANIPULATOR_AXIS) ||
+           (v3d->flag2 & V3D_RENDER_OVERRIDE) ||
            /* No need to display manipulator and this info. */
-           ((U.manipulator_flag & USER_MANIPULATOR_DRAW_NAVIGATE) == 0))
+           (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_NAVIGATE)))
        {
+               /* pass */
+       }
+       else {
                draw_view_axis(rv3d, &rect);
        }
 
index abbd6c888b267d6b61092b2e8319870f3004d1b2..17dc4d8eb4a131dd4c877b5f8ec9f902df6ea614 100644 (file)
@@ -135,7 +135,12 @@ static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmManipulatorGro
                if (arm->drawtype == ARM_B_BONE) {
                        if (arm->act_bone && arm->act_bone->segments > 1) {
                                View3D *v3d = CTX_wm_view3d(C);
-                               if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+                               if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+                                   (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT)))
+                               {
+                                       /* pass */
+                               }
+                               else {
                                        return true;
                                }
                        }
index 023e16c070eaaec0e485bde4fe652f2986c2c0f9..29f380c63348394d6e624aac41de5223661f94e2 100644 (file)
@@ -64,7 +64,9 @@ struct CameraWidgetGroup {
 static bool WIDGETGROUP_camera_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
        View3D *v3d = CTX_wm_view3d(C);
-       if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+       if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+           (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT)))
+       {
                return false;
        }
 
@@ -358,7 +360,9 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmManipulatorGroupTy
        }
 
        View3D *v3d = CTX_wm_view3d(C);
-       if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+       if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+           (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT)))
+       {
                return false;
        }
 
index fc15ec593f5a90b244a40dcab8fe5b15f7b6e404..16424c39bb85e30d5eda409f543642f22f74e76d 100644 (file)
@@ -107,7 +107,10 @@ static void manipulator_empty_image_prop_matrix_set(
 static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
        View3D *v3d = CTX_wm_view3d(C);
-       if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+
+       if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+           (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT)))
+       {
                return false;
        }
 
index b42f49e6d1cf7e9d9be2e284f6aca0cd0cdecf23..e4535004c8f3b1f57a4d5fd3593dc838f002a5bb 100644 (file)
 static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
        View3D *v3d = CTX_wm_view3d(C);
-       if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+
+       if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+           (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT)))
+       {
                return false;
        }
 
index 0e1015a66f179822736c1a8140efe53e5f875087..39e908ec99d1178925dea3637070cc49f2514314 100644 (file)
@@ -55,7 +55,9 @@
 static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
        View3D *v3d = CTX_wm_view3d(C);
-       if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+       if ((v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+           (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT)))
+       {
                return false;
        }
 
index 9eb3ca89c55ed2722a103b9266e3aadc75a142d3..465faf70fcd04cd191902c3f52e2b9ddd96517d5 100644 (file)
@@ -179,14 +179,13 @@ struct NavigateWidgetGroup {
 static bool WIDGETGROUP_navigate_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
        View3D *v3d = CTX_wm_view3d(C);
-       if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+       if (((U.uiflag & USER_SHOW_MANIPULATOR_AXIS) == 0) ||
+           (v3d->flag2 & V3D_RENDER_OVERRIDE) ||
+           (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_NAVIGATE)))
+       {
                return false;
        }
-
-       if (U.manipulator_flag & USER_MANIPULATOR_DRAW_NAVIGATE) {
-               return true;
-       }
-       return false;
+       return true;
 
 }
 
index 18b63151c8e82198e331c484ada588197bcb6ddc..fb9cf917701729727c59faa868cb81ed55bead44 100644 (file)
@@ -541,7 +541,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
 #else
        kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0);
 #endif
-       RNA_string_set(kmi->ptr, "data_path", "space_data.show_manipulator");
+       RNA_string_set(kmi->ptr, "data_path", "space_data.show_manipulator_tool");
 
        transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D);
 
index 6685f78524789a85c9ed4eabdc68d8adb2b5a7f5..b022d5a30586e44dd67ec5b5da01dfdfc1738219 100644 (file)
@@ -505,7 +505,7 @@ typedef struct TransInfo {
 
        short           current_orientation;
        TransformOrientation *custom_orientation; /* this gets used when current_orientation is V3D_MANIP_CUSTOM */
-       short           twflag;                 /* backup from view3d, to restore on end */
+       short           mpr_flag;                       /* backup from view3d, to restore on end */
 
        short           prop_mode;
 
index 3f71915a690c4793bd862e82414dceb5e1b8f128..303fa26bd4a5547795e14b2b4c12cea34d4e8eae 100644 (file)
@@ -1350,8 +1350,8 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
 
                /* turn manipulator off during transform */
                if (t->flag & T_MODAL) {
-                       t->twflag = v3d->twflag;
-                       v3d->twflag = 0;
+                       t->mpr_flag = v3d->mpr_flag;
+                       v3d->mpr_flag = 0;
                }
 
                if (t->scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) {
@@ -1690,7 +1690,7 @@ void postTrans(bContext *C, TransInfo *t)
                View3D *v3d = t->sa->spacedata.first;
                /* restore manipulator */
                if (t->flag & T_MODAL) {
-                       v3d->twflag = t->twflag;
+                       v3d->mpr_flag = t->mpr_flag;
                }
        }
 
index 94bd1c921306b440d3549b28da5e786fbd217c25..fa56e8d10bec6db414d49bd318308fa85b3fd329 100644 (file)
@@ -1596,6 +1596,11 @@ static bool WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmMani
                WM_manipulator_group_type_unlink_delayed_ptr(wgt);
                return false;
        }
+
+       View3D *v3d = CTX_wm_view3d(C);
+       if (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_TOOL)) {
+               return false;
+       }
        return true;
 }
 
index 1e199904356dec67b2d7f03a9ce7fd4bebe7ec96..45c6b9634f4ef9f56bfa964a8c513011afa3df73 100644 (file)
@@ -751,7 +751,7 @@ typedef enum eUserpref_UI_Flag {
        USER_ORBIT_SELECTION    = (1 << 14),
        USER_DEPTH_NAVIGATE     = (1 << 15),
        USER_HIDE_DOT                   = (1 << 16),
-       USER_SHOW_ROTVIEWICON   = (1 << 17),
+       USER_SHOW_MANIPULATOR_AXIS      = (1 << 17),
        USER_SHOW_VIEWPORTNAME  = (1 << 18),
        USER_CAM_LOCK_NO_PARENT = (1 << 19),
        USER_ZOOM_TO_MOUSEPOS   = (1 << 20),
@@ -876,8 +876,6 @@ typedef enum eGP_UserdefSettings {
 
 enum {
        USER_MANIPULATOR_DRAW            = (1 << 0),
-       USER_MANIPULATOR_DRAW_NAVIGATE   = (1 << 1),
-       USER_MANIPULATOR_SHADED          = (1 << 8),
 };
 
 /* Color Picker Types.
index b21d681428929464edd8ede6d1a746bf5f95bbe7..b02661754bdd2ef34816bceb2e697f89c43d9981 100644 (file)
@@ -237,7 +237,7 @@ typedef struct View3D {
        char gridflag;
 
        /* transform manipulator info */
-       char twtype, _pad5, twflag;
+       char _pad5[2], mpr_flag;
 
        short flag3;
 
@@ -450,9 +450,13 @@ enum {
 #define V3D_MANIP_CURSOR               5
 #define V3D_MANIP_CUSTOM               1024
 
-/* View3d->twflag (also) */
+/* View3d.mpr_flag (also) */
 enum {
-       V3D_MANIPULATOR_DRAW        = (1 << 0),
+       /** All manipulators. */
+       V3D_MANIPULATOR_HIDE                = (1 << 0),
+       V3D_MANIPULATOR_HIDE_NAVIGATE       = (1 << 1),
+       V3D_MANIPULATOR_HIDE_CONTEXT        = (1 << 2),
+       V3D_MANIPULATOR_HIDE_TOOL           = (1 << 3),
 };
 
 #define RV3D_CAMZOOM_MIN -30
index 752972b0797588c16511d9789b6c4a34bc9e7cb0..67c345914dcbc886f31c3329edf68468b9eddaec 100644 (file)
@@ -2926,8 +2926,23 @@ static void rna_def_space_view3d(BlenderRNA *brna)
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
        prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_MANIPULATOR_DRAW);
-       RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms");
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_MANIPULATOR_HIDE);
+       RNA_def_property_ui_text(prop, "Manipulator", "Show manipulators of all types");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+       prop = RNA_def_property(srna, "show_manipulator_navigate", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_MANIPULATOR_HIDE_NAVIGATE);
+       RNA_def_property_ui_text(prop, "Navigate Manipulator", "");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+       prop = RNA_def_property(srna, "show_manipulator_context", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_MANIPULATOR_HIDE_CONTEXT);
+       RNA_def_property_ui_text(prop, "Context Manipulator", "Context sensitive manipulators for the active item");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+       prop = RNA_def_property(srna, "show_manipulator_tool", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_MANIPULATOR_HIDE_TOOL);
+       RNA_def_property_ui_text(prop, "Tool Manipulator", "Active tool manipulator");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
        prop = RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
index aa6eb4c4dc2048d573908fe6d34f593bfcc711bc..517e4047515106099a5e96431ae1531d9f77de35 100644 (file)
@@ -165,36 +165,6 @@ static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene
        UI_reinit_font();
 }
 
-static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr)
-{
-       UserDef *userdef = (UserDef *)ptr->data;
-
-       /* lame, loop over all views and set */
-       bScreen *sc;
-       ScrArea *sa;
-       SpaceLink *sl;
-
-       /* from scene copy to the other views */
-       for (sc = bmain->screen.first; sc; sc = sc->id.next) {
-               for (sa = sc->areabase.first; sa; sa = sa->next) {
-                       for (sl = sa->spacedata.first; sl; sl = sl->next) {
-                               if (sl->spacetype == SPACE_VIEW3D) {
-                                       View3D *v3d = (View3D *)sl;
-                                       if (userdef->manipulator_flag & USER_MANIPULATOR_DRAW) {
-                                               v3d->twflag |= V3D_MANIPULATOR_DRAW;
-                                       }
-                                       else {
-                                               v3d->twflag &= ~V3D_MANIPULATOR_DRAW;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       rna_userdef_update(bmain, scene, ptr);
-}
-
-
 static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
        UserDef *userdef = (UserDef *)ptr->data;
@@ -3733,10 +3703,17 @@ static void rna_def_userdef_view(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Rotate Around Selection", "Use selection as the pivot point");
 
        /* mini axis */
-       prop = RNA_def_property(srna, "show_mini_axis", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_ROTVIEWICON);
-       RNA_def_property_ui_text(prop, "Show Mini Axes",
-                                "Show a small rotating 3D axes in the bottom left corner of the 3D View");
+       static const EnumPropertyItem mini_axis_type_items[] = {
+               {0, "MINIMAL", 0, "Simple Axis", ""},
+               {USER_SHOW_MANIPULATOR_AXIS, "MANIPULATOR", 0, "Interactive Navigation", ""},
+               {0, NULL, 0, NULL, NULL}
+       };
+
+       prop = RNA_def_property(srna, "mini_axis_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, mini_axis_type_items);
+       RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
+       RNA_def_property_ui_text(prop, "Mini Axes Type",
+                                "Show a small rotating 3D axes in the top right corner of the 3D View");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        prop = RNA_def_property(srna, "mini_axis_size", PROP_INT, PROP_NONE);
@@ -3764,21 +3741,8 @@ static void rna_def_userdef_view(BlenderRNA *brna)
        /* 3D transform widget */
        prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "manipulator_flag", USER_MANIPULATOR_DRAW);
-       RNA_def_property_ui_text(prop, "Manipulator", "Use 3D transform manipulator");
-       RNA_def_property_update(prop, 0, "rna_userdef_show_manipulator_update");
-
-       prop = RNA_def_property(srna, "show_manipulator_navigate", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "manipulator_flag", USER_MANIPULATOR_DRAW_NAVIGATE);
-       RNA_def_property_ui_text(prop, "Navigate Manipulator", "Use 3D navigation manipulator");
-       RNA_def_property_update(prop, 0, "rna_userdef_show_manipulator_update");
-
-       /* TODO, expose once it's working. */
-#if 0
-       prop = RNA_def_property(srna, "show_manipulator_shaded", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "manipulator_flag", USER_MANIPULATOR_SHADED);
-       RNA_def_property_ui_text(prop, "Manipulator Shaded", "Use 3D transform manipulator");
+       RNA_def_property_ui_text(prop, "Manipulators", "Use transform manipulators by default");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
-#endif
 
        prop = RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_PIXEL);
        RNA_def_property_int_sdna(prop, NULL, "manipulator_size");