diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-11 11:38:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-11 11:49:18 +0300 |
commit | c17611af951e46fb82bf43d7449240f2f829b78f (patch) | |
tree | 51992764ea21b663b68c6aabb11fea843d115474 /source/blender | |
parent | 64d40c82c324f7029e27ff59a4b1ca3200cddbef (diff) |
Manipulator: changes for overlay options
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
Diffstat (limited to 'source/blender')
26 files changed, 99 insertions, 114 deletions
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index d43000e859e..bd7334516ca 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -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; diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 30f7742fd35..be067b0464d 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -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(); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index aa71c31c541..c279c949e62 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -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; } } diff --git a/source/blender/editors/manipulator_library/manipulator_draw_utils.c b/source/blender/editors/manipulator_library/manipulator_draw_utils.c index a0b226b7502..80181c57115 100644 --- a/source/blender/editors/manipulator_library/manipulator_draw_utils.c +++ b/source/blender/editors/manipulator_library/manipulator_draw_utils.c @@ -59,12 +59,11 @@ /** * 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); diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c index a5bcef7ed5e..0430a12bc99 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c @@ -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); } diff --git a/source/blender/editors/mesh/editmesh_add_manipulator.c b/source/blender/editors/mesh/editmesh_add_manipulator.c index bfeccfe33a4..f1704972e81 100644 --- a/source/blender/editors/mesh/editmesh_add_manipulator.c +++ b/source/blender/editors/mesh/editmesh_add_manipulator.c @@ -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); diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 6c5133c93c8..2b6f8914a02 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -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; } diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index 568983e47ee..ee8adeb2c52 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -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"); } } diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c index f98d7dacac8..5c1b9ccc178 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin.c @@ -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"); } } diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 8758fa66a14..251e328ee84 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -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; } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 9aaced3e583..39315dcd64f 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -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; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 2c732586606..62e9d4ee3bf 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -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); } diff --git a/source/blender/editors/space_view3d/view3d_manipulator_armature.c b/source/blender/editors/space_view3d/view3d_manipulator_armature.c index abbd6c888b2..17dc4d8eb4a 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_armature.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_armature.c @@ -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; } } diff --git a/source/blender/editors/space_view3d/view3d_manipulator_camera.c b/source/blender/editors/space_view3d/view3d_manipulator_camera.c index 023e16c070e..29f380c6334 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_camera.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_camera.c @@ -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; } diff --git a/source/blender/editors/space_view3d/view3d_manipulator_empty.c b/source/blender/editors/space_view3d/view3d_manipulator_empty.c index fc15ec593f5..16424c39bb8 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_empty.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_empty.c @@ -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; } diff --git a/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c b/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c index b42f49e6d1c..e4535004c8f 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c @@ -55,7 +55,10 @@ 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; } diff --git a/source/blender/editors/space_view3d/view3d_manipulator_lamp.c b/source/blender/editors/space_view3d/view3d_manipulator_lamp.c index 0e1015a66f1..39e908ec99d 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_lamp.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_lamp.c @@ -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; } diff --git a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c index 9eb3ca89c55..465faf70fcd 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c @@ -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; } diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 18b63151c8e..fb9cf917701 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -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); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 6685f785247..b022d5a3058 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -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; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 3f71915a690..303fa26bd4a 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -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; } } diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c index 94bd1c92130..fa56e8d10be 100644 --- a/source/blender/editors/transform/transform_manipulator_3d.c +++ b/source/blender/editors/transform/transform_manipulator_3d.c @@ -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; } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 1e199904356..45c6b9634f4 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -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. diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index b21d6814289..b02661754bd 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -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 diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 752972b0797..67c345914dc 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -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); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index aa6eb4c4dc2..517e4047515 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -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"); |