Blender
V3.3
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "CLG_log.h"
#include "DNA_genfile.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BLI_threads.h"
#include "BLI_timer.h"
#include "BLI_utildefines.h"
#include "BLO_undofile.h"
#include "BLO_writefile.h"
#include "BKE_blender.h"
#include "BKE_blendfile.h"
#include "BKE_callbacks.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_image.h"
#include "BKE_keyconfig.h"
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_mball_tessellate.h"
#include "BKE_node.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_sound.h"
#include "BKE_vfont.h"
#include "BKE_addon.h"
#include "BKE_appdir.h"
#include "BKE_mask.h"
#include "BKE_material.h"
#include "BKE_studiolight.h"
#include "BKE_subdiv.h"
#include "BKE_tracking.h"
#include "RE_engine.h"
#include "RE_pipeline.h"
#include "SEQ_clipboard.h"
#include "IMB_thumbs.h"
#include "GHOST_C-api.h"
#include "GHOST_Path-api.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_types.h"
#include "wm.h"
#include "wm_cursors.h"
#include "wm_event_system.h"
#include "wm_files.h"
#include "wm_platform_support.h"
#include "wm_surface.h"
#include "wm_window.h"
#include "ED_anim_api.h"
#include "ED_armature.h"
#include "ED_asset.h"
#include "ED_gpencil.h"
#include "ED_keyframes_edit.h"
#include "ED_keyframing.h"
#include "ED_node.h"
#include "ED_render.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_undo.h"
#include "ED_util.h"
#include "ED_view3d.h"
#include "BLF_api.h"
#include "BLT_lang.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "GPU_context.h"
#include "GPU_init_exit.h"
#include "GPU_material.h"
#include "COM_compositor.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "DRW_engine.h"
Go to the source code of this file.
Variables | |
static bool | wm_start_with_console = false |
static bool | opengl_is_init = false |
Manage initializing resources and correctly shutting down.
Definition in file wm_init_exit.c.
CLG_LOGREF_DECLARE_GLOBAL | ( | WM_LOG_EVENTS | , |
"wm.event" | |||
) |
CLG_LOGREF_DECLARE_GLOBAL | ( | WM_LOG_HANDLERS | , |
"wm.handler" | |||
) |
CLG_LOGREF_DECLARE_GLOBAL | ( | WM_LOG_KEYMAPS | , |
"wm.keymap" | |||
) |
CLG_LOGREF_DECLARE_GLOBAL | ( | WM_LOG_MSGBUS_PUB | , |
"wm.msgbus.pub" | |||
) |
CLG_LOGREF_DECLARE_GLOBAL | ( | WM_LOG_MSGBUS_SUB | , |
"wm.msgbus.sub" | |||
) |
CLG_LOGREF_DECLARE_GLOBAL | ( | WM_LOG_OPERATORS | , |
"wm.operator" | |||
) |
CLG_LOGREF_DECLARE_GLOBAL | ( | WM_LOG_TOOLS | , |
"wm.tool" | |||
) |
Definition at line 381 of file wm_init_exit.c.
References BLI_freelistN(), G, LISTBASE_FOREACH, and MEM_freeN.
Referenced by WM_exit_ex().
Definition at line 186 of file wm_init_exit.c.
References Scene::audio, AUDIO_SYNC, BKE_scene_get_depsgraph(), BKE_sound_jack_scene_update(), BKE_sound_lock(), BKE_sound_unlock(), DEG_get_evaluated_scene(), depsgraph, ListBase::first, AudioData::flag, G, LISTBASE_FOREACH, NULL, scene, time, wmWindowManager::windows, Main::wm, WM_window_get_active_scene(), and WM_window_get_active_view_layer().
Referenced by BKE_sound_jack_sync_callback_set(), and WM_init().
Main exit function to close Blender ordinarily.
Definition at line 646 of file wm_init_exit.c.
References C, G, G_DEBUG, and WM_exit_ex().
Referenced by arg_handle_load_file(), main(), and wm_exit_handler().
Definition at line 434 of file wm_init_exit.c.
References ANIM_driver_vars_copybuf_free(), ANIM_drivers_copybuf_free(), ANIM_fcurves_copybuf_free(), ANIM_fmodifiers_copybuf_free(), ANIM_keyingset_infos_exit(), BKE_addon_pref_type_free(), BKE_appdir_exit(), BKE_blender_atexit(), BKE_blender_free(), BKE_blender_userdef_data_free(), BKE_blendfile_userdef_write_all(), BKE_image_free_unused_gpu_textures(), BKE_keyconfig_pref_type_free(), BKE_mask_clipboard_free(), BKE_materials_exit(), BKE_mball_cubeTable_free(), BKE_node_clipboard_free(), BKE_sound_exit(), BKE_subdiv_exit(), BKE_tempdir_base(), BKE_tempdir_session_purge(), BKE_tracking_clipboard_free(), BKE_vfont_clipboard_free(), BLENDER_QUIT_FILE, BLF_exit(), BLI_join_dirfile(), BLI_task_scheduler_exit(), BLI_threadapi_exit(), BLI_timer_free(), BLO_memfile_write_file(), BLO_write_file(), BLT_lang_free(), BPY_python_end(), BPY_run_string_eval(), C, CLG_exit(), COM_deinitialize(), CTX_data_main(), CTX_free(), CTX_py_init_get(), CTX_wm_manager(), CTX_wm_window_set(), DNA_sdna_current_free(), DRW_opengl_context_destroy(), DRW_opengl_context_disable_ex(), DRW_opengl_context_enable_ex(), DRW_subdiv_free(), ED_assetlist_storage_exit(), ED_editors_exit(), ED_editors_flush_edits(), ED_file_exit(), ED_gpencil_anim_copybuf_free(), ED_gpencil_strokes_copybuf_free(), ED_preview_free_dbase(), ED_preview_restart_queue_free(), ED_screen_exit(), ED_undosys_stack_memfile_get_active(), ED_undosys_type_free(), FILE_MAX, free_openrecent(), G, G_FILE_COMPRESS, G_FLAG_USERPREF_NO_SAVE_ON_EXIT, GHOST_DisposeSystemPaths(), GPU_exit(), GPU_pass_cache_free(), LISTBASE_FOREACH, NULL, opengl_is_init, RE_engines_exit(), RE_FreeAllRender(), RNA_exit(), SEQ_clipboard_free(), UI_exit(), wmWindowManager::undo_stack, USER_PREF_FLAG_SAVE, void, wmWindowManager::windows, wm_autosave_delete(), wm_dropbox_free(), WM_event_remove_handlers(), wm_free_reports(), wm_ghost_exit(), wm_gizmogrouptype_free(), wm_gizmomaptypes_free(), wm_gizmotype_free(), WM_jobs_kill_all(), WM_menutype_free(), wm_operatortype_free(), WM_paneltype_clear(), wm_surfaces_free(), wm_test_autorun_revert_action_set(), WM_uilisttype_free(), and WM_window_get_active_screen().
Referenced by bpy_atexit(), and WM_exit().
Definition at line 413 of file wm_init_exit.c.
References C, UNUSED_VARS, WM_exit(), and WM_UI_HANDLER_BREAK.
Referenced by wm_exit_schedule_delayed().
Cause a delayed WM_exit() call to avoid leaking memory when trying to exit from within operators.
Definition at line 421 of file wm_init_exit.c.
References C, CTX_wm_window(), wmWindow::modalhandlers, NULL, WM_event_add_mousemove(), WM_event_add_ui_handler(), and wm_exit_handler().
Referenced by ghost_event_proc(), wm_exit_blender_exec(), wm_exit_blender_invoke(), wm_quit_with_optional_confirmation_prompt(), wm_save_as_mainfile_exec(), and wm_save_file_on_quit_dialog_callback().
|
static |
Definition at line 141 of file wm_init_exit.c.
References BKE_reports_clear(), and wmWindowManager::reports.
Referenced by WM_exit_ex().
Initialize Blender and load the startup file & preferences (only called once).
NOTE(@campbellbarton): Startup file and order of initialization.
Loading BLENDER_STARTUP_FILE, BLENDER_USERPREF_FILE, starting Python and other sub-systems, have inter-dependencies, for example.
Loading preferences early, then application subsystems and finally the startup data would simplify things if it weren't for key-maps being part of the window-manager which is blend file data. Creating a dummy window-manager early, or moving the key-maps into the preferences would resolve this and may be worth looking into long-term, see: D12184 for details.
Definition at line 212 of file wm_init_exit.c.
References BIFICONID_LAST, BKE_addon_pref_type_init(), BKE_icons_init(), BKE_keyconfig_pref_type_init(), BKE_library_callback_free_notifier_reference_set(), BKE_library_callback_remap_editor_id_reference_set(), BKE_main_blendfile_path_from_global(), BKE_material_copybuf_clear(), BKE_region_callback_free_gizmomap_set(), BKE_region_callback_refresh_tag_gizmomap_set(), BKE_sound_jack_sync_callback_set(), BKE_spacedata_callback_id_remap_set(), BKE_studiolight_init(), BKE_subdiv_init(), BLF_init(), BLI_assert, BLI_strncpy(), BLT_lang_init(), BLT_lang_set(), BPY_python_reset(), BPY_python_start(), C, DEG_editors_set_update_cb(), ED_file_init(), ED_node_init_butfuncs(), ED_render_clear_mtex_copybuf(), ED_render_id_flush_update(), ED_render_scene_update(), ED_spacedata_id_remap_single(), ED_spacemacros_init(), ED_spacetypes_init(), ED_undosys_type_init(), G, G_FILE_NO_UI, G_MAIN, GHOST_CreateSystemPaths(), GHOST_kConsoleWindowStateHideForNonConsoleLaunch, GHOST_kConsoleWindowStateShow, GHOST_setConsoleWindowState(), GPU_context_active_get(), GPU_context_begin_frame(), GPU_context_end_frame(), GPU_render_begin(), GPU_render_end(), IMB_thumb_clear_translations(), NULL, sound_jack_sync_callback(), UI_init(), UNUSED_VARS, wm_ghost_init(), wm_gizmogrouptype_init(), wm_gizmomap_remove(), WM_gizmomap_tag_refresh(), wm_gizmotype_init(), wm_history_file_read(), wm_homefile_read_ex(), wm_homefile_read_post(), wm_init_cursor_data(), WM_init_opengl(), wm_init_reports(), WM_init_state_app_template_get(), WM_main_remap_editor_id_reference(), WM_main_remove_notifier_reference(), WM_menutype_init(), WM_msgbus_types_init(), wm_operatortype_init(), wm_operatortypes_register(), WM_paneltype_init(), WM_platform_support_perform_checks(), wm_start_with_console, and WM_uilisttype_init().
Referenced by main().
Definition at line 162 of file wm_init_exit.c.
References BLI_assert, DRW_opengl_context_create(), G, GPU_backend_supported(), GPU_init(), GPU_pass_cache_init(), NULL, opengl_is_init, and wm_ghost_init().
Referenced by DRW_opengl_context_enable(), DRW_render_context_enable(), and WM_init().
Definition at line 133 of file wm_init_exit.c.
References BKE_reports_init(), BLI_assert, BLI_listbase_is_empty(), C, CTX_wm_reports(), ReportList::list, and RPT_STORE.
Referenced by WM_init().
Definition at line 366 of file wm_init_exit.c.
References C, CTX_wm_manager(), CTX_wm_window(), CTX_wm_window_set(), ListBase::first, NULL, USER_SPLASH_DISABLE, wmWindowManager::windows, WM_OP_INVOKE_DEFAULT, and WM_operator_name_call().
Referenced by main(), and wm_homefile_read_exec().
Definition at line 148 of file wm_init_exit.c.
References wm_start_with_console.
Referenced by arg_handle_start_with_console().
Needed for cases when operators are re-registered (when operator type pointers are stored).
Definition at line 663 of file wm_init_exit.c.
References UI_interface_tag_script_reload().
|
static |
Since we cannot know in advance if we will require the draw manager context when starting blender in background mode (specially true with scripts) we defer the ghost initialization the most as possible so that it does not break anything that can run in headless mode (as in without display server attached).
Definition at line 160 of file wm_init_exit.c.
Referenced by WM_exit_ex(), and WM_init_opengl().
|
static |
Definition at line 146 of file wm_init_exit.c.
Referenced by WM_init(), and WM_init_state_start_with_console_set().