Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/windowmanager/intern/wm_init_exit.c
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/windowmanager/intern/wm_init_exit.c')
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c619
1 files changed, 312 insertions, 307 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index f39cb7d7cb2..ad3cc50ea13 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -72,13 +72,13 @@
#include "BKE_studiolight.h"
#include "BKE_material.h" /* clear_matcopybuf */
#include "BKE_tracking.h" /* free tracking clipboard */
-#include "BKE_mask.h" /* free mask clipboard */
+#include "BKE_mask.h" /* free mask clipboard */
#include "RE_engine.h"
-#include "RE_pipeline.h" /* RE_ free stuff */
+#include "RE_pipeline.h" /* RE_ free stuff */
#ifdef WITH_PYTHON
-#include "BPY_extern.h"
+# include "BPY_extern.h"
#endif
#include "GHOST_Path-api.h"
@@ -139,24 +139,24 @@ CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_MSGBUS_SUB, "wm.msgbus.sub");
static void wm_init_reports(bContext *C)
{
- ReportList *reports = CTX_wm_reports(C);
+ ReportList *reports = CTX_wm_reports(C);
- BLI_assert(!reports || BLI_listbase_is_empty(&reports->list));
+ BLI_assert(!reports || BLI_listbase_is_empty(&reports->list));
- BKE_reports_init(reports, RPT_STORE);
+ BKE_reports_init(reports, RPT_STORE);
}
static void wm_free_reports(bContext *C)
{
- ReportList *reports = CTX_wm_reports(C);
+ ReportList *reports = CTX_wm_reports(C);
- BKE_reports_clear(reports);
+ BKE_reports_clear(reports);
}
static bool wm_start_with_console = false;
void WM_init_state_start_with_console_set(bool value)
{
- wm_start_with_console = value;
+ wm_start_with_console = value;
}
/**
@@ -170,236 +170,241 @@ static bool opengl_is_init = false;
void WM_init_opengl(Main *bmain)
{
- /* must be called only once */
- BLI_assert(opengl_is_init == false);
+ /* must be called only once */
+ BLI_assert(opengl_is_init == false);
- if (G.background) {
- /* Ghost is still not init elsewhere in background mode. */
- wm_ghost_init(NULL);
- }
+ if (G.background) {
+ /* Ghost is still not init elsewhere in background mode. */
+ wm_ghost_init(NULL);
+ }
- /* Needs to be first to have an ogl context bound. */
- DRW_opengl_context_create();
+ /* Needs to be first to have an ogl context bound. */
+ DRW_opengl_context_create();
- GPU_init();
- GPU_set_mipmap(bmain, true);
- GPU_set_linear_mipmap(true);
- GPU_set_anisotropic(bmain, U.anisotropic_filter);
+ GPU_init();
+ GPU_set_mipmap(bmain, true);
+ GPU_set_linear_mipmap(true);
+ GPU_set_anisotropic(bmain, U.anisotropic_filter);
- GPU_pass_cache_init();
+ GPU_pass_cache_init();
#ifdef WITH_OPENSUBDIV
- BKE_subsurf_osd_init();
+ BKE_subsurf_osd_init();
#endif
- opengl_is_init = true;
+ opengl_is_init = true;
}
/* only called once, for startup */
void WM_init(bContext *C, int argc, const char **argv)
{
- if (!G.background) {
- wm_ghost_init(C); /* note: it assigns C to ghost! */
- wm_init_cursor_data();
- }
+ if (!G.background) {
+ wm_ghost_init(C); /* note: it assigns C to ghost! */
+ wm_init_cursor_data();
+ }
- GHOST_CreateSystemPaths();
+ GHOST_CreateSystemPaths();
- BKE_addon_pref_type_init();
- BKE_keyconfig_pref_type_init();
+ BKE_addon_pref_type_init();
+ BKE_keyconfig_pref_type_init();
- wm_operatortype_init();
- wm_operatortypes_register();
+ wm_operatortype_init();
+ wm_operatortypes_register();
- WM_paneltype_init(); /* Lookup table only. */
- WM_menutype_init();
- WM_uilisttype_init();
- wm_gizmotype_init();
- wm_gizmogrouptype_init();
+ WM_paneltype_init(); /* Lookup table only. */
+ WM_menutype_init();
+ WM_uilisttype_init();
+ wm_gizmotype_init();
+ wm_gizmogrouptype_init();
- ED_undosys_type_init();
+ ED_undosys_type_init();
- 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_region_callback_free_gizmomap_set(wm_gizmomap_remove); /* screen.c */
- BKE_region_callback_refresh_tag_gizmomap_set(WM_gizmomap_tag_refresh);
- BKE_library_callback_remap_editor_id_reference_set(WM_main_remap_editor_id_reference); /* library.c */
- BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */
- DEG_editors_set_update_cb(ED_render_id_flush_update,
- ED_render_scene_update);
+ 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_region_callback_free_gizmomap_set(wm_gizmomap_remove); /* screen.c */
+ BKE_region_callback_refresh_tag_gizmomap_set(WM_gizmomap_tag_refresh);
+ BKE_library_callback_remap_editor_id_reference_set(
+ WM_main_remap_editor_id_reference); /* library.c */
+ BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */
+ DEG_editors_set_update_cb(ED_render_id_flush_update, ED_render_scene_update);
- ED_spacetypes_init(); /* editors/space_api/spacetype.c */
+ ED_spacetypes_init(); /* editors/space_api/spacetype.c */
- ED_file_init(); /* for fsmenu */
- ED_node_init_butfuncs();
+ ED_file_init(); /* for fsmenu */
+ ED_node_init_butfuncs();
- BLF_init();
+ BLF_init();
- BLT_lang_init();
- /* Must call first before doing any .blend file reading, since versionning code may create new IDs... See T57066. */
- BLT_lang_set(NULL);
+ BLT_lang_init();
+ /* Must call first before doing any .blend file reading, since versionning code may create new IDs... See T57066. */
+ BLT_lang_set(NULL);
- /* Init icons before reading .blend files for preview icons, which can
- * get triggered by the depsgraph. This is also done in background mode
- * for scripts that do background processing with preview icons. */
- BKE_icons_init(BIFICONID_LAST);
+ /* Init icons before reading .blend files for preview icons, which can
+ * get triggered by the depsgraph. This is also done in background mode
+ * for scripts that do background processing with preview icons. */
+ BKE_icons_init(BIFICONID_LAST);
- /* reports cant be initialized before the wm,
- * but keep before file reading, since that may report errors */
- wm_init_reports(C);
+ /* reports cant be initialized before the wm,
+ * but keep before file reading, since that may report errors */
+ wm_init_reports(C);
- WM_msgbus_types_init();
+ WM_msgbus_types_init();
- /* get the default database, plus a wm */
- bool is_factory_startup = true;
- wm_homefile_read(
- C, NULL, G.factory_startup, false, true, NULL, WM_init_state_app_template_get(),
- &is_factory_startup);
+ /* get the default database, plus a wm */
+ bool is_factory_startup = true;
+ wm_homefile_read(C,
+ NULL,
+ G.factory_startup,
+ false,
+ true,
+ NULL,
+ WM_init_state_app_template_get(),
+ &is_factory_startup);
- /* Call again to set from userpreferences... */
- BLT_lang_set(NULL);
+ /* Call again to set from userpreferences... */
+ BLT_lang_set(NULL);
- if (!G.background) {
+ if (!G.background) {
#ifdef WITH_INPUT_NDOF
- /* sets 3D mouse deadzone */
- WM_ndof_deadzone_set(U.ndof_deadzone);
+ /* sets 3D mouse deadzone */
+ WM_ndof_deadzone_set(U.ndof_deadzone);
#endif
- WM_init_opengl(G_MAIN);
+ WM_init_opengl(G_MAIN);
- UI_init();
- }
+ UI_init();
+ }
- BKE_studiolight_init();
+ BKE_studiolight_init();
- ED_spacemacros_init();
+ ED_spacemacros_init();
- /* note: there is a bug where python needs initializing before loading the
- * startup.blend because it may contain PyDrivers. It also needs to be after
- * initializing space types and other internal data.
- *
- * However cant redo this at the moment. Solution is to load python
- * before wm_homefile_read() or make py-drivers check if python is running.
- * Will try fix when the crash can be repeated. - campbell. */
+ /* note: there is a bug where python needs initializing before loading the
+ * startup.blend because it may contain PyDrivers. It also needs to be after
+ * initializing space types and other internal data.
+ *
+ * However cant redo this at the moment. Solution is to load python
+ * before wm_homefile_read() or make py-drivers check if python is running.
+ * Will try fix when the crash can be repeated. - campbell. */
#ifdef WITH_PYTHON
- BPY_context_set(C); /* necessary evil */
- BPY_python_start(argc, argv);
+ BPY_context_set(C); /* necessary evil */
+ BPY_python_start(argc, argv);
- BPY_python_reset(C);
+ BPY_python_reset(C);
#else
- (void)argc; /* unused */
- (void)argv; /* unused */
+ (void)argc; /* unused */
+ (void)argv; /* unused */
#endif
- if (!G.background && !wm_start_with_console) {
- GHOST_toggleConsole(3);
- }
+ if (!G.background && !wm_start_with_console) {
+ GHOST_toggleConsole(3);
+ }
- clear_matcopybuf();
- ED_render_clear_mtex_copybuf();
+ clear_matcopybuf();
+ ED_render_clear_mtex_copybuf();
- // glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ // glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- wm_history_file_read();
+ wm_history_file_read();
- /* allow a path of "", this is what happens when making a new file */
+ /* allow a path of "", this is what happens when making a new file */
#if 0
- if (BKE_main_blendfile_path_from_global()[0] == '\0')
- BLI_make_file_string("/", G_MAIN->name, BKE_appdir_folder_default(), "untitled.blend");
+ if (BKE_main_blendfile_path_from_global()[0] == '\0')
+ BLI_make_file_string("/", G_MAIN->name, BKE_appdir_folder_default(), "untitled.blend");
#endif
- BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib));
+ BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib));
#ifdef WITH_COMPOSITOR
- if (1) {
- extern void *COM_linker_hack;
- COM_linker_hack = COM_execute;
- }
+ if (1) {
+ extern void *COM_linker_hack;
+ COM_linker_hack = COM_execute;
+ }
#endif
- {
- Main *bmain = CTX_data_main(C);
- /* note, logic here is from wm_file_read_post,
- * call functions that depend on Python being initialized. */
-
- /* normally 'wm_homefile_read' will do this,
- * however python is not initialized when called from this function.
- *
- * unlikely any handlers are set but its possible,
- * note that recovering the last session does its own callbacks. */
- CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
-
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE);
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST);
- if (is_factory_startup) {
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST);
- }
-
- wm_file_read_report(C, bmain);
-
- if (!G.background) {
- CTX_wm_window_set(C, NULL);
- }
- }
+ {
+ Main *bmain = CTX_data_main(C);
+ /* note, logic here is from wm_file_read_post,
+ * call functions that depend on Python being initialized. */
+
+ /* normally 'wm_homefile_read' will do this,
+ * however python is not initialized when called from this function.
+ *
+ * unlikely any handlers are set but its possible,
+ * note that recovering the last session does its own callbacks. */
+ CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
+
+ BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE);
+ BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST);
+ if (is_factory_startup) {
+ BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST);
+ }
+
+ wm_file_read_report(C, bmain);
+
+ if (!G.background) {
+ CTX_wm_window_set(C, NULL);
+ }
+ }
}
void WM_init_splash(bContext *C)
{
- if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
- wmWindowManager *wm = CTX_wm_manager(C);
- wmWindow *prevwin = CTX_wm_window(C);
-
- if (wm->windows.first) {
- CTX_wm_window_set(C, wm->windows.first);
- WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
- CTX_wm_window_set(C, prevwin);
- }
- }
+ if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *prevwin = CTX_wm_window(C);
+
+ if (wm->windows.first) {
+ CTX_wm_window_set(C, wm->windows.first);
+ WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
+ CTX_wm_window_set(C, prevwin);
+ }
+ }
}
/* free strings of open recent files */
static void free_openrecent(void)
{
- struct RecentFile *recent;
+ struct RecentFile *recent;
- for (recent = G.recent_files.first; recent; recent = recent->next) {
- MEM_freeN(recent->filepath);
- }
+ for (recent = G.recent_files.first; recent; recent = recent->next) {
+ MEM_freeN(recent->filepath);
+ }
- BLI_freelistN(&(G.recent_files));
+ BLI_freelistN(&(G.recent_files));
}
-
#ifdef WIN32
/* Read console events until there is a key event. Also returns on any error. */
static void wait_for_console_key(void)
{
- HANDLE hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
-
- if (!ELEM(hConsoleInput, NULL, INVALID_HANDLE_VALUE) && FlushConsoleInputBuffer(hConsoleInput)) {
- for (;;) {
- INPUT_RECORD buffer;
- DWORD ignored;
-
- if (!ReadConsoleInput(hConsoleInput, &buffer, 1, &ignored)) {
- break;
- }
-
- if (buffer.EventType == KEY_EVENT) {
- break;
- }
- }
- }
+ HANDLE hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
+
+ if (!ELEM(hConsoleInput, NULL, INVALID_HANDLE_VALUE) && FlushConsoleInputBuffer(hConsoleInput)) {
+ for (;;) {
+ INPUT_RECORD buffer;
+ DWORD ignored;
+
+ if (!ReadConsoleInput(hConsoleInput, &buffer, 1, &ignored)) {
+ break;
+ }
+
+ if (buffer.EventType == KEY_EVENT) {
+ break;
+ }
+ }
+ }
}
#endif
static int wm_exit_handler(bContext *C, const wmEvent *event, void *userdata)
{
- WM_exit(C);
+ WM_exit(C);
- UNUSED_VARS(event, userdata);
- return WM_UI_HANDLER_BREAK;
+ UNUSED_VARS(event, userdata);
+ return WM_UI_HANDLER_BREAK;
}
/**
@@ -407,14 +412,14 @@ static int wm_exit_handler(bContext *C, const wmEvent *event, void *userdata)
*/
void wm_exit_schedule_delayed(const bContext *C)
{
- /* What we do here is a little bit hacky, but quite simple and doesn't require bigger
- * changes: Add a handler wrapping WM_exit() to cause a delayed call of it. */
+ /* What we do here is a little bit hacky, but quite simple and doesn't require bigger
+ * changes: Add a handler wrapping WM_exit() to cause a delayed call of it. */
- wmWindow *win = CTX_wm_window(C);
+ wmWindow *win = CTX_wm_window(C);
- /* Use modal UI handler for now. Could add separate WM handlers or so, but probably not worth it. */
- WM_event_add_ui_handler(C, &win->modalhandlers, wm_exit_handler, NULL, NULL, 0);
- WM_event_add_mousemove(C); /* ensure handler actually gets called */
+ /* Use modal UI handler for now. Could add separate WM handlers or so, but probably not worth it. */
+ WM_event_add_ui_handler(C, &win->modalhandlers, wm_exit_handler, NULL, NULL, 0);
+ WM_event_add_mousemove(C); /* ensure handler actually gets called */
}
/**
@@ -422,185 +427,185 @@ void wm_exit_schedule_delayed(const bContext *C)
*/
void WM_exit_ext(bContext *C, const bool do_python)
{
- wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
+ wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
- /* first wrap up running stuff, we assume only the active WM is running */
- /* modal handlers are on window level freed, others too? */
- /* note; same code copied in wm_files.c */
- if (C && wm) {
- wmWindow *win;
+ /* first wrap up running stuff, we assume only the active WM is running */
+ /* modal handlers are on window level freed, others too? */
+ /* note; same code copied in wm_files.c */
+ if (C && wm) {
+ wmWindow *win;
- if (!G.background) {
- struct MemFile *undo_memfile = wm->undo_stack ? ED_undosys_stack_memfile_get_active(wm->undo_stack) : NULL;
- if (undo_memfile != NULL) {
- /* save the undo state as quit.blend */
- Main *bmain = CTX_data_main(C);
- char filename[FILE_MAX];
- bool has_edited;
- int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY);
+ if (!G.background) {
+ struct MemFile *undo_memfile = wm->undo_stack ?
+ ED_undosys_stack_memfile_get_active(wm->undo_stack) :
+ NULL;
+ if (undo_memfile != NULL) {
+ /* save the undo state as quit.blend */
+ Main *bmain = CTX_data_main(C);
+ char filename[FILE_MAX];
+ bool has_edited;
+ int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY);
- BLI_make_file_string("/", filename, BKE_tempdir_base(), BLENDER_QUIT_FILE);
+ BLI_make_file_string("/", filename, BKE_tempdir_base(), BLENDER_QUIT_FILE);
- has_edited = ED_editors_flush_edits(bmain, false);
+ has_edited = ED_editors_flush_edits(bmain, false);
- if ((has_edited && BLO_write_file(bmain, filename, fileflags, NULL, NULL)) ||
- (undo_memfile && BLO_memfile_write_file(undo_memfile, filename)))
- {
- printf("Saved session recovery to '%s'\n", filename);
- }
- }
- }
+ if ((has_edited && BLO_write_file(bmain, filename, fileflags, NULL, NULL)) ||
+ (undo_memfile && BLO_memfile_write_file(undo_memfile, filename))) {
+ printf("Saved session recovery to '%s'\n", filename);
+ }
+ }
+ }
- WM_jobs_kill_all(wm);
+ WM_jobs_kill_all(wm);
- for (win = wm->windows.first; win; win = win->next) {
+ for (win = wm->windows.first; win; win = win->next) {
- CTX_wm_window_set(C, win); /* needed by operator close callbacks */
- WM_event_remove_handlers(C, &win->handlers);
- WM_event_remove_handlers(C, &win->modalhandlers);
- ED_screen_exit(C, win, WM_window_get_active_screen(win));
- }
- }
+ CTX_wm_window_set(C, win); /* needed by operator close callbacks */
+ WM_event_remove_handlers(C, &win->handlers);
+ WM_event_remove_handlers(C, &win->modalhandlers);
+ ED_screen_exit(C, win, WM_window_get_active_screen(win));
+ }
+ }
- BLI_timer_free();
+ BLI_timer_free();
- WM_paneltype_clear();
+ WM_paneltype_clear();
- BKE_addon_pref_type_free();
- BKE_keyconfig_pref_type_free();
+ BKE_addon_pref_type_free();
+ BKE_keyconfig_pref_type_free();
- wm_operatortype_free();
- wm_dropbox_free();
- WM_menutype_free();
- WM_uilisttype_free();
+ wm_operatortype_free();
+ wm_dropbox_free();
+ WM_menutype_free();
+ WM_uilisttype_free();
- /* all non-screen and non-space stuff editors did, like editmode */
- if (C) {
- Main *bmain = CTX_data_main(C);
- ED_editors_exit(bmain, true);
- }
+ /* all non-screen and non-space stuff editors did, like editmode */
+ if (C) {
+ Main *bmain = CTX_data_main(C);
+ ED_editors_exit(bmain, true);
+ }
- ED_undosys_type_free();
+ ED_undosys_type_free();
- free_openrecent();
+ free_openrecent();
- BKE_mball_cubeTable_free();
+ BKE_mball_cubeTable_free();
- /* render code might still access databases */
- RE_FreeAllRender();
- RE_engines_exit();
+ /* render code might still access databases */
+ RE_FreeAllRender();
+ RE_engines_exit();
- ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
+ ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
- if (C && wm) {
- /* Before BKE_blender_free! - since the ListBases get freed there. */
- wm_free_reports(C);
- }
+ if (C && wm) {
+ /* Before BKE_blender_free! - since the ListBases get freed there. */
+ wm_free_reports(C);
+ }
- BKE_sequencer_free_clipboard(); /* sequencer.c */
- BKE_tracking_clipboard_free();
- BKE_mask_clipboard_free();
- BKE_vfont_clipboard_free();
- BKE_node_clipboard_free();
+ BKE_sequencer_free_clipboard(); /* sequencer.c */
+ BKE_tracking_clipboard_free();
+ BKE_mask_clipboard_free();
+ BKE_vfont_clipboard_free();
+ BKE_node_clipboard_free();
#ifdef WITH_COMPOSITOR
- COM_deinitialize();
+ COM_deinitialize();
#endif
- if (opengl_is_init) {
+ if (opengl_is_init) {
#ifdef WITH_OPENSUBDIV
- BKE_subsurf_osd_cleanup();
+ BKE_subsurf_osd_cleanup();
#endif
- GPU_free_unused_buffers(G_MAIN);
- }
-
- BKE_blender_free(); /* blender.c, does entire library and spacetypes */
-// free_matcopybuf();
- ANIM_fcurves_copybuf_free();
- ANIM_drivers_copybuf_free();
- ANIM_driver_vars_copybuf_free();
- ANIM_fmodifiers_copybuf_free();
- ED_gpencil_anim_copybuf_free();
- ED_gpencil_strokes_copybuf_free();
-
- /* free gizmo-maps after freeing blender, so no deleted data get accessed during cleaning up of areas */
- wm_gizmomaptypes_free();
- wm_gizmogrouptype_free();
- wm_gizmotype_free();
-
- BLF_exit();
-
- if (opengl_is_init) {
- DRW_opengl_context_enable_ex(false);
- GPU_pass_cache_free();
- GPU_exit();
- DRW_opengl_context_disable_ex(false);
- DRW_opengl_context_destroy();
- }
+ GPU_free_unused_buffers(G_MAIN);
+ }
+
+ BKE_blender_free(); /* blender.c, does entire library and spacetypes */
+ // free_matcopybuf();
+ ANIM_fcurves_copybuf_free();
+ ANIM_drivers_copybuf_free();
+ ANIM_driver_vars_copybuf_free();
+ ANIM_fmodifiers_copybuf_free();
+ ED_gpencil_anim_copybuf_free();
+ ED_gpencil_strokes_copybuf_free();
+
+ /* free gizmo-maps after freeing blender, so no deleted data get accessed during cleaning up of areas */
+ wm_gizmomaptypes_free();
+ wm_gizmogrouptype_free();
+ wm_gizmotype_free();
+
+ BLF_exit();
+
+ if (opengl_is_init) {
+ DRW_opengl_context_enable_ex(false);
+ GPU_pass_cache_free();
+ GPU_exit();
+ DRW_opengl_context_disable_ex(false);
+ DRW_opengl_context_destroy();
+ }
#ifdef WITH_INTERNATIONAL
- BLF_free_unifont();
- BLF_free_unifont_mono();
- BLT_lang_free();
+ BLF_free_unifont();
+ BLF_free_unifont_mono();
+ BLT_lang_free();
#endif
- ANIM_keyingset_infos_exit();
-
-// free_txt_data();
+ ANIM_keyingset_infos_exit();
+ // free_txt_data();
#ifdef WITH_PYTHON
- /* option not to close python so we can use 'atexit' */
- if (do_python && ((C == NULL) || CTX_py_init_get(C))) {
- /* XXX - old note */
- /* before BKE_blender_free so py's gc happens while library still exists */
- /* needed at least for a rare sigsegv that can happen in pydrivers */
-
- /* Update for blender 2.5, move after BKE_blender_free because blender now holds references to PyObject's
- * so decref'ing them after python ends causes bad problems every time
- * the pyDriver bug can be fixed if it happens again we can deal with it then */
- BPY_python_end();
- }
+ /* option not to close python so we can use 'atexit' */
+ if (do_python && ((C == NULL) || CTX_py_init_get(C))) {
+ /* XXX - old note */
+ /* before BKE_blender_free so py's gc happens while library still exists */
+ /* needed at least for a rare sigsegv that can happen in pydrivers */
+
+ /* Update for blender 2.5, move after BKE_blender_free because blender now holds references to PyObject's
+ * so decref'ing them after python ends causes bad problems every time
+ * the pyDriver bug can be fixed if it happens again we can deal with it then */
+ BPY_python_end();
+ }
#else
- (void)do_python;
+ (void)do_python;
#endif
- ED_file_exit(); /* for fsmenu */
+ ED_file_exit(); /* for fsmenu */
- UI_exit();
- BKE_blender_userdef_data_free(&U, false);
+ UI_exit();
+ BKE_blender_userdef_data_free(&U, false);
- RNA_exit(); /* should be after BPY_python_end so struct python slots are cleared */
+ RNA_exit(); /* should be after BPY_python_end so struct python slots are cleared */
- wm_ghost_exit();
+ wm_ghost_exit();
- CTX_free(C);
+ CTX_free(C);
- GHOST_DisposeSystemPaths();
+ GHOST_DisposeSystemPaths();
- DNA_sdna_current_free();
+ DNA_sdna_current_free();
- BLI_threadapi_exit();
+ BLI_threadapi_exit();
- /* No need to call this early, rather do it late so that other pieces of Blender using sound may exit cleanly,
- * see also T50676. */
- BKE_sound_exit();
+ /* No need to call this early, rather do it late so that other pieces of Blender using sound may exit cleanly,
+ * see also T50676. */
+ BKE_sound_exit();
- CLG_exit();
+ CLG_exit();
- BKE_blender_atexit();
+ BKE_blender_atexit();
- 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: %u, total unfreed memory %f MB\n",
- MEM_get_memory_blocks_in_use(),
- (double)mem_in_use / 1024 / 1024);
- MEM_printmemlist();
- }
- wm_autosave_delete();
+ 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: %u, total unfreed memory %f MB\n",
+ MEM_get_memory_blocks_in_use(),
+ (double)mem_in_use / 1024 / 1024);
+ MEM_printmemlist();
+ }
+ wm_autosave_delete();
- BKE_tempdir_session_purge();
+ BKE_tempdir_session_purge();
}
/**
@@ -609,17 +614,17 @@ void WM_exit_ext(bContext *C, const bool do_python)
*/
void WM_exit(bContext *C)
{
- WM_exit_ext(C, 1);
+ WM_exit_ext(C, 1);
- printf("\nBlender quit\n");
+ printf("\nBlender quit\n");
#ifdef WIN32
- /* ask user to press a key when in debug mode */
- if (G.debug & G_DEBUG) {
- printf("Press any key to exit . . .\n\n");
- wait_for_console_key();
- }
+ /* ask user to press a key when in debug mode */
+ if (G.debug & G_DEBUG) {
+ printf("Press any key to exit . . .\n\n");
+ wait_for_console_key();
+ }
#endif
- exit(G.is_break == true);
+ exit(G.is_break == true);
}