svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22130:22205
[blender-staging.git] / source / blender / windowmanager / intern / wm_init_exit.c
index 65acef765b04e7e7563a6b0f45837c60727f3220..599844f10202e94abda1c340e65b9ad0ae0f2f75 100644 (file)
 #include "BKE_global.h"
 #include "BKE_library.h"
 #include "BKE_mball.h"
+#include "BKE_report.h"
 #include "BKE_utildefines.h"
 #include "BKE_packedFile.h"
 
-#include "BMF_Api.h"
-#ifdef INTERNATIONAL
-#include "FTF_Api.h"
-#endif
-
 #include "BLI_blenlib.h"
 
 #include "RE_pipeline.h"               /* RE_ free stuff */
 
-#include "radio.h"
-
 #ifndef DISABLE_PYTHON
 #include "BPY_extern.h"
 #endif
@@ -82,6 +76,8 @@
 #include "wm_files.h"
 #include "wm_window.h"
 
+#include "ED_armature.h"
+#include "ED_keyframing.h"
 #include "ED_node.h"
 #include "ED_previewrender.h"
 #include "ED_space_api.h"
@@ -89,6 +85,7 @@
 #include "ED_util.h"
 
 #include "UI_interface.h"
+#include "BLF_api.h"
 
 #include "GPU_extensions.h"
 #include "GPU_draw.h"
@@ -104,6 +101,18 @@ static void sound_init_listener(void)
        G.listener->dopplervelocity = 340.29f;
 }
 
+
+static void wm_init_reports(bContext *C)
+{
+       BKE_reports_init(CTX_wm_reports(C), RPT_STORE);
+}
+static void wm_free_reports(bContext *C)
+{
+       BKE_reports_clear(CTX_wm_reports(C));
+}
+
+
+
 /* only called once, for startup */
 void WM_init(bContext *C)
 {
@@ -120,15 +129,17 @@ void WM_init(bContext *C)
        ED_file_init();                 /* for fsmenu */
        ED_init_node_butfuncs();        
        
+       BLF_init(11, U.dpi);
+       BLF_lang_init();
+       
+       init_builtin_keyingsets(); /* editors/animation/keyframing.c */
+       
        /* get the default database, plus a wm */
-       WM_read_homefile(C, 0);
+       WM_read_homefile(C, NULL);
        
-       UI_init();
+       wm_init_reports(C); /* reports cant be initialized before the wm */
        
-       /* goes away */
-       G.font= BMF_GetFont(BMF_kHelvetica12);
-       G.fonts= BMF_GetFont(BMF_kHelvetica10);
-       G.fontss= BMF_GetFont(BMF_kHelveticaBold8);
+       UI_init();
        
        //      clear_matcopybuf(); /* XXX */
        
@@ -166,7 +177,8 @@ extern wchar_t *copybuf;
 extern wchar_t *copybufinfo;
 
        // XXX copy/paste buffer stuff...
-extern void free_actcopybuf(); 
+extern void free_anim_copybuf(); 
+extern void free_posebuf(); 
 
 /* called in creator.c even... tsk, split this! */
 void WM_exit(bContext *C)
@@ -192,9 +204,11 @@ void WM_exit(bContext *C)
        /* all non-screen and non-space stuff editors did, like editmode */
        if(C)
                ED_editors_exit(C);
-       
-       /* Context should still working here. but radio tool needs cleaning... */
-       freeAllRad(CTX_data_scene(C));
+
+//     XXX     
+//     BIF_GlobalReebFree();
+//     BIF_freeRetarget();
+       BIF_freeTemplates(C);
        
        free_ttfont(); /* bke_font.h */
        
@@ -212,22 +226,22 @@ void WM_exit(bContext *C)
        BPY_end_python();
 #endif
        
-//     fastshade_free_render();        /* shaded view */
+       fastshade_free_render();        /* shaded view */
        ED_preview_free_dbase();        /* frees a Main dbase, before free_blender! */
+       wm_free_reports(C);                     /* before free_blender! - since the ListBases get freed there */
        free_blender();                         /* blender.c, does entire library and spacetypes */
 //     free_matcopybuf();
-//     free_ipocopybuf();
-       free_actcopybuf();
+       free_anim_copybuf();
+       free_posebuf();
 //     free_vertexpaint();
 //     free_imagepaint();
        
 //     fsmenu_free();
-       
-#ifdef INTERNATIONAL
-//     free_languagemenu();
-#endif
-       
+
+       BLF_exit();
+
        RE_FreeAllRender();
+       RE_engines_exit();
        
 //     free_txt_data();
        
@@ -245,10 +259,6 @@ void WM_exit(bContext *C)
 // XXX         UI_filelist_free_icons();
        }
        
-#ifdef INTERNATIONAL
-       FTF_End();
-#endif
-
        GPU_extensions_exit();
        
 //     if (copybuf) MEM_freeN(copybuf);
@@ -260,7 +270,7 @@ void WM_exit(bContext *C)
        ED_file_exit(); /* for fsmenu */
 
        UI_exit();
-       BLI_freelistN(&U.themes);
+       BKE_userdef_free();
 
        RNA_exit();