UI: option not to show screen splitting widgets

Request for simplified Blender template,
this may be extended to limit access to other UI changes
that could be pressed by accident.
This commit is contained in:
Campbell Barton 2018-01-11 16:08:55 +11:00
parent 9d62e6e782
commit 717090f40e
6 changed files with 36 additions and 4 deletions

View File

@ -316,6 +316,9 @@ class USERPREF_PT_interface(Panel):
col.separator()
col.separator()
col.label(text="Screen:")
col.prop(view, "show_layout_ui")
col.prop(view, "show_splash")

View File

@ -258,6 +258,16 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
SWAP(ListBase, userdef_a->id, userdef_b->id); \
} ((void)0)
#define FLAG_SWAP(id, ty, flags) { \
CHECK_TYPE(&(userdef_a->id), ty *); \
const ty f = flags; \
const ty a = userdef_a->id; \
const ty b = userdef_b->id; \
userdef_a->id = (userdef_a->id & ~f) | (b & f); \
userdef_b->id = (userdef_b->id & ~f) | (a & f); \
} ((void)0)
LIST_SWAP(uistyles);
LIST_SWAP(uifonts);
LIST_SWAP(themes);
@ -270,9 +280,11 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
DATA_SWAP(font_path_ui_mono);
DATA_SWAP(keyconfigstr);
#undef SWAP_TYPELESS
#undef LIST_SWAP
FLAG_SWAP(uiflag, int, USER_LOCK_UI_LAYOUT);
#undef DATA_SWAP
#undef LIST_SWAP
#undef FLAG_SWAP
}
void BKE_blender_userdef_app_template_data_set(UserDef *userdef)

View File

@ -2765,7 +2765,7 @@ void init_userdef_do_versions(void)
USER_FLAG_DEPRECATED_6 | USER_FLAG_DEPRECATED_7 |
USER_FLAG_DEPRECATED_9 | USER_FLAG_DEPRECATED_10);
U.uiflag &= ~(
USER_UIFLAG_DEPRECATED_7);
USER_LOCK_UI_LAYOUT);
U.transopts &= ~(
USER_TR_DEPRECATED_2 | USER_TR_DEPRECATED_3 | USER_TR_DEPRECATED_4 |
USER_TR_DEPRECATED_6 | USER_TR_DEPRECATED_7);

View File

@ -666,6 +666,10 @@ static void area_azone_initialize(wmWindow *win, bScreen *screen, ScrArea *sa)
return;
}
if (U.uiflag & USER_LOCK_UI_LAYOUT) {
return;
}
/* can't click on bottom corners on OS X, already used for resizing */
#ifdef __APPLE__
if (!(sa->totrct.xmin == 0 && sa->totrct.ymin == 0) || WM_window_is_fullscreen(win))

View File

@ -668,7 +668,9 @@ typedef enum eUserpref_UI_Flag {
USER_DRAWVIEWINFO = (1 << 4),
USER_PLAINMENUS = (1 << 5),
USER_LOCK_CURSOR_ADJUST = (1 << 6),
USER_UIFLAG_DEPRECATED_7 = (1 << 7), /* cleared */
/* Avoid accidentally adjusting the layout
* (exact behavior may change based on whats considered reasonable to lock down). */
USER_LOCK_UI_LAYOUT = (1 << 7),
USER_ALLWINCODECS = (1 << 8),
USER_MENUOPENAUTO = (1 << 9),
USER_ZBUF_CURSOR = (1 << 10),

View File

@ -155,6 +155,12 @@ static void rna_userdef_dpi_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
}
static void rna_userdef_update_ui(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
WM_main_add_notifier(NC_WINDOW, NULL);
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
}
static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
BLF_cache_clear();
@ -3389,6 +3395,11 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_SPLASH_DISABLE);
RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup");
prop = RNA_def_property(srna, "show_layout_ui", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_LOCK_UI_LAYOUT);
RNA_def_property_ui_text(prop, "Show Layout Widgets", "Show screen layout editing UI");
RNA_def_property_update(prop, 0, "rna_userdef_update_ui");
prop = RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_FPS);
RNA_def_property_ui_text(prop, "Show Playback FPS",