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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-03 04:29:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-03 04:29:45 +0400
commitdd54b721c6ff3e0614f771e76fb1ccfbb78f6d67 (patch)
tree3c73cd720546625460c90bd5d9b6290c169c07c8 /source/blender/windowmanager
parent726628518d9c7d30cf5b367992395d74c5cc65af (diff)
Add load_ui to WM_OT_read_homefile
Useful for implementing templates. Patch D423 by Gaia Clary
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c9
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c3
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c5
3 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 0d481bd49dc..553f9a6318f 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -576,9 +576,6 @@ int wm_homefile_read(bContext *C, ReportList *reports, bool from_memory, const c
}
}
- /* prevent loading no UI */
- G.fileflags &= ~G_FILE_NO_UI;
-
/* put aside screens to match with persistent windows later */
wm_window_match_init(C, &wmbase);
@@ -687,6 +684,12 @@ int wm_homefile_read_exec(bContext *C, wmOperator *op)
if (!from_memory) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
+
+ /* This can be used when loading of a start-up file should only change
+ * the scene content but keep the blender UI as it is. */
+ wm_open_init_load_ui(op, true);
+ BKE_BIT_TEST_SET(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI);
+
if (RNA_property_is_set(op->ptr, prop)) {
RNA_property_string_get(op->ptr, prop, filepath_buf);
filepath = filepath_buf;
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 5325ade011f..d4a23dcc8b6 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -161,6 +161,9 @@ void WM_init(bContext *C, int argc, const char **argv)
BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */
BLF_lang_init();
+ /* Enforce loading the UI for the initial homefile */
+ G.fileflags &= ~G_FILE_NO_UI;
+
/* get the default database, plus a wm */
wm_homefile_read(C, NULL, G.factory_startup, NULL);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 50b0fa2fa79..4ff987d1094 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2146,6 +2146,11 @@ static void WM_OT_read_homefile(wmOperatorType *ot)
"Path to an alternative start-up file");
RNA_def_property_flag(prop, PROP_HIDDEN);
+ /* So scripts can use an alternative start-up file without the UI */
+ prop = RNA_def_boolean(ot->srna, "load_ui", true, "Load UI",
+ "Load user interface setup from the .blend file");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
/* ommit poll to run in background mode */
}