Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-18 18:44:14 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-18 20:38:20 +0300
commitb49abbec5fff29978d04572b9ac341c8a50b84cf (patch)
tree813371ef029e1b06f7ff57406f5629e385030e28 /source
parent1c815e0826518adc69bc3888e18f52991e8774f7 (diff)
Splash: add first time setup and templates to splash screen.
The first time setup screen only has the interaction preset currently, some more work is needed to be able to set e.g. the language or compute device here as in the mockups. The splash screen stayed the same for now, to make room for the templates most of the links are now in the Help menu. If there are no recent files yet the links still show. The splash screen buttons implementation was fully moved to Python, in the WM_MT_splash menu.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/interface/interface_layout.c6
-rw-r--r--source/blender/editors/interface/interface_templates.c20
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c6
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c3
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c84
7 files changed, 44 insertions, 83 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 4e0a0711473..7936ace5c45 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1130,6 +1130,8 @@ void uiTemplateMovieclipInformation(struct uiLayout *layout, struct PointerRNA *
void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname);
void uiTemplateColormanagedViewSettings(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname);
+int uiTemplateRecentFiles(struct uiLayout *layout, int rows);
+
/* items */
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname);
void uiItemEnumO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, const char *propname, int value);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 96f13aad442..76e6f64a80c 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1216,8 +1216,12 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
BLI_assert(block->flag & (UI_BLOCK_LOOP | UI_BLOCK_SHOW_SHORTCUT_ALWAYS));
/* only do it before bounding */
- if (block->rect.xmin != block->rect.xmax)
+ if (block->rect.xmin != block->rect.xmax) {
+ return;
+ }
+ if (STREQ(block->name, "splash")) {
return;
+ }
if (block->flag & UI_BLOCK_RADIAL) {
for (but = block->buttons.first; but; but = but->next) {
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 91756f9ae27..c19dc770fb9 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2314,11 +2314,11 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
w = ui_text_icon_width(layout, name, icon, 0);
if (icon && name[0])
- but = uiDefIconTextBut(block, UI_BTYPE_LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ but = uiDefIconTextBut(block, UI_BTYPE_LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "AAAAAAAa");
else if (icon)
- but = uiDefIconBut(block, UI_BTYPE_LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ but = uiDefIconBut(block, UI_BTYPE_LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "BBBBBBBBBBBB");
else
- but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "CCCCCCCCCCCCC");
/* to compensate for string size padding in ui_text_icon_width,
* make text aligned right if the layout is aligned right.
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index b7a553d1bd5..6dab9807574 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -50,6 +50,7 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_fnmatch.h"
+#include "BLI_path_util.h"
#include "BLI_timecode.h"
#include "BLF_api.h"
@@ -89,6 +90,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "BLO_readfile.h"
+
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "interface_intern.h"
@@ -4963,3 +4966,20 @@ void uiTemplateCacheFile(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
uiItemR(row, &fileptr, "up_axis", 0, "Up Axis", ICON_NONE);
#endif
}
+
+/******************************* Recent Files *******************************/
+
+int uiTemplateRecentFiles(uiLayout *layout, int rows)
+{
+ const RecentFile *recent;
+ int i;
+
+ for (recent = G.recent_files.first, i = 0; (i < rows) && (recent); recent = recent->next, i++) {
+ const char *filename = BLI_path_basename(recent->filepath);
+ uiItemStringO(layout, filename,
+ BLO_has_bfile_extension(filename) ? ICON_FILE_BLEND : ICON_FILE_BACKUP,
+ "WM_OT_open_mainfile", "filepath", recent->filepath);
+ }
+
+ return i;
+}
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 694d44a87e8..f340b471455 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -1103,6 +1103,12 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_ui_description(func, "Item(s). User interface for selecting cache files and their source paths");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
+
+ func = RNA_def_function(srna, "template_recent_files", "uiTemplateRecentFiles");
+ RNA_def_function_ui_description(func, "Show list of recently saved .blend files");
+ RNA_def_int(func, "rows", 5, 1, INT_MAX, "", "Maximum number of items to show", 1, INT_MAX);
+ parm = RNA_def_int(func, "found", 0, 0, INT_MAX, "", "Number of items drawn", 0, INT_MAX);
+ RNA_def_function_return(func, parm);
}
#endif
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index d9c8028c9bb..1bd441b7a97 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3160,6 +3160,9 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
+ /* Close any popups, like when opening a file browser from the splash. */
+ UI_popup_handlers_remove_all(C, &win->modalhandlers);
+
/* only allow 1 file selector open per window */
for (handler = win->modalhandlers.first; handler; handler = handlernext) {
handlernext = handler->next;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index dfe2a5407b1..7b231e6fd6b 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1380,39 +1380,11 @@ static void wm_block_splash_refreshmenu(bContext *C, void *UNUSED(arg_block), vo
ED_region_tag_refresh_ui(ar_menu);
}
-static int wm_resource_check_prev(void)
-{
-
- const char *res = BKE_appdir_folder_id_version(BLENDER_RESOURCE_PATH_USER, BLENDER_VERSION, true);
-
- // if (res) printf("USER: %s\n", res);
-
-#if 0 /* ignore the local folder */
- if (res == NULL) {
- /* with a local dir, copying old files isn't useful since local dir get priority for config */
- res = BKE_appdir_folder_id_version(BLENDER_RESOURCE_PATH_LOCAL, BLENDER_VERSION, true);
- }
-#endif
-
- // if (res) printf("LOCAL: %s\n", res);
- if (res) {
- return false;
- }
- else {
- return (BKE_appdir_folder_id_version(BLENDER_RESOURCE_PATH_USER, BLENDER_VERSION - 1, true) != NULL);
- }
-}
-
static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg))
{
uiBlock *block;
uiBut *but;
- uiLayout *layout, *split, *col;
uiStyle *style = UI_style_get();
- const struct RecentFile *recent;
- int i;
- MenuType *mt = WM_menutype_find("USERPREF_MT_splash", true);
- char url[96];
const char *version_suffix = NULL;
#ifndef WITH_HEADLESS
@@ -1485,7 +1457,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
}
#endif
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
+ block = UI_block_begin(C, ar, "splash", UI_EMBOSS);
/* note on UI_BLOCK_NO_WIN_CLIP, the window size is not always synchronized
* with the OS when the splash shows, window clipping in this case gives
@@ -1558,59 +1530,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
}
#endif /* WITH_BUILDINFO */
- layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, 0, style);
+ uiLayout *layout = UI_block_layout(
+ block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2,
+ U.pixelsize * 480, U.pixelsize * 110, 0, style);
- UI_block_emboss_set(block, UI_EMBOSS);
- /* show the splash menu (containing interaction presets), using python */
+ MenuType *mt = WM_menutype_find("WM_MT_splash", true);
if (mt) {
UI_menutype_draw(C, mt, layout);
-
-// uiItemM(layout, "USERPREF_MT_keyconfigs", U.keyconfigstr, ICON_NONE);
- }
-
- UI_block_emboss_set(block, UI_EMBOSS_PULLDOWN);
- uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
-
- split = uiLayoutSplit(layout, 0.0f, false);
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Links"), ICON_NONE);
- uiItemStringO(col, IFACE_("Join the Development Fund"), ICON_URL, "WM_OT_url_open", "url",
- "https://www.blender.org/foundation/development-fund/");
- uiItemStringO(col, IFACE_("Donate"), ICON_URL, "WM_OT_url_open", "url",
- "https://www.blender.org/foundation/donation-payment/");
- uiItemS(col);
- uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url",
- "https://docs.blender.org/manual/en/dev/");
- BLI_snprintf(url, sizeof(url), "https://wiki.blender.org/wiki/Reference/Release_Notes/%d.%d",
- BLENDER_VERSION / 100, BLENDER_VERSION % 100);
- uiItemStringO(col, IFACE_("Release Notes"), ICON_URL, "WM_OT_url_open", "url", url);
- uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "https://www.blender.org");
- uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url",
- "https://www.blender.org/about/credits/");
- uiItemL(col, "", ICON_NONE);
-
- col = uiLayoutColumn(split, false);
-
- if (wm_resource_check_prev()) {
- uiItemO(col, NULL, ICON_NEW, "WM_OT_copy_prev_settings");
- uiItemS(col);
- }
-
- uiItemL(col, IFACE_("Recent"), ICON_NONE);
- for (recent = G.recent_files.first, i = 0; (i < 5) && (recent); recent = recent->next, i++) {
- const char *filename = BLI_path_basename(recent->filepath);
- uiItemStringO(col, filename,
- BLO_has_bfile_extension(filename) ? ICON_FILE_BLEND : ICON_FILE_BACKUP,
- "WM_OT_open_mainfile", "filepath", recent->filepath);
- }
-
- uiItemS(col);
- uiItemO(col, NULL, ICON_RECOVER_LAST, "WM_OT_recover_last_session");
- uiItemL(col, "", ICON_NONE);
-
- mt = WM_menutype_find("USERPREF_MT_splash_footer", false);
- if (mt) {
- UI_menutype_draw(C, mt, uiLayoutColumn(layout, false));
}
UI_block_bounds_set_centered(block, 0);