diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_init_exit.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 32a49b6e160..edca1f97ecf 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -58,9 +58,10 @@ #include "BKE_screen.h" #include "BKE_DerivedMesh.h" #include "BKE_global.h" +#include "BKE_icons.h" #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_mball.h" +#include "BKE_mball_tessellate.h" #include "BKE_node.h" #include "BKE_report.h" @@ -149,9 +150,11 @@ void WM_init(bContext *C, int argc, const char **argv) WM_menutype_init(); WM_uilisttype_init(); - set_free_windowmanager_cb(wm_close_and_free); /* library.c */ - set_free_notifier_reference_cb(WM_main_remove_notifier_reference); /* library.c */ - set_blender_test_break_cb(wm_window_testbreak); /* blender.c */ + BKE_library_callback_free_window_manager_set(wm_close_and_free); /* library.c */ + BKE_library_callback_free_notifier_reference_set(WM_main_remove_notifier_reference); /* library.c */ + BKE_library_callback_free_editor_id_reference_set(WM_main_remove_editor_id_reference); /* library.c */ + BKE_blender_callback_test_break_set(wm_window_testbreak); /* blender.c */ + BKE_spacedata_callback_id_unref_set(ED_spacedata_id_unref); /* screen.c */ DAG_editors_update_cb(ED_render_id_flush_update, ED_render_scene_update); /* depsgraph.c */ ED_spacetypes_init(); /* editors/space_api/spacetype.c */ @@ -170,6 +173,25 @@ void WM_init(bContext *C, int argc, const char **argv) BLF_lang_set(NULL); + if (!G.background) { + GPU_init(); + + GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); + GPU_set_linear_mipmap(true); + GPU_set_anisotropic(U.anisotropic_filter); + GPU_set_gpu_mipmapping(U.use_gpu_mipmap); + + UI_init(); + } + else { + /* Note: Currently only inits icons, which we now want in background mode too + * (scripts could use those in background processing...). + * In case we do more later, we may need to pass a 'background' flag. + * Called from 'UI_init' above */ + BKE_icons_init(1); + } + + ED_spacemacros_init(); /* note: there is a bug where python needs initializing before loading the @@ -195,17 +217,6 @@ void WM_init(bContext *C, int argc, const char **argv) wm_init_reports(C); /* reports cant be initialized before the wm */ - if (!G.background) { - GPU_init(); - - GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); - GPU_set_linear_mipmap(true); - GPU_set_anisotropic(U.anisotropic_filter); - GPU_set_gpu_mipmapping(U.use_gpu_mipmap); - - UI_init(); - } - clear_matcopybuf(); ED_render_clear_mtex_copybuf(); @@ -328,7 +339,7 @@ bool WM_init_game(bContext *C) WM_operator_name_call(C, "VIEW3D_OT_game_start", WM_OP_EXEC_DEFAULT, NULL); - sound_exit(); + BKE_sound_exit(); return true; } @@ -398,7 +409,7 @@ void WM_exit_ext(bContext *C, const bool do_python) { wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL; - sound_exit(); + BKE_sound_exit(); /* first wrap up running stuff, we assume only the active WM is running */ /* modal handlers are on window level freed, others too? */ @@ -407,7 +418,7 @@ void WM_exit_ext(bContext *C, const bool do_python) wmWindow *win; if (!G.background) { - if ((U.uiflag2 & USER_KEEP_SESSION) || BKE_undo_valid(NULL)) { + if ((U.uiflag2 & USER_KEEP_SESSION) || BKE_undo_is_valid(NULL)) { /* save the undo state as quit.blend */ char filename[FILE_MAX]; bool has_edited; @@ -517,7 +528,7 @@ void WM_exit_ext(bContext *C, const bool do_python) GPU_exit(); } - BKE_reset_undo(); + BKE_undo_reset(); ED_file_exit(); /* for fsmenu */ @@ -539,7 +550,7 @@ void WM_exit_ext(bContext *C, const bool do_python) if (MEM_get_memory_blocks_in_use() != 0) { size_t mem_in_use = MEM_get_memory_in_use() + MEM_get_memory_in_use(); - printf("Error: Not freed memory blocks: %d, total unfreed memory %f MB\n", + printf("Error: Not freed memory blocks: %u, total unfreed memory %f MB\n", MEM_get_memory_blocks_in_use(), (double)mem_in_use / 1024 / 1024); MEM_printmemlist(); |