This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/windowmanager/intern/wm_init_exit.c

648 lines
17 KiB
C
Raw Normal View History

/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
2010-02-12 13:34:04 +00:00
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
*/
/** \file
* \ingroup wm
*
* Manage initializing resources and correctly shutting down.
2011-02-25 14:04:21 +00:00
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
#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_callbacks.h"
#include "BLI_listbase.h"
Holiday coding log :) Nice formatted version (pictures soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability Short list of main changes: - Transparent region option (over main region), added code to blend in/out such panels. - Min size window now 640 x 480 - Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake. - Macbook retina support, use command line --no-native-pixels to disable it - Timeline Marker label was drawing wrong - Trackpad and magic mouse: supports zoom (hold ctrl) - Fix for splash position: removed ghost function and made window size update after creation immediate - Fast undo buffer save now adds UI as well. Could be checked for regular file save even... Quit.blend and temp file saving use this now. - Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)" - New Userpref option "Keep Session" - this always saves quit.blend, and loads on start. This allows keeping UI and data without actual saves, until you actually save. When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header) - Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. - User preferences (themes, keymaps, user settings) now can be saved as a separate file. Old option is called "Save Startup File" the new one "Save User Settings". To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still. - OSX: fixed bug that stopped giving mouse events outside window. This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BLI_timer.h"
#include "BLO_writefile.h"
#include "BLO_undofile.h"
#include "BKE_blendfile.h"
#include "BKE_blender.h"
#include "BKE_blender_undo.h"
#include "BKE_context.h"
#include "BKE_font.h"
#include "BKE_global.h"
#include "BKE_icons.h"
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling). This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock was pretty much impossible, except for a few special cases. Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite a few ID usages were missed or wrongly handled that way). One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling by using library_query utils to allow generic handling of those, which is now the case (now, generic ID links handling is only "knwon" from readfile.c and library_query.c). This commit also adds backends to allow live replacement and deletion of datablocks in Blender (so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one, or NULL one in case of unlinking). This will allow nice new features, like ability to easily reload or relocate libraries, real immediate deletion of datablocks in blender, replacement of one datablock by another, etc. Some of those are for next commits. A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core. Though it was tested rather deeply, being totally impossible to check all possible ID usage cases, it's likely there are some remaining issues and bugs in new code... Please report them! ;) Review task: D2027 (https://developer.blender.org/D2027). Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_mball_tessellate.h"
#include "BKE_node.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "BKE_keyconfig.h"
#include "BKE_addon.h"
#include "BKE_appdir.h"
#include "BKE_sequencer.h" /* free seq clipboard */
#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 "RE_engine.h"
#include "RE_pipeline.h" /* RE_ free stuff */
#ifdef WITH_PYTHON
# include "BPY_extern.h"
2008-12-31 05:20:35 +00:00
#endif
#include "GHOST_Path-api.h"
#include "GHOST_C-api.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "WM_message.h"
#include "wm_cursors.h"
Lots of stuff; couldn't commit in parts because of refactor work. * Changes in interface/ module This commit brings back the way how buttons/menus work under control of WM event system. The previous implementation extended usage of handlers and operators in an interesting but confusing way. Better to try it first according the design specs. :) Most obviously: - modal-handler operators are not stored anymore in regions/areas/windows. such modal handlers own their operator, and should remove it themselves. - removed code to move handlers from one queue to another. (needs review with brecht!) - WM fix: the API call to remove a modal handler got removed. This was a dangerous thing anyway, and you should leave that to the event system. Now, if a handler modal() call gets a cancel/finish return, it frees itself in event system. WM_event_remove_modal_handler was a confusing call anyway! Todo: - allow button-activate to refresh after using button - re-enable arrow keys for menus (do both after commit) - review return values of operator callbacks in interface_ops.c * Fixes in WM system - Freeing areas/regions/windows, also on quit, now correctly closes running modal handlers - On starting a modal handler, the handler now stores previous area and region context, so they send proper notifiers etc. * Other fixes - Area-split operator had bug, wrong minimal size checking. This solves error when trying to split a very narrow area. - removed DNA_USHORT_FIX from screen_types.h, gave warning - operators didn't get ID name copied when activated, needed for later re-use or saving.
2008-12-02 14:22:52 +00:00
#include "wm_event_system.h"
#include "wm.h"
#include "wm_files.h"
#include "wm_window.h"
#include "ED_anim_api.h"
#include "ED_armature.h"
#include "ED_gpencil.h"
Animato - Support for 'BuiltIn' and 'Relative' Keying Sets When inserting keyframes in the 3D-View (support will be extended to other editors in due course) using the IKEY hotkey, the menu which appears will now consist of 3 parts: * 'Active Keying Set' - this option allows you to use the user-defined KeyingSet which is active for the current scene (i.e. the one seen in the TimeLine/Outliner headers) * User defined Keying Sets - a list of all such available KeyingSets is included, and entries can be chosen from there * Built-In Keying Sets - see later... To achieve this, several changes needed to be made first: * Added support for 'relative' in addition to 'absolute' Keying Sets. Relative Keying Sets are Keying Sets which operate on data from the current context (i.e. a 'location' KeyingSet will add location keyframes for selected objects/bones/nodes as opposed to location keyframes for some particular object). The is a tentative 'templates' requirement system here, which still needs to be fully fleshed out. * Added support for builtin Keying Sets (i.e. 'Location', 'Rotation', 'Scaling', and 'LocRot' as a few initial demonstrations), which replaces the temporary Insert Keyframe operator for the 3D-View (IKEY). These are effectively relative Keying Set definitions which are included in Blender by default and stored in a list separate from user-defined ones. Volunteer help in defining a few more of these for other editors will be welcome soon. * Removed/replaced much of the crappy temporary Keyframing operator code, though a few tweaks could still be done.
2009-03-31 22:36:13 +00:00
#include "ED_keyframing.h"
#include "ED_keyframes_edit.h"
#include "ED_node.h"
Sorry, three commits in one, became difficult to untangle.. Editors Modules * render/ module added in editors, moved the preview render code there and also shading related operators. * physics/ module made more consistent with other modules. renaming files, making a single physics_ops.c for operators and keymaps. Also move all particle related operators here now. * space_buttons/ now should have only operators relevant to the buttons specificially. Updates & Notifiers * Material/Texture/World/Lamp can now be passed to DAG_id_flush_update, which will go back to a callback in editors. Eventually these should be in the depsgraph itself, but for now this gives a unified call for doing updates. * GLSL materials are now refreshed on changes. There's still various cases missing, * Preview icons now hook into this system, solving various update cases that were missed before. * Also fixes issue in my last commit, where some preview would not render, problem is avoided in the new system. Icon Rendering * On systems with support for non-power of two textures, an OpenGL texture is now used instead of glDrawPixels. This avoids problems with icons get clipped on region borders. On my Linux desktop, this gives an 1.1x speedup, and on my Mac laptop a 2.3x speedup overall in redrawing the full window, with the default setup. The glDrawPixels implementation on Mac seems to have a lot of overhread. * Preview icons are now drawn using proper premul alpha, and never faded so you can see them clearly. * Also tried to fix issue with texture node preview rendering, globals can't be used with threads reliably.
2009-09-29 19:12:12 +00:00
#include "ED_render.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_util.h"
#include "ED_undo.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "BLF_api.h"
#include "BLT_lang.h"
#include "GPU_material.h"
#include "GPU_draw.h"
#include "GPU_immediate.h"
#include "GPU_init_exit.h"
#include "BKE_sound.h"
#include "COM_compositor.h"
#include "DEG_depsgraph.h"
#include "DRW_engine.h"
OpenSubdiv: Commit of OpenSubdiv integration into Blender This commit contains all the remained parts needed for initial integration of OpenSubdiv into Blender's subdivision surface code. Includes both GPU and CPU backends which works in the following way: - When SubSurf modifier is the last in the modifiers stack then GPU pipeline of OpenSubdiv is used, making viewport performance as fast as possible. This also requires graphscard with GLSL 1.5 support. If this requirement is not met, then no GPU pipeline is used at all. - If SubSurf is not a last modifier or if DerivesMesh is being evaluated for rendering then CPU limit evaluation API from OpenSubdiv is used. This only replaces the legacy evaluation code from CCGSubSurf_legacy, but keeps CCG structures exactly the same as they used to be for ages now. This integration is fully covered with ifdef and not enabled by default because there are several TODOs to be solved first: - Face varying data interpolation is not really cleanly implemented for GPU in OpenSubdiv 3.0. It is also not implemented for limit evaluation API. This basically means we'll have really hard time supporting UVs. - Limit evaluation only works with adaptivly subdivided meshes so far, which basically means all the points of CCG are pushed to the limit. This gives different result from old code. - There are some serious optimizations possible on the topology refiner creation, which would speed up initial OpenSubdiv mesh creation. - There are some hardcoded asumptions in the GPU and DerivedMesh areas which could be generalized. That's something where Antony and Campbell can help, making it so the code is structured in a way which is reusable by all planned viewport projects. - There are also some workarounds in the dependency graph to make sure OpenGL buffers are only freed from the main thread. Those who'll be wanting to make experiments with this code should grab dev branch (NOT master) from https://github.com/Nazg-Gul/OpenSubdiv/tree/dev There are some patches applied in there which we're working on on getting into upstream.
2015-07-20 16:08:06 +02:00
#ifdef WITH_OPENSUBDIV
# include "BKE_subsurf.h"
OpenSubdiv: Commit of OpenSubdiv integration into Blender This commit contains all the remained parts needed for initial integration of OpenSubdiv into Blender's subdivision surface code. Includes both GPU and CPU backends which works in the following way: - When SubSurf modifier is the last in the modifiers stack then GPU pipeline of OpenSubdiv is used, making viewport performance as fast as possible. This also requires graphscard with GLSL 1.5 support. If this requirement is not met, then no GPU pipeline is used at all. - If SubSurf is not a last modifier or if DerivesMesh is being evaluated for rendering then CPU limit evaluation API from OpenSubdiv is used. This only replaces the legacy evaluation code from CCGSubSurf_legacy, but keeps CCG structures exactly the same as they used to be for ages now. This integration is fully covered with ifdef and not enabled by default because there are several TODOs to be solved first: - Face varying data interpolation is not really cleanly implemented for GPU in OpenSubdiv 3.0. It is also not implemented for limit evaluation API. This basically means we'll have really hard time supporting UVs. - Limit evaluation only works with adaptivly subdivided meshes so far, which basically means all the points of CCG are pushed to the limit. This gives different result from old code. - There are some serious optimizations possible on the topology refiner creation, which would speed up initial OpenSubdiv mesh creation. - There are some hardcoded asumptions in the GPU and DerivedMesh areas which could be generalized. That's something where Antony and Campbell can help, making it so the code is structured in a way which is reusable by all planned viewport projects. - There are also some workarounds in the dependency graph to make sure OpenGL buffers are only freed from the main thread. Those who'll be wanting to make experiments with this code should grab dev branch (NOT master) from https://github.com/Nazg-Gul/OpenSubdiv/tree/dev There are some patches applied in there which we're working on on getting into upstream.
2015-07-20 16:08:06 +02:00
#endif
CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_OPERATORS, "wm.operator");
CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_HANDLERS, "wm.handler");
CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_EVENTS, "wm.event");
CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_KEYMAPS, "wm.keymap");
CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_TOOLS, "wm.tool");
2018-05-08 08:34:06 +02:00
CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_MSGBUS_PUB, "wm.msgbus.pub");
CLG_LOGREF_DECLARE_GLOBAL(WM_LOG_MSGBUS_SUB, "wm.msgbus.sub");
static void wm_init_reports(bContext *C)
{
ReportList *reports = CTX_wm_reports(C);
BLI_assert(!reports || BLI_listbase_is_empty(&reports->list));
BKE_reports_init(reports, RPT_STORE);
}
static void wm_free_reports(bContext *C)
{
ReportList *reports = CTX_wm_reports(C);
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;
}
/**
* 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 deferre 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).
2019-03-19 15:17:46 +11:00
*/
static bool opengl_is_init = false;
void WM_init_opengl(Main *bmain)
{
/* 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);
}
/* 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_pass_cache_init();
#ifdef WITH_OPENSUBDIV
BKE_subsurf_osd_init();
#endif
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();
}
GHOST_CreateSystemPaths();
BKE_addon_pref_type_init();
BKE_keyconfig_pref_type_init();
wm_operatortype_init();
wm_operatortypes_register();
WM_paneltype_init(); /* Lookup table only. */
WM_menutype_init();
WM_uilisttype_init();
wm_gizmotype_init();
wm_gizmogrouptype_init();
ED_undosys_type_init();
2016-06-25 21:10:30 +10:00
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_file_init(); /* for fsmenu */
ED_node_init_butfuncs();
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);
/* 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);
WM_msgbus_types_init();
/* get the default database, plus a wm */
bool is_factory_startup = true;
const bool use_data = true;
const bool use_userdef = true;
wm_homefile_read(C,
NULL,
G.factory_startup,
false,
use_data,
use_userdef,
NULL,
WM_init_state_app_template_get(),
&is_factory_startup);
/* Call again to set from userpreferences... */
BLT_lang_set(NULL);
if (!G.background) {
#ifdef WITH_INPUT_NDOF
/* sets 3D mouse deadzone */
WM_ndof_deadzone_set(U.ndof_deadzone);
#endif
WM_init_opengl(G_MAIN);
UI_init();
}
BKE_studiolight_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. */
#ifdef WITH_PYTHON
BPY_context_set(C); /* necessary evil */
BPY_python_start(argc, argv);
BPY_python_reset(C);
2010-10-23 16:03:31 +00:00
#else
(void)argc; /* unused */
(void)argv; /* unused */
#endif
if (!G.background && !wm_start_with_console) {
GHOST_toggleConsole(3);
}
clear_matcopybuf();
ED_render_clear_mtex_copybuf();
// glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
wm_history_file_read();
/* allow a path of "", this is what happens when making a new file */
2012-03-09 18:28:30 +00:00
#if 0
if (BKE_main_blendfile_path_from_global()[0] == '\0')
BLI_make_file_string("/", G_MAIN->name, BKE_appdir_folder_default(), "untitled.blend");
2012-03-09 18:28:30 +00:00
#endif
BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib));
2012-07-16 08:42:55 +00:00
#ifdef WITH_COMPOSITOR
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);
}
}
}
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);
}
}
}
/* free strings of open recent files */
static void free_openrecent(void)
{
struct RecentFile *recent;
for (recent = G.recent_files.first; recent; recent = recent->next) {
MEM_freeN(recent->filepath);
}
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;
}
}
}
}
#endif
static int wm_exit_handler(bContext *C, const wmEvent *event, void *userdata)
{
WM_exit(C);
UNUSED_VARS(event, userdata);
return WM_UI_HANDLER_BREAK;
}
/**
* Cause a delayed #WM_exit()
* call to avoid leaking memory when trying to exit from within operators.
*/
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. */
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 */
}
2016-01-24 14:25:01 +11:00
/**
* \note doesn't run exit() call #WM_exit() for that.
*/
void WM_exit_ext(bContext *C, const bool do_python)
{
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;
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);
Holiday coding log :) Nice formatted version (pictures soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability Short list of main changes: - Transparent region option (over main region), added code to blend in/out such panels. - Min size window now 640 x 480 - Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake. - Macbook retina support, use command line --no-native-pixels to disable it - Timeline Marker label was drawing wrong - Trackpad and magic mouse: supports zoom (hold ctrl) - Fix for splash position: removed ghost function and made window size update after creation immediate - Fast undo buffer save now adds UI as well. Could be checked for regular file save even... Quit.blend and temp file saving use this now. - Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)" - New Userpref option "Keep Session" - this always saves quit.blend, and loads on start. This allows keeping UI and data without actual saves, until you actually save. When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header) - Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. - User preferences (themes, keymaps, user settings) now can be saved as a separate file. Old option is called "Save Startup File" the new one "Save User Settings". To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still. - OSX: fixed bug that stopped giving mouse events outside window. This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
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);
}
}
}
WM_jobs_kill_all(wm);
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));
}
/* Disable until we have a revert button. */
#if 0
if (U.runtime.is_dirty) {
BKE_blendfile_userdef_write_all(NULL);
}
#endif
}
BLI_timer_free();
WM_paneltype_clear();
BKE_addon_pref_type_free();
BKE_keyconfig_pref_type_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);
}
ED_undosys_type_free();
free_openrecent();
BKE_mball_cubeTable_free();
/* render code might still access databases */
RE_FreeAllRender();
RE_engines_exit();
ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
2009-08-02 11:32:03 +00:00
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();
#ifdef WITH_COMPOSITOR
COM_deinitialize();
#endif
if (opengl_is_init) {
#ifdef WITH_OPENSUBDIV
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();
}
#ifdef WITH_INTERNATIONAL
BLF_free_unifont();
BLF_free_unifont_mono();
BLT_lang_free();
#endif
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 py-driver bug can be fixed if it happens again we can deal with it then. */
BPY_python_end();
}
#else
(void)do_python;
#endif
ED_file_exit(); /* for fsmenu */
UI_exit();
BKE_blender_userdef_data_free(&U, false);
RNA_exit(); /* should be after BPY_python_end so struct python slots are cleared */
wm_ghost_exit();
CTX_free(C);
GHOST_DisposeSystemPaths();
DNA_sdna_current_free();
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();
CLG_exit();
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();
BKE_tempdir_session_purge();
}
/**
* \brief Main exit function to close Blender ordinarily.
* \note Use #wm_exit_schedule_delayed() to close Blender from an operator.
* Might leak memory otherwise.
*/
void WM_exit(bContext *C)
{
WM_exit_ext(C, 1);
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();
}
#endif
exit(G.is_break == true);
}