2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2007-12-24 18:27:28 +00:00
|
|
|
* 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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2007-12-24 18:27:28 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2007-12-24 18:27:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup wm
|
2014-01-19 23:14:24 +11:00
|
|
|
*
|
|
|
|
* Manage initializing resources and correctly shutting down.
|
2011-02-25 14:04:21 +00:00
|
|
|
*/
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2018-05-09 11:20:12 +02:00
|
|
|
#ifdef _WIN32
|
2018-07-19 17:20:48 +02:00
|
|
|
# define WIN32_LEAN_AND_MEAN
|
2013-02-19 12:05:38 +00:00
|
|
|
# include <windows.h>
|
2012-07-26 16:56:09 +00:00
|
|
|
#endif
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2018-03-29 20:38:32 +02:00
|
|
|
#include "CLG_log.h"
|
|
|
|
|
2016-07-12 12:53:49 +10:00
|
|
|
#include "DNA_genfile.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
2013-03-28 06:36:09 +00:00
|
|
|
#include "BLI_callbacks.h"
|
2012-10-30 19:20:17 +00:00
|
|
|
#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"
|
2012-10-30 19:20:17 +00:00
|
|
|
#include "BLI_string.h"
|
2013-08-19 10:51:40 +00:00
|
|
|
#include "BLI_threads.h"
|
2012-10-30 19:20:17 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2018-11-26 20:25:15 +01:00
|
|
|
#include "BLI_timer.h"
|
2012-10-30 19:20:17 +00:00
|
|
|
|
2014-10-10 11:48:48 +02:00
|
|
|
#include "BLO_writefile.h"
|
2018-03-19 14:17:59 +01:00
|
|
|
#include "BLO_undofile.h"
|
2014-10-10 11:48:48 +02:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_blender.h"
|
2016-04-24 22:42:41 +10:00
|
|
|
#include "BKE_blender_undo.h"
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_font.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_global.h"
|
2015-05-16 06:18:04 +10:00
|
|
|
#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"
|
2010-08-16 12:14:09 +00:00
|
|
|
#include "BKE_main.h"
|
2015-04-07 12:44:39 +10:00
|
|
|
#include "BKE_mball_tessellate.h"
|
2012-08-06 08:25:24 +00:00
|
|
|
#include "BKE_node.h"
|
2009-07-16 00:50:27 +00:00
|
|
|
#include "BKE_report.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_screen.h"
|
2018-11-16 11:24:49 +11:00
|
|
|
#include "BKE_keyconfig.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2012-12-29 10:24:42 +00:00
|
|
|
#include "BKE_addon.h"
|
2014-11-23 14:37:13 +01:00
|
|
|
#include "BKE_appdir.h"
|
2009-12-17 16:28:45 +00:00
|
|
|
#include "BKE_sequencer.h" /* free seq clipboard */
|
2018-05-11 16:55:14 +02:00
|
|
|
#include "BKE_studiolight.h"
|
2010-03-09 09:17:45 +00:00
|
|
|
#include "BKE_material.h" /* clear_matcopybuf */
|
2012-01-09 20:18:48 +00:00
|
|
|
#include "BKE_tracking.h" /* free tracking clipboard */
|
2014-01-27 15:41:16 +06:00
|
|
|
#include "BKE_mask.h" /* free mask clipboard */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2011-10-22 16:24:28 +00:00
|
|
|
#include "RE_engine.h"
|
2012-03-27 01:24:16 +00:00
|
|
|
#include "RE_pipeline.h" /* RE_ free stuff */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BPY_extern.h"
|
2008-12-31 05:20:35 +00:00
|
|
|
#endif
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2011-01-05 14:00:14 +00:00
|
|
|
#include "GHOST_Path-api.h"
|
2011-05-02 08:07:24 +00:00
|
|
|
#include "GHOST_C-api.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2008-11-21 19:14:38 +00:00
|
|
|
#include "RNA_define.h"
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "WM_api.h"
|
2008-01-01 15:53:38 +00:00
|
|
|
#include "WM_types.h"
|
2017-11-13 19:43:34 +11:00
|
|
|
#include "WM_message.h"
|
2008-12-15 16:54:47 +00:00
|
|
|
|
|
|
|
#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"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "wm.h"
|
|
|
|
#include "wm_files.h"
|
|
|
|
#include "wm_window.h"
|
|
|
|
|
2016-04-03 01:18:23 +13:00
|
|
|
#include "ED_anim_api.h"
|
2009-03-22 00:30:18 +00:00
|
|
|
#include "ED_armature.h"
|
2015-01-01 12:36:01 +13:00
|
|
|
#include "ED_gpencil.h"
|
2009-03-31 22:36:13 +00:00
|
|
|
#include "ED_keyframing.h"
|
2016-04-03 01:18:23 +13:00
|
|
|
#include "ED_keyframes_edit.h"
|
2009-01-27 17:12:40 +00:00
|
|
|
#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"
|
2009-01-06 18:14:37 +00:00
|
|
|
#include "ED_space_api.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "ED_screen.h"
|
2008-12-31 17:11:42 +00:00
|
|
|
#include "ED_util.h"
|
2018-04-02 15:02:08 +02:00
|
|
|
#include "ED_undo.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "UI_interface.h"
|
2018-07-24 12:43:21 +02:00
|
|
|
#include "UI_resources.h"
|
2009-01-29 05:19:27 +00:00
|
|
|
#include "BLF_api.h"
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_lang.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2018-03-11 23:43:09 +01:00
|
|
|
#include "GPU_material.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "GPU_draw.h"
|
2018-07-19 15:48:13 +02:00
|
|
|
#include "GPU_immediate.h"
|
2014-10-07 15:46:19 -05:00
|
|
|
#include "GPU_init_exit.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2009-08-09 21:16:39 +00:00
|
|
|
#include "BKE_sound.h"
|
2012-08-13 10:56:36 +00:00
|
|
|
#include "COM_compositor.h"
|
2009-07-16 00:50:27 +00:00
|
|
|
|
2017-04-06 16:44:32 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
2018-02-26 19:41:17 +01:00
|
|
|
#include "DRW_engine.h"
|
|
|
|
|
2015-07-20 16:08:06 +02:00
|
|
|
#ifdef WITH_OPENSUBDIV
|
2015-11-04 21:30:25 +05:00
|
|
|
# include "BKE_subsurf.h"
|
2015-07-20 16:08:06 +02:00
|
|
|
#endif
|
|
|
|
|
2018-03-29 20:38:32 +02:00
|
|
|
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");
|
2018-05-03 07:31:55 +02:00
|
|
|
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");
|
2018-03-29 20:38:32 +02:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
static void wm_init_reports(bContext *C)
|
|
|
|
{
|
2014-06-18 15:48:38 +10:00
|
|
|
ReportList *reports = CTX_wm_reports(C);
|
|
|
|
|
|
|
|
BLI_assert(!reports || BLI_listbase_is_empty(&reports->list));
|
|
|
|
|
|
|
|
BKE_reports_init(reports, RPT_STORE);
|
2009-07-16 00:50:27 +00:00
|
|
|
}
|
|
|
|
static void wm_free_reports(bContext *C)
|
|
|
|
{
|
2014-06-18 15:48:38 +10:00
|
|
|
ReportList *reports = CTX_wm_reports(C);
|
|
|
|
|
|
|
|
BKE_reports_clear(reports);
|
2009-07-16 00:50:27 +00:00
|
|
|
}
|
|
|
|
|
2019-02-23 17:23:03 +11:00
|
|
|
static bool wm_start_with_console = false;
|
|
|
|
|
|
|
|
void WM_init_state_start_with_console_set(bool value)
|
|
|
|
{
|
|
|
|
wm_start_with_console = value;
|
|
|
|
}
|
2009-07-16 00:50:27 +00:00
|
|
|
|
2018-04-25 17:43:08 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
*/
|
2018-04-25 17:43:08 +02:00
|
|
|
static bool opengl_is_init = false;
|
|
|
|
|
2018-06-25 12:50:32 +02:00
|
|
|
void WM_init_opengl(Main *bmain)
|
2018-04-25 17:43:08 +02:00
|
|
|
{
|
|
|
|
/* 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();
|
2018-06-25 12:50:32 +02:00
|
|
|
GPU_set_mipmap(bmain, true);
|
2018-04-25 17:43:08 +02:00
|
|
|
GPU_set_linear_mipmap(true);
|
2018-06-25 12:50:32 +02:00
|
|
|
GPU_set_anisotropic(bmain, U.anisotropic_filter);
|
2018-04-25 17:43:08 +02:00
|
|
|
|
2018-06-07 11:58:15 +02:00
|
|
|
GPU_pass_cache_init();
|
|
|
|
|
2018-04-25 17:43:08 +02:00
|
|
|
#ifdef WITH_OPENSUBDIV
|
|
|
|
BKE_subsurf_osd_init();
|
|
|
|
#endif
|
|
|
|
opengl_is_init = true;
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* only called once, for startup */
|
2011-02-19 12:05:20 +00:00
|
|
|
void WM_init(bContext *C, int argc, const char **argv)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2009-11-11 04:08:09 +00:00
|
|
|
if (!G.background) {
|
2012-03-27 01:24:16 +00:00
|
|
|
wm_ghost_init(C); /* note: it assigns C to ghost! */
|
2009-11-11 04:08:09 +00:00
|
|
|
wm_init_cursor_data();
|
|
|
|
}
|
2018-04-25 17:43:08 +02:00
|
|
|
|
2011-01-05 14:00:14 +00:00
|
|
|
GHOST_CreateSystemPaths();
|
2012-12-29 10:24:42 +00:00
|
|
|
|
|
|
|
BKE_addon_pref_type_init();
|
2018-11-16 11:24:49 +11:00
|
|
|
BKE_keyconfig_pref_type_init();
|
2012-12-29 10:24:42 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
wm_operatortype_init();
|
2018-07-13 12:15:18 +02:00
|
|
|
wm_operatortypes_register();
|
|
|
|
|
2018-07-13 18:39:46 +02:00
|
|
|
WM_paneltype_init(); /* Lookup table only. */
|
2011-08-11 06:06:17 +00:00
|
|
|
WM_menutype_init();
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
WM_uilisttype_init();
|
2018-07-14 23:49:00 +02:00
|
|
|
wm_gizmotype_init();
|
|
|
|
wm_gizmogrouptype_init();
|
2011-08-11 06:06:17 +00:00
|
|
|
|
2018-03-19 14:17:59 +01:00
|
|
|
ED_undosys_type_init();
|
2016-06-25 21:10:30 +10:00
|
|
|
|
2015-05-04 12:29:38 +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 */
|
2018-07-14 23:49:00 +02:00
|
|
|
BKE_region_callback_free_gizmomap_set(wm_gizmomap_remove); /* screen.c */
|
|
|
|
BKE_region_callback_refresh_tag_gizmomap_set(WM_gizmomap_tag_refresh);
|
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
|
|
|
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 */
|
2017-04-06 16:44:32 +02:00
|
|
|
DEG_editors_set_update_cb(ED_render_id_flush_update,
|
2017-11-28 12:56:01 +01:00
|
|
|
ED_render_scene_update);
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
ED_spacetypes_init(); /* editors/space_api/spacetype.c */
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
ED_file_init(); /* for fsmenu */
|
2012-08-01 13:28:19 +00:00
|
|
|
ED_node_init_butfuncs();
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2018-04-16 14:07:42 +02:00
|
|
|
BLF_init();
|
2018-10-22 10:39:57 +02:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
BLT_lang_init();
|
2018-10-22 10:39:57 +02:00
|
|
|
/* Must call first before doing any .blend file reading, since versionning code may create new IDs... See T57066. */
|
|
|
|
BLT_lang_set(NULL);
|
2012-07-27 14:53:57 +00:00
|
|
|
|
2018-07-24 12:43:21 +02:00
|
|
|
/* 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);
|
|
|
|
|
2015-09-22 15:56:03 +10:00
|
|
|
/* reports cant be initialized before the wm,
|
|
|
|
* but keep before file reading, since that may report errors */
|
|
|
|
wm_init_reports(C);
|
|
|
|
|
2017-11-13 19:43:34 +11:00
|
|
|
WM_msgbus_types_init();
|
|
|
|
|
2010-01-18 18:52:03 +00:00
|
|
|
/* get the default database, plus a wm */
|
2018-11-30 13:33:13 +11:00
|
|
|
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);
|
2015-07-01 13:45:19 +10:00
|
|
|
|
2018-10-22 10:39:57 +02:00
|
|
|
/* Call again to set from userpreferences... */
|
2015-08-16 17:32:01 +10:00
|
|
|
BLT_lang_set(NULL);
|
2011-09-15 13:20:18 +00:00
|
|
|
|
2015-05-11 16:29:12 +02:00
|
|
|
if (!G.background) {
|
2016-08-18 00:21:55 -04:00
|
|
|
|
|
|
|
#ifdef WITH_INPUT_NDOF
|
2015-07-02 15:59:12 +02:00
|
|
|
/* sets 3D mouse deadzone */
|
|
|
|
WM_ndof_deadzone_set(U.ndof_deadzone);
|
2016-08-18 00:21:55 -04:00
|
|
|
#endif
|
2018-06-25 12:50:32 +02:00
|
|
|
WM_init_opengl(G_MAIN);
|
2015-09-16 22:23:07 +05:00
|
|
|
|
2015-05-16 06:18:04 +10:00
|
|
|
UI_init();
|
|
|
|
}
|
2015-05-11 16:29:12 +02:00
|
|
|
|
2019-02-06 12:10:11 +01:00
|
|
|
BKE_studiolight_init();
|
|
|
|
|
2014-12-26 19:13:32 +01:00
|
|
|
ED_spacemacros_init();
|
|
|
|
|
2010-01-18 18:52:03 +00:00
|
|
|
/* note: there is a bug where python needs initializing before loading the
|
2010-09-27 23:33:10 +00:00
|
|
|
* startup.blend because it may contain PyDrivers. It also needs to be after
|
2010-01-18 18:52:03 +00:00
|
|
|
* initializing space types and other internal data.
|
|
|
|
*
|
|
|
|
* However cant redo this at the moment. Solution is to load python
|
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
|
|
|
* before wm_homefile_read() or make py-drivers check if python is running.
|
2010-01-18 18:52:03 +00:00
|
|
|
* Will try fix when the crash can be repeated. - campbell. */
|
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2011-01-05 02:08:54 +00:00
|
|
|
BPY_context_set(C); /* necessary evil */
|
|
|
|
BPY_python_start(argc, argv);
|
2010-11-27 02:39:51 +00:00
|
|
|
|
2013-06-09 23:31:53 +00:00
|
|
|
BPY_python_reset(C);
|
2010-10-23 16:03:31 +00:00
|
|
|
#else
|
|
|
|
(void)argc; /* unused */
|
|
|
|
(void)argv; /* unused */
|
2010-01-10 20:01:13 +00:00
|
|
|
#endif
|
|
|
|
|
2019-04-13 09:15:15 +02:00
|
|
|
if (!G.background && !wm_start_with_console) {
|
2011-05-02 08:07:24 +00:00
|
|
|
GHOST_toggleConsole(3);
|
2019-04-13 09:15:15 +02:00
|
|
|
}
|
2011-05-02 08:07:24 +00:00
|
|
|
|
2010-03-09 09:17:45 +00:00
|
|
|
clear_matcopybuf();
|
2010-03-29 05:37:34 +00:00
|
|
|
ED_render_clear_mtex_copybuf();
|
2010-03-09 09:17:45 +00:00
|
|
|
|
2018-02-14 01:01:29 +01:00
|
|
|
// glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
2015-07-22 11:24:38 +02:00
|
|
|
|
2015-08-09 12:53:09 +10:00
|
|
|
wm_history_file_read();
|
2010-07-15 21:39:47 +00:00
|
|
|
|
2011-01-20 07:38:00 +00:00
|
|
|
/* allow a path of "", this is what happens when making a new file */
|
2012-03-09 18:28:30 +00:00
|
|
|
#if 0
|
2018-06-05 15:10:33 +02:00
|
|
|
if (BKE_main_blendfile_path_from_global()[0] == '\0')
|
2018-06-14 12:34:13 +02:00
|
|
|
BLI_make_file_string("/", G_MAIN->name, BKE_appdir_folder_default(), "untitled.blend");
|
2012-03-09 18:28:30 +00:00
|
|
|
#endif
|
2010-07-15 21:39:47 +00:00
|
|
|
|
2018-06-05 15:10:33 +02:00
|
|
|
BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib));
|
2012-07-16 08:42:55 +00:00
|
|
|
|
2012-07-17 10:19:47 +00:00
|
|
|
#ifdef WITH_COMPOSITOR
|
2012-07-16 08:42:55 +00:00
|
|
|
if (1) {
|
|
|
|
extern void *COM_linker_hack;
|
|
|
|
COM_linker_hack = COM_execute;
|
|
|
|
}
|
2012-07-17 10:19:47 +00:00
|
|
|
#endif
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2019-02-08 08:36:52 +11:00
|
|
|
{
|
2018-06-14 12:34:13 +02:00
|
|
|
Main *bmain = CTX_data_main(C);
|
2015-09-22 16:45:23 +10:00
|
|
|
/* note, logic here is from wm_file_read_post,
|
|
|
|
* call functions that depend on Python being initialized. */
|
|
|
|
|
2013-03-28 06:36:09 +00:00
|
|
|
/* normally 'wm_homefile_read' will do this,
|
|
|
|
* however python is not initialized when called from this function.
|
|
|
|
*
|
2013-06-25 22:58:23 +00:00
|
|
|
* unlikely any handlers are set but its possible,
|
2013-03-28 19:33:14 +00:00
|
|
|
* note that recovering the last session does its own callbacks. */
|
2015-09-22 16:45:23 +10:00
|
|
|
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
|
|
|
|
|
2018-06-14 12:34:13 +02:00
|
|
|
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE);
|
|
|
|
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST);
|
2018-11-30 13:33:13 +11:00
|
|
|
if (is_factory_startup) {
|
|
|
|
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST);
|
|
|
|
}
|
2015-09-22 16:45:23 +10:00
|
|
|
|
2018-06-14 12:34:13 +02:00
|
|
|
wm_file_read_report(C, bmain);
|
2015-09-22 16:45:23 +10:00
|
|
|
|
|
|
|
if (!G.background) {
|
|
|
|
CTX_wm_window_set(C, NULL);
|
|
|
|
}
|
2013-03-28 06:36:09 +00:00
|
|
|
}
|
2009-11-23 13:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WM_init_splash(bContext *C)
|
|
|
|
{
|
2012-03-24 06:24:53 +00:00
|
|
|
if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
|
2012-03-27 01:24:16 +00:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
wmWindow *prevwin = CTX_wm_window(C);
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wm->windows.first) {
|
2010-03-14 18:08:12 +00:00
|
|
|
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);
|
|
|
|
}
|
2009-11-23 13:58:55 +00:00
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* free strings of open recent files */
|
|
|
|
static void free_openrecent(void)
|
|
|
|
{
|
|
|
|
struct RecentFile *recent;
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2019-04-13 09:15:15 +02:00
|
|
|
for (recent = G.recent_files.first; recent; recent = recent->next) {
|
2010-06-14 03:52:10 +00:00
|
|
|
MEM_freeN(recent->filepath);
|
2019-04-13 09:15:15 +02:00
|
|
|
}
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
BLI_freelistN(&(G.recent_files));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-16 00:26:36 +00:00
|
|
|
#ifdef WIN32
|
2012-07-27 10:48:33 +00:00
|
|
|
/* Read console events until there is a key event. Also returns on any error. */
|
2012-07-26 16:56:09 +00:00
|
|
|
static void wait_for_console_key(void)
|
|
|
|
{
|
2012-07-27 10:48:33 +00:00
|
|
|
HANDLE hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
|
2012-07-26 16:56:09 +00:00
|
|
|
|
2012-07-27 10:48:33 +00:00
|
|
|
if (!ELEM(hConsoleInput, NULL, INVALID_HANDLE_VALUE) && FlushConsoleInputBuffer(hConsoleInput)) {
|
2012-08-04 12:30:16 +00:00
|
|
|
for (;;) {
|
2012-07-26 16:56:09 +00:00
|
|
|
INPUT_RECORD buffer;
|
|
|
|
DWORD ignored;
|
|
|
|
|
|
|
|
if (!ReadConsoleInput(hConsoleInput, &buffer, 1, &ignored)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buffer.EventType == KEY_EVENT) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-03-22 23:09:19 +01:00
|
|
|
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. */
|
|
|
|
|
2018-03-22 23:52:38 +01:00
|
|
|
wmWindow *win = CTX_wm_window(C);
|
2018-03-22 23:09:19 +01:00
|
|
|
|
|
|
|
/* 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);
|
2018-03-22 23:52:38 +01:00
|
|
|
WM_event_add_mousemove(C); /* ensure handler actually gets called */
|
2018-03-22 23:09:19 +01:00
|
|
|
}
|
|
|
|
|
2016-01-24 14:25:01 +11:00
|
|
|
/**
|
|
|
|
* \note doesn't run exit() call #WM_exit() for that.
|
|
|
|
*/
|
2013-12-05 17:26:03 +11:00
|
|
|
void WM_exit_ext(bContext *C, const bool do_python)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2012-08-15 10:12:41 +00:00
|
|
|
wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
|
2009-08-09 21:16:39 +00:00
|
|
|
|
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
|
|
|
/* first wrap up running stuff, we assume only the active WM is running */
|
|
|
|
/* modal handlers are on window level freed, others too? */
|
2008-12-21 16:24:19 +00:00
|
|
|
/* note; same code copied in wm_files.c */
|
2012-08-15 10:12:41 +00:00
|
|
|
if (C && wm) {
|
|
|
|
wmWindow *win;
|
|
|
|
|
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
|
|
|
if (!G.background) {
|
2018-03-19 14:17:59 +01:00
|
|
|
struct MemFile *undo_memfile = wm->undo_stack ? ED_undosys_stack_memfile_get_active(wm->undo_stack) : NULL;
|
2019-02-08 08:36:52 +11:00
|
|
|
if (undo_memfile != NULL) {
|
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
|
|
|
/* save the undo state as quit.blend */
|
2019-01-15 21:25:22 +11:00
|
|
|
Main *bmain = CTX_data_main(C);
|
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
|
|
|
char filename[FILE_MAX];
|
2014-10-10 11:48:48 +02:00
|
|
|
bool has_edited;
|
2018-04-16 14:07:42 +02:00
|
|
|
int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY);
|
2014-10-10 11:48:48 +02:00
|
|
|
|
2014-11-23 15:54:29 +01:00
|
|
|
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
|
|
|
|
2019-01-15 21:25:22 +11:00
|
|
|
has_edited = ED_editors_flush_edits(bmain, false);
|
2014-10-10 11:48:48 +02:00
|
|
|
|
2019-01-15 21:25:22 +11:00
|
|
|
if ((has_edited && BLO_write_file(bmain, filename, fileflags, NULL, NULL)) ||
|
2018-03-19 14:17:59 +01:00
|
|
|
(undo_memfile && BLO_memfile_write_file(undo_memfile, filename)))
|
2014-10-10 11:48:48 +02:00
|
|
|
{
|
2014-10-11 11:39:21 +02:00
|
|
|
printf("Saved session recovery to '%s'\n", filename);
|
2014-10-10 11:48:48 +02:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2012-10-29 17:41:19 +00:00
|
|
|
WM_jobs_kill_all(wm);
|
2012-08-15 10:12:41 +00:00
|
|
|
|
|
|
|
for (win = wm->windows.first; win; win = win->next) {
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
|
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
|
|
|
WM_event_remove_handlers(C, &win->handlers);
|
2009-09-18 12:43:36 +00:00
|
|
|
WM_event_remove_handlers(C, &win->modalhandlers);
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
ED_screen_exit(C, win, WM_window_get_active_screen(win));
|
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
|
|
|
}
|
|
|
|
}
|
2012-12-29 10:24:42 +00:00
|
|
|
|
2018-11-26 20:25:15 +01:00
|
|
|
BLI_timer_free();
|
|
|
|
|
2018-07-13 18:39:46 +02:00
|
|
|
WM_paneltype_clear();
|
2018-11-16 11:24:49 +11:00
|
|
|
|
2012-12-29 10:24:42 +00:00
|
|
|
BKE_addon_pref_type_free();
|
2018-11-16 11:24:49 +11:00
|
|
|
BKE_keyconfig_pref_type_free();
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
wm_operatortype_free();
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
wm_dropbox_free();
|
2009-10-08 19:06:32 +00:00
|
|
|
WM_menutype_free();
|
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
|
|
|
WM_uilisttype_free();
|
2018-03-19 14:17:59 +01:00
|
|
|
|
2008-12-31 17:11:42 +00:00
|
|
|
/* all non-screen and non-space stuff editors did, like editmode */
|
2019-01-15 21:25:22 +11:00
|
|
|
if (C) {
|
|
|
|
Main *bmain = CTX_data_main(C);
|
2019-01-15 21:33:01 +11:00
|
|
|
ED_editors_exit(bmain, true);
|
2019-01-15 21:25:22 +11:00
|
|
|
}
|
2009-03-20 18:00:51 +00:00
|
|
|
|
2018-03-19 14:17:59 +01:00
|
|
|
ED_undosys_type_free();
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
free_openrecent();
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2012-05-07 06:38:41 +00:00
|
|
|
BKE_mball_cubeTable_free();
|
2018-06-07 16:43:52 +02:00
|
|
|
|
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
|
|
|
/* render code might still access databases */
|
|
|
|
RE_FreeAllRender();
|
|
|
|
RE_engines_exit();
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2016-04-24 22:42:41 +10:00
|
|
|
ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
|
2009-08-02 11:32:03 +00:00
|
|
|
|
2019-04-13 09:15:15 +02:00
|
|
|
if (C && wm) {
|
|
|
|
/* Before BKE_blender_free! - since the ListBases get freed there. */
|
|
|
|
wm_free_reports(C);
|
|
|
|
}
|
2009-12-17 16:28:45 +00:00
|
|
|
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequencer_free_clipboard(); /* sequencer.c */
|
2012-06-15 11:03:23 +00:00
|
|
|
BKE_tracking_clipboard_free();
|
2014-01-27 15:41:16 +06:00
|
|
|
BKE_mask_clipboard_free();
|
2016-02-12 10:57:58 -02:00
|
|
|
BKE_vfont_clipboard_free();
|
2019-03-16 18:54:00 +01:00
|
|
|
BKE_node_clipboard_free();
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2012-08-13 10:56:36 +00:00
|
|
|
#ifdef WITH_COMPOSITOR
|
|
|
|
COM_deinitialize();
|
|
|
|
#endif
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2018-04-25 17:43:08 +02:00
|
|
|
if (opengl_is_init) {
|
2018-02-22 12:39:57 +01:00
|
|
|
#ifdef WITH_OPENSUBDIV
|
|
|
|
BKE_subsurf_osd_cleanup();
|
|
|
|
#endif
|
|
|
|
|
2018-06-25 12:50:32 +02:00
|
|
|
GPU_free_unused_buffers(G_MAIN);
|
2018-02-22 12:39:57 +01:00
|
|
|
}
|
2018-06-07 16:45:10 +02:00
|
|
|
|
2016-04-24 22:42:41 +10:00
|
|
|
BKE_blender_free(); /* blender.c, does entire library and spacetypes */
|
2007-12-24 18:27:28 +00:00
|
|
|
// free_matcopybuf();
|
2016-04-03 01:18:23 +13:00
|
|
|
ANIM_fcurves_copybuf_free();
|
|
|
|
ANIM_drivers_copybuf_free();
|
2016-04-15 20:04:07 +12:00
|
|
|
ANIM_driver_vars_copybuf_free();
|
2016-04-03 01:18:23 +13:00
|
|
|
ANIM_fmodifiers_copybuf_free();
|
2015-12-13 21:03:13 +13:00
|
|
|
ED_gpencil_anim_copybuf_free();
|
2015-01-01 12:36:01 +13:00
|
|
|
ED_gpencil_strokes_copybuf_free();
|
2009-02-17 16:56:29 +00:00
|
|
|
|
2018-07-14 23:49:00 +02:00
|
|
|
/* 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();
|
2016-10-07 16:34:55 +02:00
|
|
|
|
2009-02-17 16:56:29 +00:00
|
|
|
BLF_exit();
|
2011-09-20 14:07:40 +00:00
|
|
|
|
2018-04-25 17:43:08 +02:00
|
|
|
if (opengl_is_init) {
|
2018-07-19 15:48:13 +02:00
|
|
|
DRW_opengl_context_enable_ex(false);
|
2018-03-11 23:43:09 +01:00
|
|
|
GPU_pass_cache_free();
|
2018-07-09 23:33:20 +02:00
|
|
|
GPU_exit();
|
2018-07-19 15:48:13 +02:00
|
|
|
DRW_opengl_context_disable_ex(false);
|
|
|
|
DRW_opengl_context_destroy();
|
2018-02-26 19:41:17 +01:00
|
|
|
}
|
|
|
|
|
2011-09-26 10:35:47 +00:00
|
|
|
#ifdef WITH_INTERNATIONAL
|
2011-09-20 07:39:25 +00:00
|
|
|
BLF_free_unifont();
|
2013-03-12 07:25:53 +00:00
|
|
|
BLF_free_unifont_mono();
|
2015-08-16 17:32:01 +10:00
|
|
|
BLT_lang_free();
|
2011-09-20 14:07:40 +00:00
|
|
|
#endif
|
2018-06-07 16:43:52 +02:00
|
|
|
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_keyingset_infos_exit();
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// free_txt_data();
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2009-08-14 12:29:55 +00:00
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2011-09-20 12:22:19 +00:00
|
|
|
/* option not to close python so we can use 'atexit' */
|
2016-06-22 03:29:25 +10:00
|
|
|
if (do_python && ((C == NULL) || CTX_py_init_get(C))) {
|
2011-09-20 12:22:19 +00:00
|
|
|
/* XXX - old note */
|
2016-04-24 22:42:41 +10:00
|
|
|
/* before BKE_blender_free so py's gc happens while library still exists */
|
2011-09-20 12:22:19 +00:00
|
|
|
/* needed at least for a rare sigsegv that can happen in pydrivers */
|
|
|
|
|
2016-04-24 22:42:41 +10:00
|
|
|
/* Update for blender 2.5, move after BKE_blender_free because blender now holds references to PyObject's
|
2011-09-20 12:22:19 +00:00
|
|
|
* 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();
|
|
|
|
}
|
2011-09-30 07:47:45 +00:00
|
|
|
#else
|
|
|
|
(void)do_python;
|
2009-08-14 12:29:55 +00:00
|
|
|
#endif
|
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
ED_file_exit(); /* for fsmenu */
|
|
|
|
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
UI_exit();
|
2017-11-23 03:10:58 +11:00
|
|
|
BKE_blender_userdef_data_free(&U, false);
|
2008-11-21 19:14:38 +00:00
|
|
|
|
2011-01-05 02:08:54 +00:00
|
|
|
RNA_exit(); /* should be after BPY_python_end so struct python slots are cleared */
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2009-08-05 02:40:51 +00:00
|
|
|
wm_ghost_exit();
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
CTX_free(C);
|
2018-06-07 16:43:52 +02:00
|
|
|
|
2011-01-05 14:00:14 +00:00
|
|
|
GHOST_DisposeSystemPaths();
|
|
|
|
|
2016-07-12 12:53:49 +10:00
|
|
|
DNA_sdna_current_free();
|
|
|
|
|
2013-08-19 10:51:40 +00:00
|
|
|
BLI_threadapi_exit();
|
|
|
|
|
2017-02-24 14:56:50 +01:00
|
|
|
/* 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();
|
|
|
|
|
2018-03-29 20:38:32 +02:00
|
|
|
CLG_exit();
|
|
|
|
|
2016-06-24 10:05:18 +10:00
|
|
|
BKE_blender_atexit();
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
if (MEM_get_memory_blocks_in_use() != 0) {
|
2015-02-19 02:08:09 +05:00
|
|
|
size_t mem_in_use = MEM_get_memory_in_use() + MEM_get_memory_in_use();
|
2015-06-19 12:29:06 +02:00
|
|
|
printf("Error: Not freed memory blocks: %u, total unfreed memory %f MB\n",
|
2015-02-19 02:08:09 +05:00
|
|
|
MEM_get_memory_blocks_in_use(),
|
|
|
|
(double)mem_in_use / 1024 / 1024);
|
2007-12-24 18:27:28 +00:00
|
|
|
MEM_printmemlist();
|
|
|
|
}
|
2009-10-20 13:58:53 +00:00
|
|
|
wm_autosave_delete();
|
T39690: Modifications to Blender's 'temp dir' system.
Current temporary data of Blender suffers one major issue - default 'temp' dir on Windows is never
automatically cleaned up, and can end being quite big when used by Blender, especially when we have
to store per-process data (using getpid() in file names).
To address this, this patch:
* Divides tempdir paths in two, one for 'base' temp dir (the same as previous unique tempdir path),
the other is a mkdtemp-generated sub-dir, specific to each Blender instance.
* Only uses base tempdir when we need some shallow persistance accross Blender sessions - and we always
reuse the same filename (quit.blend...) or generate small file (crash reports...).
* Uses temp sub-dir for heavy files like pointcache or renderEXRs (Save Buffer option).
* Erases temp sub-dir on quit or crash.
To get this working it also adds a working 'recursive delete' to BLI_delete() under Windows.
Note that, as in current code, the 'recover render result' hack-feature that was possible
with SaveBuffer option is still removed. A real renderresult cache feature will be added
soon, though.
Reviewers: campbellbarton, brecht, sergey
Reviewed By: campbellbarton, sergey
CC: sergey
Differential Revision: https://developer.blender.org/D531
2014-06-23 13:42:19 +02:00
|
|
|
|
2014-11-23 15:54:29 +01:00
|
|
|
BKE_tempdir_session_purge();
|
2014-02-13 06:53:42 +11:00
|
|
|
}
|
|
|
|
|
2018-03-22 23:09:19 +01:00
|
|
|
/**
|
|
|
|
* \brief Main exit function to close Blender ordinarily.
|
|
|
|
* \note Use #wm_exit_schedule_delayed() to close Blender from an operator. Might leak memory otherwise.
|
|
|
|
*/
|
2014-02-13 06:53:42 +11:00
|
|
|
void WM_exit(bContext *C)
|
|
|
|
{
|
|
|
|
WM_exit_ext(C, 1);
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
printf("\nBlender quit\n");
|
2014-02-13 06:53:42 +11:00
|
|
|
|
|
|
|
#ifdef WIN32
|
2012-07-26 16:56:09 +00:00
|
|
|
/* ask user to press a key when in debug mode */
|
2012-03-31 00:59:17 +00:00
|
|
|
if (G.debug & G_DEBUG) {
|
2012-07-26 16:56:09 +00:00
|
|
|
printf("Press any key to exit . . .\n\n");
|
|
|
|
wait_for_console_key();
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2014-02-13 06:53:42 +11:00
|
|
|
#endif
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
exit(G.is_break == true);
|
2011-09-20 12:22:19 +00:00
|
|
|
}
|