From 2891fb645b95ca45ee5ace1d51221e5b3ea52dae Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Jun 2018 14:24:58 +0200 Subject: 3D View: disable manipulators & text w/o overlay Manipulators which aren't explicitly activated via tools are now hidden. Tool manipulators are kept because it doesn't make sense to interact with a tool with hidden manipulators. --- source/blender/draw/intern/draw_manager.c | 4 +++- source/blender/editors/space_view3d/view3d_draw.c | 8 ++++++-- .../editors/space_view3d/view3d_manipulator_armature.c | 5 ++++- .../editors/space_view3d/view3d_manipulator_camera.c | 13 +++++++++++-- .../editors/space_view3d/view3d_manipulator_empty.c | 5 +++++ .../editors/space_view3d/view3d_manipulator_forcefield.c | 5 +++++ .../editors/space_view3d/view3d_manipulator_lamp.c | 16 +++++++++++++++- .../editors/space_view3d/view3d_manipulator_navigate.c | 7 ++++++- .../blender/editors/transform/transform_manipulator_3d.c | 12 ------------ 9 files changed, 55 insertions(+), 20 deletions(-) (limited to 'source') diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 3dadb9f9daa..76712c4146e 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1233,7 +1233,9 @@ void DRW_draw_view(const bContext *C) /* Reset before using it. */ drw_state_prepare_clean_for_draw(&DST); - DST.options.draw_text = (v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) != 0; + DST.options.draw_text = ( + (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0 && + (v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) != 0); DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, C); } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 5cd36cce31c..e199e84029e 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1203,11 +1203,15 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset) BLF_batch_draw_begin(); - if (U.uiflag & USER_SHOW_ROTVIEWICON) { + if (((U.uiflag & USER_SHOW_ROTVIEWICON) != 0) && + (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) + { draw_view_axis(rv3d, &rect); } - if ((v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0) { + if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0 && + (v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0) + { if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) { ED_scene_draw_fps(scene, &rect); } diff --git a/source/blender/editors/space_view3d/view3d_manipulator_armature.c b/source/blender/editors/space_view3d/view3d_manipulator_armature.c index 5d3d88ff2a2..abbd6c888b2 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_armature.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_armature.c @@ -134,7 +134,10 @@ static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmManipulatorGro const bArmature *arm = ob->data; if (arm->drawtype == ARM_B_BONE) { if (arm->act_bone && arm->act_bone->segments > 1) { - return true; + View3D *v3d = CTX_wm_view3d(C); + if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { + 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 b680818dc14..00b47a516c1 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_camera.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_camera.c @@ -63,12 +63,17 @@ 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) { + return false; + } + Object *ob = CTX_data_active_object(C); if (ob && ob->type == OB_CAMERA) { Camera *camera = ob->data; /* TODO: support overrides. */ if (camera->id.lib == NULL) { - return true; + return false; } } return false; @@ -352,9 +357,13 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmManipulatorGroupTy } } + View3D *v3d = CTX_wm_view3d(C); + if (v3d->flag2 & V3D_RENDER_OVERRIDE) { + return false; + } + ARegion *ar = CTX_wm_region(C); RegionView3D *rv3d = ar->regiondata; - View3D *v3d = CTX_wm_view3d(C); if (rv3d->persp == RV3D_CAMOB) { if (scene->r.mode & R_BORDER) { /* TODO: support overrides. */ diff --git a/source/blender/editors/space_view3d/view3d_manipulator_empty.c b/source/blender/editors/space_view3d/view3d_manipulator_empty.c index 1d56c5ee7f4..75e4a9e3314 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_empty.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_empty.c @@ -106,6 +106,11 @@ 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) { + return false; + } + Object *ob = CTX_data_active_object(C); if (ob && ob->type == OB_EMPTY) { diff --git a/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c b/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c index e76be448be4..2a1fdee8e8a 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c @@ -54,6 +54,11 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) { + View3D *v3d = CTX_wm_view3d(C); + if (v3d->flag2 & V3D_RENDER_OVERRIDE) { + return false; + } + Object *ob = CTX_data_active_object(C); return (ob && ob->pd && ob->pd->forcefield); diff --git a/source/blender/editors/space_view3d/view3d_manipulator_lamp.c b/source/blender/editors/space_view3d/view3d_manipulator_lamp.c index 88c36fc2c0b..01c38cfd899 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_lamp.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_lamp.c @@ -54,6 +54,11 @@ static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) { + View3D *v3d = CTX_wm_view3d(C); + if (v3d->flag2 & V3D_RENDER_OVERRIDE) { + return false; + } + Object *ob = CTX_data_active_object(C); if (ob && ob->type == OB_LAMP) { @@ -151,8 +156,12 @@ static void manipulator_area_lamp_prop_matrix_set( static bool WIDGETGROUP_lamp_area_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) { - Object *ob = CTX_data_active_object(C); + View3D *v3d = CTX_wm_view3d(C); + if (v3d->flag2 & V3D_RENDER_OVERRIDE) { + return false; + } + Object *ob = CTX_data_active_object(C); if (ob && ob->type == OB_LAMP) { Lamp *la = ob->data; return (la->type == LA_AREA); @@ -226,6 +235,11 @@ void VIEW3D_WGT_lamp_area(wmManipulatorGroupType *wgt) static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) { + View3D *v3d = CTX_wm_view3d(C); + if (v3d->flag2 & V3D_RENDER_OVERRIDE) { + return false; + } + Object *ob = CTX_data_active_object(C); if (ob != NULL) { diff --git a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c index d86c6595bfa..c869e23d552 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c @@ -176,8 +176,13 @@ struct NavigateWidgetGroup { int region_size[2]; }; -static bool WIDGETGROUP_navigate_poll(const bContext *UNUSED(C), wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_navigate_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) { + View3D *v3d = CTX_wm_view3d(C); + if (v3d->flag2 & V3D_RENDER_OVERRIDE) { + return false; + } + if (U.manipulator_flag & USER_MANIPULATOR_DRAW_NAVIGATE) { return true; } diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c index d5fc3fa3ad7..b6782470f96 100644 --- a/source/blender/editors/transform/transform_manipulator_3d.c +++ b/source/blender/editors/transform/transform_manipulator_3d.c @@ -1538,12 +1538,6 @@ static void WIDGETGROUP_manipulator_draw_prepare(const bContext *C, wmManipulato static bool WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmManipulatorGroupType *wgt) { /* it's a given we only use this in 3D view */ - ScrArea *sa = CTX_wm_area(C); - View3D *v3d = sa->spacedata.first; - if (v3d && ((v3d->twflag & V3D_MANIPULATOR_DRAW)) == 0) { - return false; - } - bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); if ((tref_rt == NULL) || !STREQ(wgt->idname, tref_rt->manipulator_group)) @@ -1584,12 +1578,6 @@ struct XFormCageWidgetGroup { static bool WIDGETGROUP_xform_cage_poll(const bContext *C, wmManipulatorGroupType *wgt) { - ScrArea *sa = CTX_wm_area(C); - View3D *v3d = sa->spacedata.first; - if (v3d && ((v3d->twflag & V3D_MANIPULATOR_DRAW)) == 0) { - return false; - } - bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); if (!STREQ(wgt->idname, tref_rt->manipulator_group)) { WM_manipulator_group_type_unlink_delayed_ptr(wgt); -- cgit v1.2.3