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.
This commit is contained in:
Campbell Barton 2018-06-05 14:24:58 +02:00
parent 24bd483ee1
commit 2891fb645b
9 changed files with 55 additions and 20 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}
}
}
}

View File

@ -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. */

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);