2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2007-12-24 18:27:28 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* 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.
|
2007-12-24 18:27:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-25 14:04:21 +00:00
|
|
|
/** \file blender/windowmanager/intern/wm_init_exit.c
|
|
|
|
* \ingroup wm
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
#include "MEM_CacheLimiterC-Api.h"
|
|
|
|
|
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
#include "BKE_blender.h"
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2011-05-20 05:27:31 +00:00
|
|
|
#include "BKE_screen.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_curve.h"
|
|
|
|
#include "BKE_displist.h"
|
|
|
|
#include "BKE_DerivedMesh.h"
|
|
|
|
#include "BKE_font.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_library.h"
|
2010-08-16 12:14:09 +00:00
|
|
|
#include "BKE_main.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_mball.h"
|
2009-07-16 00:50:27 +00:00
|
|
|
#include "BKE_report.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_packedFile.h"
|
2009-12-17 16:28:45 +00:00
|
|
|
#include "BKE_sequencer.h" /* free seq clipboard */
|
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 */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2011-11-03 06:53:52 +00:00
|
|
|
#include "BLI_listbase.h"
|
2012-04-16 06:48:57 +00:00
|
|
|
// #include "BLI_scanfill.h"
|
2011-11-03 06:53:52 +00:00
|
|
|
#include "BLI_string.h"
|
|
|
|
#include "BLI_utildefines.h"
|
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
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_GAMEENGINE
|
2011-05-06 20:18:42 +00:00
|
|
|
#include "BL_System.h"
|
2010-10-31 00:56:46 +00:00
|
|
|
#endif
|
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"
|
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"
|
|
|
|
|
2009-03-22 00:30:18 +00:00
|
|
|
#include "ED_armature.h"
|
2009-03-31 22:36:13 +00:00
|
|
|
#include "ED_keyframing.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"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "UI_interface.h"
|
2009-01-29 05:19:27 +00:00
|
|
|
#include "BLF_api.h"
|
2011-09-20 07:39:25 +00:00
|
|
|
#include "BLF_translation.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
|
2010-07-14 10:46:12 +00:00
|
|
|
#include "GPU_buffers.h"
|
2008-12-19 12:14:58 +00:00
|
|
|
#include "GPU_extensions.h"
|
|
|
|
#include "GPU_draw.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 "BKE_depsgraph.h"
|
2009-08-09 21:16:39 +00:00
|
|
|
#include "BKE_sound.h"
|
2009-07-16 00:50:27 +00:00
|
|
|
|
|
|
|
static void wm_init_reports(bContext *C)
|
|
|
|
{
|
2009-07-16 22:47:27 +00:00
|
|
|
BKE_reports_init(CTX_wm_reports(C), RPT_STORE);
|
2009-07-16 00:50:27 +00:00
|
|
|
}
|
|
|
|
static void wm_free_reports(bContext *C)
|
|
|
|
{
|
2009-07-16 22:47:27 +00:00
|
|
|
BKE_reports_clear(CTX_wm_reports(C));
|
2009-07-16 00:50:27 +00:00
|
|
|
}
|
|
|
|
|
2011-08-28 05:06:30 +00:00
|
|
|
int wm_start_with_console = 0; /* used in creator.c */
|
2009-07-16 00:50:27 +00:00
|
|
|
|
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
|
|
|
{
|
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();
|
|
|
|
}
|
2011-01-05 14:00:14 +00:00
|
|
|
GHOST_CreateSystemPaths();
|
2007-12-24 18:27:28 +00:00
|
|
|
wm_operatortype_init();
|
2011-08-11 06:06:17 +00:00
|
|
|
WM_menutype_init();
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
set_free_windowmanager_cb(wm_close_and_free); /* library.c */
|
2008-12-30 13:16:14 +00:00
|
|
|
set_blender_test_break_cb(wm_window_testbreak); /* blender.c */
|
2011-11-28 14:55:35 +00:00
|
|
|
DAG_editors_update_cb(ED_render_id_flush_update, ED_render_scene_update); /* depsgraph.c */
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
ED_spacetypes_init(); /* editors/space_api/spacetype.c */
|
2009-01-27 17:12:40 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
ED_file_init(); /* for fsmenu */
|
2009-01-27 17:12:40 +00:00
|
|
|
ED_init_node_butfuncs();
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2010-11-12 07:16:33 +00:00
|
|
|
BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */
|
2009-02-18 13:29:54 +00:00
|
|
|
BLF_lang_init();
|
2010-01-18 18:52:03 +00:00
|
|
|
/* get the default database, plus a wm */
|
2011-01-19 09:13:24 +00:00
|
|
|
WM_read_homefile(C, NULL, G.factory_startup);
|
2010-01-18 18:52:03 +00:00
|
|
|
|
2011-09-15 13:20:18 +00:00
|
|
|
BLF_lang_set(NULL);
|
|
|
|
|
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
|
|
|
|
* before WM_read_homefile() or make py-drivers check if python is running.
|
|
|
|
* 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
|
|
|
|
2011-01-05 02:08:54 +00:00
|
|
|
BPY_driver_reset();
|
2011-11-03 06:53:52 +00:00
|
|
|
BPY_app_handlers_reset(FALSE); /* causes addon callbacks to be freed [#28068],
|
2012-03-09 18:28:30 +00:00
|
|
|
* but this is actually what we want. */
|
2011-01-05 02:08:54 +00:00
|
|
|
BPY_modules_load_user(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
|
|
|
|
|
2011-05-02 08:07:24 +00:00
|
|
|
if (!G.background && !wm_start_with_console)
|
|
|
|
GHOST_toggleConsole(3);
|
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
wm_init_reports(C); /* reports cant be initialized before the wm */
|
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
|
|
|
|
2009-11-11 04:08:09 +00:00
|
|
|
if (!G.background) {
|
|
|
|
GPU_extensions_init();
|
2010-03-15 01:12:41 +00:00
|
|
|
GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
|
2011-06-15 18:59:22 +00:00
|
|
|
GPU_set_anisotropic(U.anisotropic_filter);
|
2012-06-11 16:23:10 +00:00
|
|
|
GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
|
|
|
|
|
2009-11-11 04:08:09 +00:00
|
|
|
UI_init();
|
|
|
|
}
|
2009-01-23 17:42:36 +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
|
|
|
|
2009-01-23 17:42:36 +00:00
|
|
|
// glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
2010-03-15 01:12:41 +00:00
|
|
|
|
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
2009-01-22 14:59:49 +00:00
|
|
|
ED_preview_init_dbase();
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2011-02-14 03:15:55 +00:00
|
|
|
WM_read_history();
|
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
|
2012-03-24 06:24:53 +00:00
|
|
|
if (G.main->name[0] == 0)
|
2010-10-18 06:41:16 +00:00
|
|
|
BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend");
|
2012-03-09 18:28:30 +00:00
|
|
|
#endif
|
2010-07-15 21:39:47 +00:00
|
|
|
|
2010-10-18 06:41:16 +00:00
|
|
|
BLI_strncpy(G.lib, G.main->name, FILE_MAX);
|
2012-07-16 08:42:55 +00:00
|
|
|
|
|
|
|
if (1) {
|
|
|
|
extern void *COM_linker_hack;
|
|
|
|
extern void *COM_execute;
|
|
|
|
COM_linker_hack = COM_execute;
|
|
|
|
}
|
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);
|
2010-03-14 18:08:12 +00: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
|
|
|
}
|
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int WM_init_game(bContext *C)
|
2010-03-05 10:37:55 +00:00
|
|
|
{
|
2012-03-27 01:24:16 +00:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
wmWindow *win;
|
2010-08-16 12:14:09 +00:00
|
|
|
|
|
|
|
ScrArea *sa;
|
2012-03-27 01:24:16 +00:00
|
|
|
ARegion *ar = NULL;
|
2010-08-16 12:14:09 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2010-08-16 12:14:09 +00:00
|
|
|
|
2010-08-16 17:17:33 +00:00
|
|
|
if (!scene) {
|
2012-07-06 23:56:59 +00:00
|
|
|
/* XXX, this should not be needed. */
|
2010-08-16 17:17:33 +00:00
|
|
|
Main *bmain = CTX_data_main(C);
|
2012-03-27 01:24:16 +00:00
|
|
|
scene = bmain->scene.first;
|
2010-08-16 17:17:33 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
|
|
|
|
win = wm->windows.first;
|
|
|
|
|
2012-07-06 23:56:59 +00:00
|
|
|
/* first to get a valid window */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (win)
|
2010-08-16 12:14:09 +00:00
|
|
|
CTX_wm_window_set(C, win);
|
|
|
|
|
2011-11-04 01:15:04 +00:00
|
|
|
sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0);
|
2012-03-27 01:24:16 +00:00
|
|
|
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
|
2010-08-16 12:14:09 +00:00
|
|
|
|
2012-07-06 23:56:59 +00:00
|
|
|
/* if we have a valid 3D view */
|
2010-08-16 12:14:09 +00:00
|
|
|
if (sa && ar) {
|
|
|
|
ARegion *arhide;
|
|
|
|
|
|
|
|
CTX_wm_area_set(C, sa);
|
|
|
|
CTX_wm_region_set(C, ar);
|
|
|
|
|
|
|
|
/* disable quad view */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (ar->alignment == RGN_ALIGN_QSPLIT)
|
2010-08-16 12:14:09 +00:00
|
|
|
WM_operator_name_call(C, "SCREEN_OT_region_quadview", WM_OP_EXEC_DEFAULT, NULL);
|
|
|
|
|
|
|
|
/* toolbox, properties panel and header are hidden */
|
2012-03-27 01:24:16 +00:00
|
|
|
for (arhide = sa->regionbase.first; arhide; arhide = arhide->next) {
|
2012-03-24 06:24:53 +00:00
|
|
|
if (arhide->regiontype != RGN_TYPE_WINDOW) {
|
|
|
|
if (!(arhide->flag & RGN_FLAG_HIDDEN)) {
|
2010-08-16 12:14:09 +00:00
|
|
|
ED_region_toggle_hidden(C, arhide);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* full screen the area */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (!sa->full) {
|
2011-03-19 05:06:06 +00:00
|
|
|
ED_screen_full_toggle(C, win, sa);
|
2010-08-16 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Fullscreen */
|
2012-03-24 06:24:53 +00:00
|
|
|
if ((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) {
|
2010-08-16 12:14:09 +00:00
|
|
|
WM_operator_name_call(C, "WM_OT_window_fullscreen_toggle", WM_OP_EXEC_DEFAULT, NULL);
|
|
|
|
wm_get_screensize(&ar->winrct.xmax, &ar->winrct.ymax);
|
2010-12-22 14:20:22 +00:00
|
|
|
ar->winx = ar->winrct.xmax + 1;
|
|
|
|
ar->winy = ar->winrct.ymax + 1;
|
2010-08-16 12:14:09 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2010-08-16 12:14:09 +00:00
|
|
|
GHOST_RectangleHandle rect = GHOST_GetClientBounds(win->ghostwin);
|
|
|
|
ar->winrct.ymax = GHOST_GetHeightRectangle(rect);
|
|
|
|
ar->winrct.xmax = GHOST_GetWidthRectangle(rect);
|
2010-12-19 13:56:02 +00:00
|
|
|
ar->winx = ar->winrct.xmax + 1;
|
|
|
|
ar->winy = ar->winrct.ymax + 1;
|
2010-08-16 12:14:09 +00:00
|
|
|
GHOST_DisposeRectangle(rect);
|
|
|
|
}
|
|
|
|
|
2010-03-05 10:37:55 +00:00
|
|
|
WM_operator_name_call(C, "VIEW3D_OT_game_start", WM_OP_EXEC_DEFAULT, NULL);
|
2010-08-16 12:14:09 +00:00
|
|
|
|
2011-09-18 09:46:47 +00:00
|
|
|
sound_exit();
|
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2010-08-16 12:14:09 +00:00
|
|
|
ReportTimerInfo *rti;
|
|
|
|
|
|
|
|
BKE_report(&wm->reports, RPT_ERROR, "No valid 3D View found. Game auto start is not possible.");
|
|
|
|
|
|
|
|
/* After adding the report to the global list, reset the report timer. */
|
|
|
|
WM_event_remove_timer(wm, NULL, wm->reports.reporttimer);
|
|
|
|
|
|
|
|
/* Records time since last report was added */
|
|
|
|
wm->reports.reporttimer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER, 0.02);
|
|
|
|
|
|
|
|
rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo");
|
|
|
|
wm->reports.reporttimer->customdata = rti;
|
2010-03-05 10:37:55 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return 0;
|
2010-03-05 10:37: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;
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (recent = G.recent_files.first; recent; recent = recent->next)
|
2010-06-14 03:52:10 +00:00
|
|
|
MEM_freeN(recent->filepath);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
BLI_freelistN(&(G.recent_files));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* bad stuff*/
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
// XXX copy/paste buffer stuff...
|
2010-12-03 12:30:59 +00:00
|
|
|
extern void free_anim_copybuf(void);
|
|
|
|
extern void free_anim_drivers_copybuf(void);
|
|
|
|
extern void free_fmodifiers_copybuf(void);
|
|
|
|
extern void free_posebuf(void);
|
2008-12-29 11:04:55 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* called in creator.c even... tsk, split this! */
|
2011-09-20 12:22:19 +00:00
|
|
|
/* note, doesnt run exit() call WM_exit() for that */
|
|
|
|
void WM_exit_ext(bContext *C, const short do_python)
|
2007-12-24 18:27:28 +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
|
|
|
wmWindow *win;
|
2009-08-09 21:16:39 +00:00
|
|
|
|
|
|
|
sound_exit();
|
|
|
|
|
2011-04-08 12:49:38 +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-03-24 06:24:53 +00:00
|
|
|
if (C && CTX_wm_manager(C)) {
|
2009-01-27 17:12:40 +00:00
|
|
|
|
|
|
|
WM_jobs_stop_all(CTX_wm_manager(C));
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
|
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-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);
|
2008-12-10 13:56:54 +00:00
|
|
|
ED_screen_exit(C, win, win->screen);
|
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
|
|
|
}
|
|
|
|
}
|
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();
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2008-12-31 17:11:42 +00:00
|
|
|
/* all non-screen and non-space stuff editors did, like editmode */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (C)
|
2008-12-31 17:11:42 +00:00
|
|
|
ED_editors_exit(C);
|
2009-03-20 18:00:51 +00:00
|
|
|
|
|
|
|
// XXX
|
|
|
|
// BIF_GlobalReebFree();
|
|
|
|
// BIF_freeRetarget();
|
2009-03-22 00:30:18 +00:00
|
|
|
BIF_freeTemplates(C);
|
2009-01-04 14:14:06 +00:00
|
|
|
|
2012-05-05 14:52:04 +00:00
|
|
|
BKE_vfont_free_global_ttf(); /* bke_font.h */
|
2011-09-19 15:10:38 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
free_openrecent();
|
|
|
|
|
2012-05-07 06:38:41 +00:00
|
|
|
BKE_mball_cubeTable_free();
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
ED_preview_free_dbase(); /* frees a Main dbase, before free_blender! */
|
2009-08-02 11:32:03 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (C && CTX_wm_manager(C))
|
2012-03-27 01:24:16 +00:00
|
|
|
wm_free_reports(C); /* before free_blender! - since the ListBases get freed there */
|
2009-12-17 16:28:45 +00:00
|
|
|
|
|
|
|
seq_free_clipboard(); /* sequencer.c */
|
2012-06-15 11:03:23 +00:00
|
|
|
BKE_tracking_clipboard_free();
|
2009-08-02 11:32:03 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
free_blender(); /* blender.c, does entire library and spacetypes */
|
2007-12-24 18:27:28 +00:00
|
|
|
// free_matcopybuf();
|
2009-02-24 11:18:24 +00:00
|
|
|
free_anim_copybuf();
|
2009-09-25 04:51:04 +00:00
|
|
|
free_anim_drivers_copybuf();
|
2010-03-18 13:04:46 +00:00
|
|
|
free_fmodifiers_copybuf();
|
2009-07-24 06:08:03 +00:00
|
|
|
free_posebuf();
|
2009-02-17 16:56:29 +00:00
|
|
|
|
|
|
|
BLF_exit();
|
2011-09-20 14:07:40 +00:00
|
|
|
|
2011-09-26 10:35:47 +00:00
|
|
|
#ifdef WITH_INTERNATIONAL
|
2011-09-20 07:39:25 +00:00
|
|
|
BLF_free_unifont();
|
2011-09-20 14:07:40 +00:00
|
|
|
#endif
|
== 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();
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
RE_FreeAllRender();
|
2.5: Render/Game Engine
An engine to use for output can now be selected an influences what
shows in the buttons window, only showing relevant data. The idea
behind this is to make it more clear what is supported where, make
the system more pluggable for external render/game engines, and save
space hiding stuff that is not relevant anyway.
* Top header now has an engine menu, to choose between the blender
render engine, game engine, and other future external engines.
* If the game engine is enabled, the buttons window should show
only properties that work in the game engine, and similarly for
the render engine.
* Moved panels from the logic space and game tabs to the physics,
scene and world tabs instead, and removed the game tab.
* Materials and textures tabs should eventually become game
specific too, to better show what is supported.
2009-07-23 21:50:40 +00:00
|
|
|
RE_engines_exit();
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
// free_txt_data();
|
|
|
|
|
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' */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (do_python) {
|
2011-09-20 12:22:19 +00:00
|
|
|
/* XXX - old note */
|
|
|
|
/* before free_blender 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 free_blender because blender now holds references to PyObject's
|
|
|
|
* so decref'ing them after python ends causes bad problems every time
|
|
|
|
* the pyDriver bug can be fixed if it happens again we can deal with it then */
|
|
|
|
BPY_python_end();
|
|
|
|
}
|
2011-09-30 07:47:45 +00:00
|
|
|
#else
|
|
|
|
(void)do_python;
|
2009-08-14 12:29:55 +00:00
|
|
|
#endif
|
|
|
|
|
== GPU Buffers ==
This patch attempts to clean up and document the GPU buffers
code. There are a few bug fixes as well.
Patch reviewed here: http://codereview.appspot.com/4631052/
Summary:
* Bugfix: make GPU_buffer_copy_normal convert from shorts to floats
correctly, also fixed the use of cached face normal CustomData.
* Bugfix: changed the `mat_nr' field of GPUBufferMaterial from char to
short.
* Changed color buffer setup to not alloc a temporary copy of color
data, just passes the MCol data in directly.
* Changed the GPU buffer pool code to make clearer what operates
specifically on the global pool.
* Lots of refactoring for GPU_drawobject_new; should operate mostly
the same (except got rid of one unecessary allocation), just split
into more functions and without macros now.
* Converted some #defines into enumerations.
* Made some stuff private, pulled out of header file.
* Deleted unused function GPU_buffer_pool_free_unused().
* Removed GPU_interleaved_setup and related #defines. (I think this
was used for editmode VBOs, but those were disabled.)
* Added lots of comments.
* Added a few comments in the code signed `--nicholas' to note places
where I am unsure about design or usage, would be good to address
these better.
* Code formatting changed to be more consistent with the rest of
Blender.
* Renamed some fields and variables to be more consistent with
Blender's naming conventions.
* Renamed some fields and variables to use more descriptive names,
e.g. renamed `redir' to `mat_orig_to_new'.
* Removed print outs with DEBUG_VBO -- don't feel too strongly about
this one, just not used elsewhere in Blender, could be easily added
back if others disagree though.
* Moved the PBVH drawing code down to the bottom of the file, before
was sitting in the middle of the other VBO code
2011-07-08 19:58:02 +00:00
|
|
|
GPU_global_buffer_pool_free();
|
2010-04-25 10:49:13 +00:00
|
|
|
GPU_free_unused_buffers();
|
2009-01-28 19:42:49 +00:00
|
|
|
GPU_extensions_exit();
|
2012-03-11 00:00:27 +00:00
|
|
|
|
2010-05-06 18:25:56 +00:00
|
|
|
if (!G.background) {
|
2012-03-27 01:24:16 +00:00
|
|
|
BKE_undo_save_quit(); /* saves quit.blend if global undo is on */
|
2010-05-06 18:25:56 +00:00
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
BKE_reset_undo();
|
|
|
|
|
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();
|
2009-04-30 16:44:00 +00:00
|
|
|
BKE_userdef_free();
|
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 */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2009-08-05 02:40:51 +00:00
|
|
|
wm_ghost_exit();
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
CTX_free(C);
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_GAMEENGINE
|
2009-08-19 10:26:43 +00:00
|
|
|
SYS_DeleteSystem(SYS_GetSystem());
|
2010-10-31 00:56:46 +00:00
|
|
|
#endif
|
2011-01-05 14:00:14 +00:00
|
|
|
|
|
|
|
GHOST_DisposeSystemPaths();
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
if (MEM_get_memory_blocks_in_use() != 0) {
|
2011-03-28 18:56:43 +00:00
|
|
|
printf("Error: Not freed memory blocks: %d\n", MEM_get_memory_blocks_in_use());
|
2007-12-24 18:27:28 +00:00
|
|
|
MEM_printmemlist();
|
|
|
|
}
|
2009-10-20 13:58:53 +00:00
|
|
|
wm_autosave_delete();
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
printf("\nBlender quit\n");
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
/* ask user to press enter when in debug mode */
|
2012-03-31 00:59:17 +00:00
|
|
|
if (G.debug & G_DEBUG) {
|
2007-12-24 18:27:28 +00:00
|
|
|
printf("press enter key to exit...\n\n");
|
|
|
|
getchar();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-09-20 12:22:19 +00:00
|
|
|
void WM_exit(bContext *C)
|
|
|
|
{
|
|
|
|
WM_exit_ext(C, 1);
|
2012-03-27 01:24:16 +00:00
|
|
|
exit(G.afbreek == 1);
|
2011-09-20 12:22:19 +00:00
|
|
|
}
|