2.5: Load UI is now an operator property, and a user preference to
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 21 Aug 2009 14:33:53 +0000 (14:33 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 21 Aug 2009 14:33:53 +0000 (14:33 +0000)
define what the default is, just like file compression for saving.

release/ui/space_userpref.py
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c
source/blender/windowmanager/intern/wm_operators.c

index 95054efcb25e923c334f922697206c400cb74ba7..bd963c65cd093a8b9e2ebb00ab1108b9e1fd6fa0 100644 (file)
@@ -359,6 +359,7 @@ class USERPREF_PT_filepaths(bpy.types.Panel):
                sub2.itemL(text="Save & Load:")
                sub2.itemR(paths, "use_relative_paths")
                sub2.itemR(paths, "compress_file")
+               sub2.itemR(paths, "load_ui")
                sub2.itemL(text="Auto Save:")
                sub2.itemR(paths, "save_version")
                sub2.itemR(paths, "recent_files")
index c2314e1e3a20a77d533407d1c5c757d89eec5d9f..100f55ffe338b34e156f8079eee52db117c68a9e 100644 (file)
@@ -369,6 +369,7 @@ extern UserDef U; /* from blenkernel blender.c */
 #define USER_RELPATHS                  (1 << 20)
 #define USER_DRAGIMMEDIATE             (1 << 21)
 #define USER_DONT_DOSCRIPTLINKS        (1 << 22)
+#define USER_FILENOUI                  (1 << 23)
 
 /* viewzom */
 #define USER_ZOOM_CONT                 0
index d12455281005345131f4a3ee756d976a753ca01f..b74dc6f757b40778b909e2aec5e0e3f152bfbbff 100644 (file)
@@ -2199,6 +2199,10 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FILECOMPRESS);
        RNA_def_property_ui_text(prop, "Compress File", "Enable file compression when saving .blend files.");
 
+       prop= RNA_def_property(srna, "load_ui", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_FILENOUI);
+       RNA_def_property_ui_text(prop, "Load UI", "Load user interface setup when loading .blend files.");
+
        prop= RNA_def_property(srna, "fonts_directory", PROP_STRING, PROP_DIRPATH);
        RNA_def_property_string_sdna(prop, NULL, "fontdir");
        RNA_def_property_ui_text(prop, "Fonts Directory", "The default directory to search for loading fonts.");
index ab8dfeabe4f65a947ed8d6b70ee5030ba6ab5b3f..87a145ceee2057017a8e22775fa37d99d5154a80 100644 (file)
@@ -868,10 +868,17 @@ static void untitled(char *name)
        }
 }
 
+static void load_set_load_ui(wmOperator *op)
+{
+       if(!RNA_property_is_set(op->ptr, "load_ui"))
+               RNA_boolean_set(op->ptr, "load_ui", !(U.flag & USER_FILENOUI));
+}
 
 static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        RNA_string_set(op->ptr, "filename", G.sce);
+       load_set_load_ui(op);
+
        WM_event_add_fileselect(C, op);
 
        return OPERATOR_RUNNING_MODAL;
@@ -880,7 +887,14 @@ static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
 {
        char filename[FILE_MAX];
+
        RNA_string_get(op->ptr, "filename", filename);
+       load_set_load_ui(op);
+
+       if(RNA_boolean_get(op->ptr, "load_ui"))
+               G.fileflags &= ~G_FILE_NO_UI;
+       else
+               G.fileflags |= G_FILE_NO_UI;
        
        // XXX wm in context is not set correctly after WM_read_file -> crash
        // do it before for now, but is this correct with multiple windows?
@@ -901,6 +915,8 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
        ot->poll= WM_operator_winactive;
        
        WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE);
+
+       RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file.");
 }
 
 static int wm_recover_last_session_exec(bContext *C, wmOperator *op)