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/editors | |
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/editors')
20 files changed, 61 insertions, 56 deletions
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; } |