2.5
authorTon Roosendaal <ton@blender.org>
Thu, 30 Apr 2009 16:44:00 +0000 (16:44 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 30 Apr 2009 16:44:00 +0000 (16:44 +0000)
Two fixes:

- objects in editmode now update data on saving .blend
- uifonts and uistyles were not freed yet on reading files
  yet.

source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/intern/blender.c
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_style.c
source/blender/editors/object/object_edit.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_init_exit.c

index 5a374802d3616d6f00fb33bcc13c62a3a78416d0..795c7585b9ca9cab8cf32c9401579e11db2dca64 100644 (file)
@@ -55,6 +55,9 @@ int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, stru
 void free_blender(void);
 void initglobals(void);
 
+/* load new userdef from file, exit blender */
+void BKE_userdef_free(void);
+
 /* set this callback when a UI is running */
 void set_blender_test_break_cb(void (*func)(void) );
 int blender_test_break(void);
index 2033250585d70476a644eba3fc215aef5f8bdfcc..3169905b7f5406d91aeeec3f353aa9184d09a704 100644 (file)
@@ -325,8 +325,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
        if (bfd->user) {
                
                /* only here free userdef themes... */
-               BLI_freelistN(&U.themes);
-
+               BKE_userdef_free();
+               
                U= *bfd->user;
                MEM_freeN(bfd->user);
        }
@@ -414,6 +414,15 @@ static void handle_subversion_warning(Main *main)
                
 }
 
+void BKE_userdef_free(void)
+{
+       
+       BLI_freelistN(&U.uistyles);
+       BLI_freelistN(&U.uifonts);
+       BLI_freelistN(&U.themes);
+       
+}
+
 /* returns:
    0: no load file
    1: OK
index fa25153a1581052feb0ee9c207860e6c1a895a11..8a1086386e1e9d3bffa2a0c4bcc57567ae757723 100644 (file)
@@ -3059,7 +3059,6 @@ void UI_init_userdef(void)
 
 void UI_exit(void)
 {
-       uiStyleExit();
        ui_resources_free();
 }
 
index 8aaec7f31b000a4fd20c517035304446358c4cab..83cea53e5fae84c0b52b10c0b80007b4b7337fa9 100644 (file)
@@ -382,7 +382,6 @@ void ui_widget_color_init(struct ThemeUI *tui);
 
 /* interface_style.c */
 void uiStyleInit(void);
-void uiStyleExit(void);
 
 /* resources.c */
 void init_userdef_do_versions(void);
index db5dacf5a7529fa70ad6e3bbd3a09260b7dbe6a4..8c07a6ea0ab0391f1b120c22ac000f3336be5616 100644 (file)
@@ -264,14 +264,6 @@ void uiStyleInit(void)
        }
 }
 
-
-void uiStyleExit(void)
-{
-       BLI_freelistN(&U.uifonts);
-       BLI_freelistN(&U.uistyles);
-       
-}
-
 void uiStyleFontSet(uiFontStyle *fs)
 {
        uiFont *font= uifont_to_blfont(fs->uifont_id);
index 2ec9d1aed377a6426f9eaf4477be658fa94d6f9e..234a1cc0ea40c10eff47bed4f9e3941fd2d1c7b2 100644 (file)
@@ -3204,7 +3204,6 @@ void ED_object_exit_editmode(bContext *C, int flag)
 {
        Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
-       Object *ob;
        int freedata = flag & EM_FREEDATA;
        
        if(obedit==NULL) return;
@@ -3252,22 +3251,20 @@ void ED_object_exit_editmode(bContext *C, int flag)
 //             if(freedata) BLI_freelistN(&editelems);
        }
        
-       ob= obedit;
-       
-       /* for example; displist make is different in editmode */
-       if(freedata) obedit= NULL;
-       scene->obedit= obedit; // XXX for context
-       
-       /* also flush ob recalc, doesn't take much overhead, but used for particles */
-       DAG_object_flush_update(scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
+       /* freedata only 0 now on file saves */
+       if(freedata) {
+               /* for example; displist make is different in editmode */
+               scene->obedit= NULL; // XXX for context
+               
+               /* also flush ob recalc, doesn't take much overhead, but used for particles */
+               DAG_object_flush_update(scene, obedit, OB_RECALC_OB|OB_RECALC_DATA);
        
-       if(obedit==NULL) // XXX && (flag & EM_FREEUNDO)) 
                ED_undo_push(C, "Editmode");
        
-       if(flag & EM_WAITCURSOR) waitcursor(0);
+               if(flag & EM_WAITCURSOR) waitcursor(0);
        
-       WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
-
+               WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
+       }
 }
 
 
index 5e27b0da70d32bcdc7d8ef9402b7a0df25766ed2..6bd5b9e0c6cf78eb8c6ee0dd2a36fec854a8a05b 100644 (file)
@@ -78,6 +78,7 @@
 #include "RNA_define.h"
 
 #include "ED_datafiles.h"
+#include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_util.h"
 
@@ -569,16 +570,16 @@ void WM_write_file(bContext *C, char *target, ReportList *reports)
                strcpy(di, target);
        }
 
-       if (BLI_exists(di)) {
+//     if (BLI_exists(di)) {
 // XXX         if(!saveover(di))
 // XXX                 return; 
-       }
+//     }
        
        if (G.fileflags & G_AUTOPACK) {
                packAll();
        }
        
-// XXX waitcursor(1);  // exit_editmode sets cursor too
+       ED_object_exit_editmode(C, 0);
 
        do_history(di, reports);
        
index 64d61210c14a5f70c8248f569256f13fd0ab018a..d394a4d6eee78f44b8fb0956e1527457109157ff 100644 (file)
@@ -264,7 +264,7 @@ void WM_exit(bContext *C)
        ED_file_exit(); /* for fsmenu */
 
        UI_exit();
-       BLI_freelistN(&U.themes);
+       BKE_userdef_free();
 
        RNA_exit();