2007-12-24 18:27:28 +00:00
|
|
|
/**
|
2010-03-21 01:14:04 +00:00
|
|
|
* $Id$
|
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 *****
|
|
|
|
*/
|
|
|
|
|
2010-08-13 06:30:04 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stddef.h>
|
2009-10-08 19:06:32 +00:00
|
|
|
|
2010-08-31 11:31:21 +00:00
|
|
|
#include "BLO_sys_types.h"
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
2009-05-30 04:16:24 +00:00
|
|
|
#include "GHOST_C-api.h"
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
|
|
|
#include "BKE_blender.h"
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2008-12-29 13:38:08 +00:00
|
|
|
#include "BKE_idprop.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_library.h"
|
|
|
|
#include "BKE_main.h"
|
2009-10-08 19:06:32 +00:00
|
|
|
#include "BKE_screen.h"
|
2008-12-29 13:38:08 +00:00
|
|
|
#include "BKE_report.h"
|
2009-11-11 04:08:09 +00:00
|
|
|
#include "BKE_global.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
#include "wm_window.h"
|
|
|
|
#include "wm_event_system.h"
|
|
|
|
#include "wm_event_types.h"
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
#include "wm_draw.h"
|
2008-10-03 18:03:30 +00:00
|
|
|
#include "wm.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2010-05-28 21:25:23 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "ED_screen.h"
|
2010-02-27 14:44:46 +00:00
|
|
|
#include "BPY_extern.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2009-01-01 20:44:40 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* ****************************************************** */
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#define MAX_OP_REGISTERED 32
|
|
|
|
|
2008-12-24 14:52:17 +00:00
|
|
|
void WM_operator_free(wmOperator *op)
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
{
|
2010-03-23 21:37:02 +00:00
|
|
|
|
|
|
|
#ifndef DISABLE_PYTHON
|
2010-02-27 14:44:46 +00:00
|
|
|
if(op->py_instance) {
|
|
|
|
/* do this first incase there are any __del__ functions or
|
|
|
|
* similar that use properties */
|
|
|
|
BPY_DECREF(op->py_instance);
|
|
|
|
}
|
2010-03-23 21:37:02 +00:00
|
|
|
#endif
|
2010-02-27 14:44:46 +00:00
|
|
|
|
2009-01-01 20:44:40 +00:00
|
|
|
if(op->ptr) {
|
|
|
|
op->properties= op->ptr->data;
|
|
|
|
MEM_freeN(op->ptr);
|
|
|
|
}
|
|
|
|
|
2008-11-21 19:14:38 +00:00
|
|
|
if(op->properties) {
|
|
|
|
IDP_FreeProperty(op->properties);
|
|
|
|
MEM_freeN(op->properties);
|
|
|
|
}
|
|
|
|
|
2009-09-15 16:25:53 +00:00
|
|
|
if(op->reports && (op->reports->flag & RPT_FREE)) {
|
2008-12-29 13:38:08 +00:00
|
|
|
BKE_reports_clear(op->reports);
|
|
|
|
MEM_freeN(op->reports);
|
|
|
|
}
|
|
|
|
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
if(op->macro.first) {
|
2009-09-14 05:00:03 +00:00
|
|
|
wmOperator *opm, *opmnext;
|
|
|
|
for(opm= op->macro.first; opm; opm= opmnext) {
|
|
|
|
opmnext = opm->next;
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
WM_operator_free(opm);
|
2009-09-14 05:00:03 +00:00
|
|
|
}
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
}
|
|
|
|
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
MEM_freeN(op);
|
|
|
|
}
|
|
|
|
|
2010-06-03 07:27:55 +00:00
|
|
|
static void wm_reports_free(wmWindowManager *wm)
|
|
|
|
{
|
|
|
|
BKE_reports_clear(&wm->reports);
|
|
|
|
WM_event_remove_timer(wm, NULL, wm->reports.reporttimer);
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* all operations get registered in the windowmanager here */
|
|
|
|
/* called on event handling by event_system.c */
|
2009-07-16 00:50:27 +00:00
|
|
|
void wm_operator_register(bContext *C, wmOperator *op)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2009-07-16 00:50:27 +00:00
|
|
|
wmWindowManager *wm= CTX_wm_manager(C);
|
2007-12-24 18:27:28 +00:00
|
|
|
int tot;
|
2008-11-21 19:14:38 +00:00
|
|
|
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
BLI_addtail(&wm->operators, op);
|
2007-12-24 18:27:28 +00:00
|
|
|
tot= BLI_countlist(&wm->operators);
|
|
|
|
|
|
|
|
while(tot>MAX_OP_REGISTERED) {
|
|
|
|
wmOperator *opt= wm->operators.first;
|
|
|
|
BLI_remlink(&wm->operators, opt);
|
2008-12-24 14:52:17 +00:00
|
|
|
WM_operator_free(opt);
|
2007-12-24 18:27:28 +00:00
|
|
|
tot--;
|
|
|
|
}
|
2009-07-16 00:50:27 +00:00
|
|
|
|
|
|
|
/* so the console is redrawn */
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
|
2010-04-06 09:07:39 +00:00
|
|
|
WM_event_add_notifier(C, NC_WM|ND_HISTORY, NULL);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-26 15:48:09 +00:00
|
|
|
void WM_operator_stack_clear(bContext *C)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm= CTX_wm_manager(C);
|
|
|
|
wmOperator *op;
|
|
|
|
|
|
|
|
while((op= wm->operators.first)) {
|
|
|
|
BLI_remlink(&wm->operators, op);
|
|
|
|
WM_operator_free(op);
|
|
|
|
}
|
|
|
|
|
2010-04-06 09:07:39 +00:00
|
|
|
WM_event_add_notifier(C, NC_WM|ND_HISTORY, NULL);
|
2009-06-26 15:48:09 +00:00
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* ****************************************** */
|
|
|
|
|
2009-10-08 19:06:32 +00:00
|
|
|
static ListBase menutypes = {NULL, NULL}; /* global menutype list */
|
|
|
|
|
|
|
|
MenuType *WM_menutype_find(const char *idname, int quiet)
|
|
|
|
{
|
|
|
|
MenuType* mt;
|
|
|
|
|
|
|
|
if (idname[0]) {
|
2010-08-13 06:30:04 +00:00
|
|
|
mt= BLI_findstring(&menutypes, idname, offsetof(MenuType, idname));
|
|
|
|
if(mt)
|
|
|
|
return mt;
|
2009-10-08 19:06:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!quiet)
|
|
|
|
printf("search for unknown menutype %s\n", idname);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int WM_menutype_add(MenuType* mt)
|
|
|
|
{
|
|
|
|
BLI_addtail(&menutypes, mt);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WM_menutype_freelink(MenuType* mt)
|
|
|
|
{
|
|
|
|
BLI_freelinkN(&menutypes, mt);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WM_menutype_free(void)
|
|
|
|
{
|
2009-10-09 12:34:37 +00:00
|
|
|
MenuType* mt= menutypes.first, *mt_next;
|
|
|
|
|
|
|
|
while(mt) {
|
|
|
|
mt_next= mt->next;
|
2009-10-08 19:06:32 +00:00
|
|
|
|
2009-10-09 12:34:37 +00:00
|
|
|
if(mt->ext.free)
|
2009-10-08 19:06:32 +00:00
|
|
|
mt->ext.free(mt->ext.data);
|
2009-10-09 12:34:37 +00:00
|
|
|
|
2009-10-08 19:06:32 +00:00
|
|
|
WM_menutype_freelink(mt);
|
2009-10-09 12:34:37 +00:00
|
|
|
|
|
|
|
mt= mt_next;
|
2009-10-08 19:06:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ****************************************** */
|
|
|
|
|
2009-07-18 19:40:26 +00:00
|
|
|
void WM_keymap_init(bContext *C)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm= CTX_wm_manager(C);
|
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
if(!wm->defaultconf)
|
2010-08-30 13:50:59 +00:00
|
|
|
wm->defaultconf= WM_keyconfig_new(wm, "Blender");
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
|
2009-08-02 10:32:52 +00:00
|
|
|
if(wm && CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
/* create default key config */
|
|
|
|
wm_window_keymap(wm->defaultconf);
|
|
|
|
ED_spacetypes_keymap(wm->defaultconf);
|
2010-01-30 12:01:44 +00:00
|
|
|
WM_keyconfig_userdef(wm);
|
2009-07-18 19:40:26 +00:00
|
|
|
|
|
|
|
wm->initialized |= WM_INIT_KEYMAP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-11 04:08:09 +00:00
|
|
|
void WM_check(bContext *C)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2008-12-18 02:56:48 +00:00
|
|
|
wmWindowManager *wm= CTX_wm_manager(C);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
/* wm context */
|
2009-01-23 17:42:36 +00:00
|
|
|
if(wm==NULL) {
|
2008-12-18 02:56:48 +00:00
|
|
|
wm= CTX_data_main(C)->wm.first;
|
|
|
|
CTX_wm_manager_set(C, wm);
|
|
|
|
}
|
|
|
|
if(wm==NULL) return;
|
|
|
|
if(wm->windows.first==NULL) return;
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
|
2009-11-11 04:08:09 +00:00
|
|
|
if (!G.background) {
|
|
|
|
/* case: fileread */
|
|
|
|
if((wm->initialized & WM_INIT_WINDOW) == 0) {
|
|
|
|
WM_keymap_init(C);
|
2009-12-08 17:23:48 +00:00
|
|
|
WM_autosave_init(wm);
|
2009-11-11 04:08:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* case: no open windows at all, for old file reads */
|
|
|
|
wm_window_add_ghostwindows(wm);
|
|
|
|
|
|
|
|
/* case: fileread */
|
|
|
|
if((wm->initialized & WM_INIT_WINDOW) == 0) {
|
|
|
|
ED_screens_initialize(wm);
|
|
|
|
wm->initialized |= WM_INIT_WINDOW;
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-30 04:16:24 +00:00
|
|
|
void wm_clear_default_size(bContext *C)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm= CTX_wm_manager(C);
|
|
|
|
wmWindow *win;
|
|
|
|
|
|
|
|
/* wm context */
|
|
|
|
if(wm==NULL) {
|
|
|
|
wm= CTX_data_main(C)->wm.first;
|
|
|
|
CTX_wm_manager_set(C, wm);
|
|
|
|
}
|
|
|
|
if(wm==NULL) return;
|
|
|
|
if(wm->windows.first==NULL) return;
|
|
|
|
|
2009-05-30 07:26:45 +00:00
|
|
|
for(win= wm->windows.first; win; win= win->next) {
|
|
|
|
win->sizex = 0;
|
|
|
|
win->sizey = 0;
|
|
|
|
win->posx = 0;
|
|
|
|
win->posy = 0;
|
|
|
|
}
|
2009-05-30 04:16:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* on startup, it adds all data, for matching */
|
|
|
|
void wm_add_default(bContext *C)
|
|
|
|
{
|
2008-12-18 02:56:48 +00:00
|
|
|
wmWindowManager *wm= alloc_libblock(&CTX_data_main(C)->wm, ID_WM, "WinMan");
|
2007-12-24 18:27:28 +00:00
|
|
|
wmWindow *win;
|
2009-01-27 17:12:40 +00:00
|
|
|
bScreen *screen= CTX_wm_screen(C); /* XXX from file read hrmf */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
CTX_wm_manager_set(C, wm);
|
2008-11-18 13:51:02 +00:00
|
|
|
win= wm_window_new(C);
|
2009-01-27 17:12:40 +00:00
|
|
|
win->screen= screen;
|
2009-02-07 19:37:29 +00:00
|
|
|
screen->winid= win->winid;
|
|
|
|
BLI_strncpy(win->screenname, screen->id.name+2, 21);
|
|
|
|
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
wm->winactive= win;
|
2009-02-18 13:29:54 +00:00
|
|
|
wm->file_saved= 1;
|
2008-01-07 18:03:41 +00:00
|
|
|
wm_window_make_drawable(C, win);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-08 16:43:19 +00:00
|
|
|
/* context is allowed to be NULL, do not free wm itself (library.c) */
|
2007-12-24 18:27:28 +00:00
|
|
|
void wm_close_and_free(bContext *C, wmWindowManager *wm)
|
|
|
|
{
|
|
|
|
wmWindow *win;
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
wmOperator *op;
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
wmKeyConfig *keyconf;
|
2009-10-20 13:58:53 +00:00
|
|
|
|
|
|
|
if(wm->autosavetimer)
|
|
|
|
wm_autosave_timer_ended(wm);
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
while((win= wm->windows.first)) {
|
|
|
|
BLI_remlink(&wm->windows, win);
|
2009-02-20 10:39:31 +00:00
|
|
|
win->screen= NULL; /* prevent draw clear to use screen */
|
2009-02-06 19:58:15 +00:00
|
|
|
wm_draw_window_clear(win);
|
2009-10-20 13:58:53 +00:00
|
|
|
wm_window_free(C, wm, win);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
while((op= wm->operators.first)) {
|
|
|
|
BLI_remlink(&wm->operators, op);
|
2008-12-24 14:52:17 +00:00
|
|
|
WM_operator_free(op);
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
}
|
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
while((keyconf=wm->keyconfigs.first)) {
|
|
|
|
BLI_remlink(&wm->keyconfigs, keyconf);
|
|
|
|
WM_keyconfig_free(keyconf);
|
2008-12-08 15:02:57 +00:00
|
|
|
}
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
BLI_freelistN(&wm->queue);
|
|
|
|
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
BLI_freelistN(&wm->paintcursors);
|
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
|
|
|
BLI_freelistN(&wm->drags);
|
2010-06-03 07:27:55 +00:00
|
|
|
|
|
|
|
wm_reports_free(wm);
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
if(C && CTX_wm_manager(C)==wm) CTX_wm_manager_set(C, NULL);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void wm_close_and_free_all(bContext *C, ListBase *wmlist)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm;
|
|
|
|
|
|
|
|
while((wm=wmlist->first)) {
|
|
|
|
wm_close_and_free(C, wm);
|
|
|
|
BLI_remlink(wmlist, wm);
|
|
|
|
MEM_freeN(wm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WM_main(bContext *C)
|
|
|
|
{
|
|
|
|
while(1) {
|
|
|
|
|
|
|
|
/* get events from ghost, handle window events, add to window queues */
|
2008-12-22 12:57:53 +00:00
|
|
|
wm_window_process_events(C);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
/* per window, all events to the window, screen, area and region handlers */
|
|
|
|
wm_event_do_handlers(C);
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* events have left notes about changes, we handle and cache it */
|
|
|
|
wm_event_do_notifiers(C);
|
|
|
|
|
|
|
|
/* execute cached changes draw */
|
|
|
|
wm_draw_update(C);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|