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>2011-01-19 12:13:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-19 12:13:24 +0300
commit161cbed9b58408500e3e9d2acc6ea8db9ade4d4a (patch)
treef183c97722fed08c4a0b13395d61539b6476468c /source/blender/windowmanager
parentdddb9aa30f96961023f02846c97c955e1f2b5f0c (diff)
new command line option '--factory-startup' to skip reading startup.blend. useful for testing with a predictable environment.
also commented python benchmark prints on exit, can enable when profiling later.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h3
-rw-r--r--source/blender/windowmanager/intern/wm_files.c16
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c4
4 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index a7aad83d471..c9d74cbb39d 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -81,7 +81,8 @@ void WM_window_open_temp (struct bContext *C, struct rcti *position, int type);
/* files */
-int WM_read_homefile (struct bContext *C, struct wmOperator *op);
+int WM_read_homefile_exec(struct bContext *C, struct wmOperator *op);
+int WM_read_homefile (struct bContext *C, struct ReportList *reports, short from_memory);
int WM_write_homefile (struct bContext *C, struct wmOperator *op);
void WM_read_file (struct bContext *C, const char *name, struct ReportList *reports);
int WM_write_file (struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 31cb3172013..80b88309883 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -352,11 +352,10 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports)
/* called on startup, (context entirely filled with NULLs) */
/* or called for 'New File' */
/* op can be NULL */
-int WM_read_homefile(bContext *C, wmOperator *op)
+int WM_read_homefile(bContext *C, ReportList *reports, short from_memory)
{
ListBase wmbase;
char tstr[FILE_MAXDIR+FILE_MAXFILE];
- int from_memory= op && strcmp(op->type->idname, "WM_OT_read_factory_settings")==0;
int success= 0;
free_ttfont(); /* still weird... what does it here? */
@@ -369,9 +368,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
} else {
tstr[0] = '\0';
from_memory = 1;
- if (op) {
- BKE_report(op->reports, RPT_INFO, "Config directory with startup.blend file not found.");
- }
+ BKE_report(reports, RPT_INFO, "Config directory with "STRINGIFY(BLENDER_STARTUP_FILE)" file not found.");
}
}
@@ -385,7 +382,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
success = (BKE_read_file(C, tstr, NULL) != BKE_READ_FILE_FAIL);
if(U.themes.first==NULL) {
- printf("\nError: No valid startup.blend, fall back to built-in default.\n\n");
+ printf("\nError: No valid "STRINGIFY(BLENDER_STARTUP_FILE)", fall back to built-in default.\n\n");
success = 0;
}
}
@@ -436,9 +433,14 @@ int WM_read_homefile(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
CTX_wm_window_set(C, NULL); /* exits queues */
- return OPERATOR_FINISHED;
+ return TRUE;
}
+int WM_read_homefile_exec(bContext *C, wmOperator *op)
+{
+ int from_memory= strcmp(op->type->idname, "WM_OT_read_factory_settings") == 0;
+ return WM_read_homefile(C, op->reports, from_memory) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+}
void read_history(void)
{
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 19bb92d72e0..405aa5bd8af 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -136,7 +136,7 @@ void WM_init(bContext *C, int argc, char **argv)
BLF_lang_init();
/* get the default database, plus a wm */
- WM_read_homefile(C, NULL);
+ WM_read_homefile(C, NULL, G.factory_startup);
/* note: there is a bug where python needs initializing before loading the
* startup.blend because it may contain PyDrivers. It also needs to be after
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index f6b3cfed2eb..0aaa3088142 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1353,7 +1353,7 @@ static void WM_OT_read_homefile(wmOperatorType *ot)
ot->description="Open the default file (doesn't save the current file)";
ot->invoke= WM_operator_confirm;
- ot->exec= WM_read_homefile;
+ ot->exec= WM_read_homefile_exec;
ot->poll= WM_operator_winactive;
}
@@ -1364,7 +1364,7 @@ static void WM_OT_read_factory_settings(wmOperatorType *ot)
ot->description="Load default file and user preferences";
ot->invoke= WM_operator_confirm;
- ot->exec= WM_read_homefile;
+ ot->exec= WM_read_homefile_exec;
ot->poll= WM_operator_winactive;
}