diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-03-29 11:07:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-03-29 12:11:54 +0300 |
commit | df7f6a3e2e91a7ad27f8ca2b2b43a6c51da8c2c9 (patch) | |
tree | 424b01b519ac94c330db9a0d0d7c9bfe448ffe6f /source/blender/windowmanager/intern/wm_files.c | |
parent | b3f9ae01255fc5801055682148ef274027f45006 (diff) |
Option to load startup file with empty-data
Useful for batch conversion and tests.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 27395dbaf3e..2e799307cc0 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -643,7 +643,8 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) * When not-null, this is written into the user preferences. */ int wm_homefile_read( - bContext *C, ReportList *reports, bool use_factory_settings, + bContext *C, ReportList *reports, + bool use_factory_settings, bool use_empty_data, const char *filepath_startup_override, const char *app_template_override) { ListBase wmbase; @@ -779,6 +780,10 @@ int wm_homefile_read( } } + if (use_empty_data) { + BKE_blendfile_read_make_empty(C); + } + /* Load template preferences, * unlike regular preferences we only use some of the settings, * see: BKE_blender_userdef_set_app_template */ @@ -1551,6 +1556,7 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op) const char *app_template; PropertyRNA *prop_app_template = RNA_struct_find_property(op->ptr, "app_template"); const bool use_splash = !use_factory_settings && RNA_boolean_get(op->ptr, "use_splash"); + const bool use_empty_data = RNA_boolean_get(op->ptr, "use_empty"); if (prop_app_template && RNA_property_is_set(op->ptr, prop_app_template)) { RNA_property_string_get(op->ptr, prop_app_template, app_template_buf); @@ -1560,7 +1566,7 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op) app_template = NULL; } - if (wm_homefile_read(C, op->reports, use_factory_settings, filepath, app_template)) { + if (wm_homefile_read(C, op->reports, use_factory_settings, use_empty_data, filepath, app_template)) { if (use_splash) { WM_init_splash(C); } @@ -1591,6 +1597,9 @@ void WM_OT_read_homefile(wmOperatorType *ot) "Load user interface setup from the .blend file"); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "use_empty", false, "Empty", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + /* So the splash can be kept open after loading a file (for templates). */ prop = RNA_def_boolean(ot->srna, "use_splash", false, "Splash", ""); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); @@ -1615,6 +1624,9 @@ void WM_OT_read_factory_settings(wmOperatorType *ot) prop = RNA_def_string(ot->srna, "app_template", "Template", sizeof(U.app_template), "", ""); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "use_empty", false, "Empty", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + /* omit poll to run in background mode */ } |