2007-12-24 18:27:28 +00:00
|
|
|
/**
|
|
|
|
* $Id:
|
|
|
|
*
|
|
|
|
* ***** 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,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2008-01-14 19:44:20 +00:00
|
|
|
#include "DNA_ID.h"
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2008-12-19 18:28:37 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2008-12-26 03:56:52 +00:00
|
|
|
#include "BLI_dynstr.h" /*for WM_operator_pystring */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
#include "BKE_blender.h"
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#include "BKE_idprop.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_library.h"
|
2008-12-19 18:28:37 +00:00
|
|
|
#include "BKE_global.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_main.h"
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
#include "BKE_utildefines.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
#include "ED_fileselect.h"
|
|
|
|
#include "ED_screen.h"
|
|
|
|
|
2008-11-21 19:14:38 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
2008-12-15 19:19:39 +00:00
|
|
|
#include "UI_interface.h"
|
2008-12-17 15:38:40 +00:00
|
|
|
#include "UI_resources.h"
|
2008-12-15 19:19:39 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
|
2008-11-24 10:45:36 +00:00
|
|
|
#include "wm.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "wm_window.h"
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
#include "wm_subwindow.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "wm_event_system.h"
|
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2008-12-16 13:19:02 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
static ListBase global_ops= {NULL, NULL};
|
|
|
|
|
|
|
|
/* ************ operator API, exported ********** */
|
|
|
|
|
|
|
|
wmOperatorType *WM_operatortype_find(const char *idname)
|
|
|
|
{
|
|
|
|
wmOperatorType *ot;
|
|
|
|
|
|
|
|
for(ot= global_ops.first; ot; ot= ot->next) {
|
|
|
|
if(strncmp(ot->idname, idname, OP_MAX_TYPENAME)==0)
|
|
|
|
return ot;
|
|
|
|
}
|
2008-11-24 18:59:59 +00:00
|
|
|
printf("search for unknown operator %s\n", idname);
|
2007-12-24 18:27:28 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-12-21 08:53:36 +00:00
|
|
|
wmOperatorType *WM_operatortype_first(void)
|
|
|
|
{
|
|
|
|
return global_ops.first;
|
|
|
|
}
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* all ops in 1 list (for time being... needs evaluation later) */
|
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
|
|
|
void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
|
2008-01-07 18:03:41 +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
|
|
|
wmOperatorType *ot;
|
|
|
|
|
|
|
|
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
|
2008-12-19 04:06:24 +00:00
|
|
|
ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
|
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
|
|
|
opfunc(ot);
|
2008-12-19 04:06:24 +00:00
|
|
|
RNA_def_struct_ui_text(ot->srna, ot->name, "DOC_BROKEN"); /* TODO - add a discription to wmOperatorType? */
|
|
|
|
RNA_def_struct_identifier(ot->srna, ot->idname);
|
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(&global_ops, ot);
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
python operators (in bpy_opwrapper.*)
This means you can define an operator in python that is called from C or Python - like any other operator.
Python functions for invoke and exec can be registered with an operator name.
keywords are read from the python exec() function, then used to create operator properties. The default python values are used to set the property type and defaults.
def exec(size=2.0, text="blah"): ...
is equivalent to...
prop = RNA_def_property(ot->srna, "size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_default(prop, 2.0f);
prop = RNA_def_property(ot->srna, "size", PROP_STRING, PROP_NONE);
RNA_def_property_string_default(prop, "blah");
TODO -
* make use of events
* return OPERATOR_CANCELLED/OPERATOR_FINISHED.. etc
* add support for array args
* more testing
2008-12-27 14:52:49 +00:00
|
|
|
void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *userdata)
|
|
|
|
{
|
|
|
|
wmOperatorType *ot;
|
|
|
|
|
|
|
|
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
|
|
|
|
ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
|
|
|
|
opfunc(ot, userdata);
|
|
|
|
RNA_def_struct_ui_text(ot->srna, ot->name, "DOC_BROKEN"); /* TODO - add a discription to wmOperatorType? */
|
|
|
|
RNA_def_struct_identifier(ot->srna, ot->idname);
|
|
|
|
BLI_addtail(&global_ops, ot);
|
|
|
|
}
|
|
|
|
|
|
|
|
int WM_operatortype_remove(const char *idname)
|
|
|
|
{
|
|
|
|
wmOperatorType *ot = WM_operatortype_find(idname);
|
|
|
|
|
|
|
|
if (ot==NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
BLI_remlink(&global_ops, ot);
|
|
|
|
RNA_struct_free(&BLENDER_RNA, ot->srna);
|
|
|
|
MEM_freeN(ot);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-12-26 03:56:52 +00:00
|
|
|
/* print a string representation of the operator, with the args that it runs
|
|
|
|
* so python can run it again */
|
|
|
|
char *WM_operator_pystring(wmOperator *op)
|
|
|
|
{
|
|
|
|
const char *arg_name= NULL;
|
|
|
|
|
|
|
|
PropertyRNA *prop, *iterprop;
|
|
|
|
CollectionPropertyIterator iter;
|
|
|
|
|
|
|
|
/* for building the string */
|
|
|
|
DynStr *dynstr= BLI_dynstr_new();
|
|
|
|
char *cstring, *buf;
|
|
|
|
int first_iter=1;
|
|
|
|
|
|
|
|
BLI_dynstr_appendf(dynstr, "%s(", op->idname);
|
|
|
|
|
|
|
|
iterprop= RNA_struct_iterator_property(op->ptr);
|
|
|
|
RNA_property_collection_begin(op->ptr, iterprop, &iter);
|
|
|
|
|
|
|
|
for(; iter.valid; RNA_property_collection_next(&iter)) {
|
|
|
|
prop= iter.ptr.data;
|
|
|
|
arg_name= RNA_property_identifier(&iter.ptr, prop);
|
|
|
|
|
|
|
|
if (strcmp(arg_name, "rna_type")==0) continue;
|
|
|
|
|
|
|
|
buf= RNA_property_as_string(op->ptr, prop);
|
|
|
|
|
|
|
|
BLI_dynstr_appendf(dynstr, first_iter?"%s=%s":", %s=%s", arg_name, buf);
|
|
|
|
|
|
|
|
MEM_freeN(buf);
|
|
|
|
first_iter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
RNA_property_collection_end(&iter);
|
|
|
|
|
|
|
|
BLI_dynstr_append(dynstr, ")");
|
|
|
|
|
|
|
|
cstring = BLI_dynstr_get_cstring(dynstr);
|
|
|
|
BLI_dynstr_free(dynstr);
|
|
|
|
return cstring;
|
|
|
|
}
|
|
|
|
|
2009-01-01 20:44:40 +00:00
|
|
|
void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
|
|
|
|
{
|
|
|
|
wmOperatorType *ot= WM_operatortype_find(opstring);
|
|
|
|
|
|
|
|
if(ot)
|
2009-01-08 15:33:34 +00:00
|
|
|
RNA_pointer_create(NULL, ot->srna, NULL, ptr);
|
2009-01-01 20:44:40 +00:00
|
|
|
else
|
2009-01-15 04:13:38 +00:00
|
|
|
RNA_pointer_create(NULL, &RNA_OperatorProperties, NULL, ptr);
|
2009-01-01 20:44:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WM_operator_properties_free(PointerRNA *ptr)
|
|
|
|
{
|
|
|
|
IDProperty *properties= ptr->data;
|
|
|
|
|
|
|
|
if(properties) {
|
|
|
|
IDP_FreeProperty(properties);
|
|
|
|
MEM_freeN(properties);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
/* ************ default op callbacks, exported *********** */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2008-12-24 18:06:51 +00:00
|
|
|
/* invoke callback, uses enum property named "type" */
|
|
|
|
/* only weak thing is the fixed property name... */
|
|
|
|
int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
2008-12-17 15:38:40 +00:00
|
|
|
{
|
2008-12-24 18:06:51 +00:00
|
|
|
PropertyRNA *prop= RNA_struct_find_property(op->ptr, "type");
|
|
|
|
const EnumPropertyItem *item;
|
2009-01-15 16:07:39 +00:00
|
|
|
int totitem, i, len= strlen(op->type->name) + 8;
|
2008-12-24 18:06:51 +00:00
|
|
|
char *menu, *p;
|
2008-12-24 14:52:17 +00:00
|
|
|
|
2008-12-24 18:06:51 +00:00
|
|
|
if(prop) {
|
|
|
|
RNA_property_enum_items(op->ptr, prop, &item, &totitem);
|
|
|
|
|
|
|
|
for (i=0; i<totitem; i++)
|
2009-01-15 16:07:39 +00:00
|
|
|
len+= strlen(item[i].name) + 8;
|
2008-12-24 18:06:51 +00:00
|
|
|
|
|
|
|
menu= MEM_callocN(len, "string");
|
|
|
|
|
|
|
|
p= menu + sprintf(menu, "%s %%t", op->type->name);
|
|
|
|
for (i=0; i<totitem; i++)
|
|
|
|
p+= sprintf(p, "|%s %%x%d", item[i].name, item[i].value);
|
|
|
|
|
|
|
|
uiPupmenuOperator(C, totitem/30, op, "type", menu);
|
|
|
|
MEM_freeN(menu);
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
return OPERATOR_CANCELLED;
|
2008-12-17 15:38:40 +00:00
|
|
|
}
|
|
|
|
|
2008-12-24 14:52:17 +00:00
|
|
|
/* op->invoke */
|
2007-12-24 18:27:28 +00:00
|
|
|
int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
2008-12-17 15:38:40 +00:00
|
|
|
char buf[512];
|
|
|
|
|
|
|
|
sprintf(buf, "OK? %%i%d%%t|%s", ICON_HELP, op->type->name);
|
2008-12-24 14:52:17 +00:00
|
|
|
uiPupmenuOperator(C, 0, op, NULL, buf);
|
2008-12-17 15:38:40 +00:00
|
|
|
|
2008-12-24 14:52:17 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2008-12-17 15:38:40 +00:00
|
|
|
|
2008-12-24 14:52:17 +00:00
|
|
|
/* op->poll */
|
2007-12-24 18:27:28 +00:00
|
|
|
int WM_operator_winactive(bContext *C)
|
|
|
|
{
|
2008-12-18 02:56:48 +00:00
|
|
|
if(CTX_wm_window(C)==NULL) return 0;
|
2007-12-24 18:27:28 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ window / screen operator definitions ************** */
|
|
|
|
|
|
|
|
static void WM_OT_window_duplicate(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Duplicate Window";
|
|
|
|
ot->idname= "WM_OT_window_duplicate";
|
|
|
|
|
2008-12-17 15:38:40 +00:00
|
|
|
ot->invoke= WM_operator_confirm;
|
2007-12-24 18:27:28 +00:00
|
|
|
ot->exec= wm_window_duplicate_op;
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void WM_OT_save_homefile(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Save User Settings";
|
|
|
|
ot->idname= "WM_OT_save_homefile";
|
|
|
|
|
2008-12-17 15:38:40 +00:00
|
|
|
ot->invoke= WM_operator_confirm;
|
2007-12-24 18:27:28 +00:00
|
|
|
ot->exec= WM_write_homefile;
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
|
|
|
|
ot->flag= OPTYPE_REGISTER;
|
|
|
|
}
|
|
|
|
|
2008-12-19 18:28:37 +00:00
|
|
|
/* ********* recent file *********** */
|
|
|
|
|
|
|
|
static void recent_filelist(char *pup)
|
|
|
|
{
|
|
|
|
struct RecentFile *recent;
|
|
|
|
int i, ofs= 0;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
p= pup + sprintf(pup, "Open Recent%%t");
|
|
|
|
|
|
|
|
if (G.sce[0]) {
|
|
|
|
p+= sprintf(p, "|%s %%x%d", G.sce, 1);
|
|
|
|
ofs = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++) {
|
|
|
|
if (strcmp(recent->filename, G.sce)) {
|
|
|
|
p+= sprintf(p, "|%s %%x%d", recent->filename, i+ofs+1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-24 14:52:17 +00:00
|
|
|
static int recentfile_exec(bContext *C, wmOperator *op)
|
2008-12-19 18:28:37 +00:00
|
|
|
{
|
2008-12-24 14:52:17 +00:00
|
|
|
int event= RNA_enum_get(op->ptr, "nr");
|
2008-12-19 18:28:37 +00:00
|
|
|
|
|
|
|
if(event>0) {
|
|
|
|
if (G.sce[0] && (event==1))
|
2008-12-29 13:38:08 +00:00
|
|
|
WM_read_file(C, G.sce, op->reports);
|
2008-12-19 18:28:37 +00:00
|
|
|
else {
|
|
|
|
struct RecentFile *recent = BLI_findlink(&(G.recent_files), event-2);
|
|
|
|
if(recent) {
|
2008-12-29 13:38:08 +00:00
|
|
|
WM_read_file(C, recent->filename, op->reports);
|
2008-12-19 18:28:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-24 14:52:17 +00:00
|
|
|
return 0;
|
2008-12-19 18:28:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int wm_recentfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
char pup[2048];
|
|
|
|
|
|
|
|
recent_filelist(pup);
|
2008-12-24 14:52:17 +00:00
|
|
|
uiPupmenuOperator(C, 0, op, "nr", pup);
|
2008-12-19 18:28:37 +00:00
|
|
|
|
2008-12-24 14:52:17 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2008-12-19 18:28:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void WM_OT_open_recentfile(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Open Recent File";
|
|
|
|
ot->idname= "WM_OT_open_recentfile";
|
|
|
|
|
|
|
|
ot->invoke= wm_recentfile_invoke;
|
2008-12-24 14:52:17 +00:00
|
|
|
ot->exec= recentfile_exec;
|
2008-12-19 18:28:37 +00:00
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
|
|
|
|
ot->flag= OPTYPE_REGISTER;
|
2008-12-24 14:52:17 +00:00
|
|
|
|
|
|
|
RNA_def_property(ot->srna, "nr", PROP_ENUM, PROP_NONE);
|
|
|
|
|
2008-12-19 18:28:37 +00:00
|
|
|
}
|
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
/* ********* main file *********** */
|
|
|
|
|
|
|
|
static int wm_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
SpaceFile *sfile;
|
|
|
|
|
2009-01-06 18:52:18 +00:00
|
|
|
ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_FILE);
|
2009-01-06 14:42:54 +00:00
|
|
|
|
|
|
|
/* settings for filebrowser */
|
|
|
|
sfile= (SpaceFile*)CTX_wm_space_data(C);
|
|
|
|
sfile->op = op;
|
2009-01-08 18:47:16 +00:00
|
|
|
ED_fileselect_set_params(sfile, FILE_BLENDER, "Load", "C:\\", 0, 0, 0);
|
2009-01-06 14:42:54 +00:00
|
|
|
|
2009-01-08 18:47:16 +00:00
|
|
|
/* screen and area have been reset already in ED_screen_full_newspace */
|
2009-01-06 14:42:54 +00:00
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int wm_mainfile_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
char filename[FILE_MAX];
|
|
|
|
RNA_string_get(op->ptr, "filename", filename);
|
|
|
|
|
|
|
|
WM_read_file(C, filename, op->reports);
|
|
|
|
|
2009-01-21 19:28:28 +00:00
|
|
|
// XXX wm in context is not set correctly after WM_read_file -> crash
|
|
|
|
// WM_event_add_notifier(C, NC_WINDOW, NULL);
|
2009-01-06 14:42:54 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void WM_OT_open_mainfile(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Open Blender File";
|
|
|
|
ot->idname= "WM_OT_open_mainfile";
|
|
|
|
|
|
|
|
ot->invoke= wm_mainfile_invoke;
|
|
|
|
ot->exec= wm_mainfile_exec;
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
|
2009-01-06 17:38:44 +00:00
|
|
|
ot->flag= 0;
|
2009-01-06 14:42:54 +00:00
|
|
|
|
|
|
|
RNA_def_property(ot->srna, "filename", PROP_STRING, PROP_FILEPATH);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-01-21 19:28:28 +00:00
|
|
|
static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
SpaceFile *sfile;
|
|
|
|
|
|
|
|
ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_FILE);
|
|
|
|
|
|
|
|
/* settings for filebrowser */
|
|
|
|
sfile= (SpaceFile*)CTX_wm_space_data(C);
|
|
|
|
sfile->op = op;
|
|
|
|
// XXX replace G.sce
|
|
|
|
ED_fileselect_set_params(sfile, FILE_BLENDER, "Save As", G.sce, 0, 0, 0);
|
|
|
|
|
|
|
|
/* screen and area have been reset already in ED_screen_full_newspace */
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
char filename[FILE_MAX];
|
|
|
|
RNA_string_get(op->ptr, "filename", filename);
|
|
|
|
|
|
|
|
WM_write_file(C, filename, op->reports);
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void WM_OT_save_as_mainfile(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Open Blender File";
|
|
|
|
ot->idname= "WM_OT_save_as_mainfile";
|
|
|
|
|
|
|
|
ot->invoke= wm_save_as_mainfile_invoke;
|
|
|
|
ot->exec= wm_save_as_mainfile_exec;
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
|
|
|
|
ot->flag= 0;
|
|
|
|
|
|
|
|
RNA_def_property(ot->srna, "filename", PROP_STRING, PROP_FILEPATH);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-12-19 18:28:37 +00:00
|
|
|
/* *********************** */
|
|
|
|
|
2008-01-01 09:07:02 +00:00
|
|
|
static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Toggle Fullscreen";
|
|
|
|
ot->idname= "WM_OT_window_fullscreen_toggle";
|
|
|
|
|
2008-12-17 15:38:40 +00:00
|
|
|
ot->invoke= WM_operator_confirm;
|
2008-01-01 09:07:02 +00:00
|
|
|
ot->exec= wm_window_fullscreen_toggle_op;
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
}
|
|
|
|
|
2008-01-15 18:54:38 +00:00
|
|
|
static void WM_OT_exit_blender(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Exit Blender";
|
|
|
|
ot->idname= "WM_OT_exit_blender";
|
|
|
|
|
2008-12-17 15:38:40 +00:00
|
|
|
ot->invoke= WM_operator_confirm;
|
2008-01-15 18:54:38 +00:00
|
|
|
ot->exec= wm_exit_blender_op;
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* ************ default paint cursors, draw always around cursor *********** */
|
|
|
|
/*
|
|
|
|
- returns handler to free
|
|
|
|
- poll(bContext): returns 1 if draw should happen
|
|
|
|
- draw(bContext): drawing callback for paint cursor
|
|
|
|
*/
|
|
|
|
|
|
|
|
void *WM_paint_cursor_activate(wmWindowManager *wm, int (*poll)(bContext *C), void (*draw)(bContext *C, int, int))
|
|
|
|
{
|
|
|
|
wmPaintCursor *pc= MEM_callocN(sizeof(wmPaintCursor), "paint cursor");
|
|
|
|
|
|
|
|
BLI_addtail(&wm->paintcursors, pc);
|
|
|
|
|
|
|
|
pc->poll= poll;
|
|
|
|
pc->draw= draw;
|
|
|
|
|
|
|
|
return pc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
|
|
|
|
{
|
|
|
|
wmPaintCursor *pc;
|
|
|
|
|
|
|
|
for(pc= wm->paintcursors.first; pc; pc= pc->next) {
|
|
|
|
if(pc == (wmPaintCursor *)handle) {
|
|
|
|
BLI_remlink(&wm->paintcursors, pc);
|
|
|
|
MEM_freeN(pc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
/* ************ window gesture operator-callback definitions ************** */
|
2008-01-19 17:54:05 +00:00
|
|
|
/*
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
* These are default callbacks for use in operators requiring gesture input
|
2008-01-19 17:54:05 +00:00
|
|
|
*/
|
|
|
|
|
2008-11-24 10:45:36 +00:00
|
|
|
/* **************** Border gesture *************** */
|
|
|
|
|
|
|
|
/* Border gesture has two types:
|
|
|
|
1) WM_GESTURE_CROSS_RECT: starts a cross, on mouse click it changes to border
|
|
|
|
2) WM_GESTURE_RECT: starts immediate as a border, on mouse click or release it ends
|
|
|
|
|
|
|
|
It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type)
|
|
|
|
*/
|
|
|
|
|
2008-12-21 16:24:19 +00:00
|
|
|
static void border_apply(bContext *C, wmOperator *op, int event_type)
|
2008-01-19 17:54:05 +00:00
|
|
|
{
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
wmGesture *gesture= op->customdata;
|
|
|
|
rcti *rect= gesture->customdata;
|
|
|
|
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
if(rect->xmin > rect->xmax)
|
|
|
|
SWAP(int, rect->xmin, rect->xmax);
|
|
|
|
if(rect->ymin > rect->ymax)
|
|
|
|
SWAP(int, rect->ymin, rect->ymax);
|
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
/* operator arguments and storage. */
|
2008-11-24 15:51:55 +00:00
|
|
|
RNA_int_set(op->ptr, "xmin", rect->xmin);
|
|
|
|
RNA_int_set(op->ptr, "ymin", rect->ymin);
|
|
|
|
RNA_int_set(op->ptr, "xmax", rect->xmax);
|
|
|
|
RNA_int_set(op->ptr, "ymax", rect->ymax);
|
2008-12-21 16:24:19 +00:00
|
|
|
if( RNA_struct_find_property(op->ptr, "event_type") )
|
2008-12-21 11:05:43 +00:00
|
|
|
RNA_int_set(op->ptr, "event_type", event_type);
|
2008-11-24 10:45:36 +00:00
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
op->type->exec(C, 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
|
|
|
}
|
|
|
|
|
2009-01-02 14:11:18 +00:00
|
|
|
static void wm_gesture_end(bContext *C, 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
|
|
|
{
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
wmGesture *gesture= op->customdata;
|
|
|
|
|
|
|
|
WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */
|
|
|
|
op->customdata= NULL;
|
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
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
ED_area_tag_redraw(CTX_wm_area(C));
|
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
|
|
|
|
|
|
|
}
|
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
int WM_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
2008-01-19 17:54:05 +00:00
|
|
|
{
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
op->customdata= WM_gesture_new(C, event, WM_GESTURE_CROSS_RECT);
|
2008-01-19 17:54:05 +00:00
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
/* add modal handler */
|
2008-12-18 02:56:48 +00:00
|
|
|
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2008-01-19 17:54:05 +00:00
|
|
|
}
|
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
|
2008-01-19 17:54:05 +00:00
|
|
|
{
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
wmGesture *gesture= op->customdata;
|
|
|
|
rcti *rect= gesture->customdata;
|
|
|
|
int sx, sy;
|
|
|
|
|
2008-01-19 17:54:05 +00:00
|
|
|
switch(event->type) {
|
|
|
|
case MOUSEMOVE:
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
|
|
|
|
if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
|
|
|
|
rect->xmin= rect->xmax= event->x - sx;
|
|
|
|
rect->ymin= rect->ymax= event->y - sy;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
rect->xmax= event->x - sx;
|
|
|
|
rect->ymax= event->y - sy;
|
|
|
|
}
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
|
2008-01-19 17:54:05 +00:00
|
|
|
break;
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
|
2008-01-19 17:54:05 +00:00
|
|
|
case LEFTMOUSE:
|
2008-11-24 10:45:36 +00:00
|
|
|
case MIDDLEMOUSE:
|
|
|
|
case RIGHTMOUSE:
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
if(event->val==1) {
|
|
|
|
if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
|
|
|
|
gesture->mode= 1;
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2008-12-21 16:24:19 +00:00
|
|
|
border_apply(C, op, event->type);
|
2009-01-02 14:11:18 +00:00
|
|
|
wm_gesture_end(C, 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
|
|
|
return OPERATOR_FINISHED;
|
2008-01-19 17:54:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ESCKEY:
|
2009-01-02 14:11:18 +00:00
|
|
|
wm_gesture_end(C, op);
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2008-01-19 17:54:05 +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
|
|
|
return OPERATOR_RUNNING_MODAL;
|
2008-01-19 17:54:05 +00:00
|
|
|
}
|
|
|
|
|
2008-12-21 16:24:19 +00:00
|
|
|
/* **************** circle gesture *************** */
|
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
|
|
|
/* works now only for selection or modal paint stuff, calls exec while hold mouse, exit on release */
|
2008-12-21 16:24:19 +00:00
|
|
|
|
|
|
|
int WM_gesture_circle_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
op->customdata= WM_gesture_new(C, event, WM_GESTURE_CIRCLE);
|
|
|
|
|
|
|
|
/* add modal handler */
|
|
|
|
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2008-12-21 16:24:19 +00:00
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gesture_circle_apply(bContext *C, wmOperator *op, int event_type)
|
|
|
|
{
|
|
|
|
wmGesture *gesture= op->customdata;
|
|
|
|
rcti *rect= gesture->customdata;
|
|
|
|
|
|
|
|
/* operator arguments and storage. */
|
|
|
|
RNA_int_set(op->ptr, "x", rect->xmin);
|
|
|
|
RNA_int_set(op->ptr, "y", rect->ymin);
|
|
|
|
RNA_int_set(op->ptr, "radius", rect->xmax);
|
|
|
|
if( RNA_struct_find_property(op->ptr, "event_type") )
|
|
|
|
RNA_int_set(op->ptr, "event_type", event_type);
|
|
|
|
|
|
|
|
if(op->type->exec)
|
|
|
|
op->type->exec(C, op);
|
|
|
|
}
|
|
|
|
|
|
|
|
int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
wmGesture *gesture= op->customdata;
|
|
|
|
rcti *rect= gesture->customdata;
|
|
|
|
int sx, sy;
|
|
|
|
|
|
|
|
switch(event->type) {
|
|
|
|
case MOUSEMOVE:
|
|
|
|
|
|
|
|
wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
|
|
|
|
|
|
|
|
rect->xmin= event->x - sx;
|
|
|
|
rect->ymin= event->y - sy;
|
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2008-12-21 16:24:19 +00:00
|
|
|
|
|
|
|
if(gesture->mode)
|
|
|
|
gesture_circle_apply(C, op, event->type);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case WHEELUPMOUSE:
|
|
|
|
rect->xmax += 2 + rect->xmax/10;
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2008-12-21 16:24:19 +00:00
|
|
|
break;
|
|
|
|
case WHEELDOWNMOUSE:
|
|
|
|
rect->xmax -= 2 + rect->xmax/10;
|
|
|
|
if(rect->xmax < 1) rect->xmax= 1;
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2008-12-21 16:24:19 +00:00
|
|
|
break;
|
|
|
|
case LEFTMOUSE:
|
|
|
|
case MIDDLEMOUSE:
|
|
|
|
case RIGHTMOUSE:
|
|
|
|
if(event->val==0) { /* key release */
|
2009-01-02 14:11:18 +00:00
|
|
|
wm_gesture_end(C, op);
|
2008-12-21 16:24:19 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gesture->mode= 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case ESCKEY:
|
2009-01-02 14:11:18 +00:00
|
|
|
wm_gesture_end(C, op);
|
2008-12-21 16:24:19 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* template to copy from */
|
|
|
|
void WM_OT_circle_gesture(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Circle Gesture";
|
|
|
|
ot->idname= "WM_OT_circle_gesture";
|
|
|
|
|
|
|
|
ot->invoke= WM_gesture_circle_invoke;
|
|
|
|
ot->modal= WM_gesture_circle_modal;
|
|
|
|
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
|
|
|
|
RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE);
|
|
|
|
RNA_def_property(ot->srna, "radius", PROP_INT, PROP_NONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-11-24 10:45:36 +00:00
|
|
|
/* **************** Tweak gesture *************** */
|
|
|
|
|
|
|
|
static int tweak_gesture_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
op->customdata= WM_gesture_new(C, event, WM_GESTURE_TWEAK);
|
|
|
|
|
|
|
|
/* add modal handler */
|
2008-12-18 02:56:48 +00:00
|
|
|
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
|
2008-11-24 10:45:36 +00:00
|
|
|
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2008-11-24 10:45:36 +00:00
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tweak_gesture_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
2008-12-18 02:56:48 +00:00
|
|
|
wmWindow *window= CTX_wm_window(C);
|
2008-11-24 10:45:36 +00:00
|
|
|
wmGesture *gesture= op->customdata;
|
|
|
|
rcti *rect= gesture->customdata;
|
|
|
|
int sx, sy, val;
|
|
|
|
|
|
|
|
switch(event->type) {
|
|
|
|
case MOUSEMOVE:
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
wm_subwindow_getorigin(window, gesture->swinid, &sx, &sy);
|
2008-11-24 10:45:36 +00:00
|
|
|
|
|
|
|
rect->xmax= event->x - sx;
|
|
|
|
rect->ymax= event->y - sy;
|
|
|
|
|
|
|
|
if((val= wm_gesture_evaluate(C, gesture))) {
|
|
|
|
wmEvent event;
|
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
event= *(window->eventstate);
|
2.5: work on bringing back SpaceTime options
- RMB select, also with SHIFT
- RMB tweak for translate
- SHIFT+D dupli
- BKEY border select/deselect
- AKEY (de)select all
- XKEY delete
- GKEY grab
Added some XXX comments for future todos, especially for when other
spaces come back with time markers.
Also added ED_util for putting in all to-be-cleaned cruft
Context conflict: input methods for Markers can conflict with other
spacetypes. It was solved in pre-2.5 with manually tweaking it all over,
but I would prefer one keymap for all marker stuff. Needs some thinking...
could be solved with a boundbox check for bottom part of 2d window.
Tweak issue: both tweak styles are possible:
- Hold mouse button, move, operator ends on mouse release
- Hold mouse button, move, operator ends on mouse click
Problem is that modally handled operators use fixed keymaps... like ESC,
SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot
to say for making this all consistant, or become part of 1 general keymap?
Should also be possibe to define 'tweak' defaults for Tablet different
than for mouse...
2008-11-29 15:10:31 +00:00
|
|
|
if(gesture->event_type==LEFTMOUSE)
|
|
|
|
event.type= EVT_TWEAK_L;
|
|
|
|
else if(gesture->event_type==RIGHTMOUSE)
|
|
|
|
event.type= EVT_TWEAK_R;
|
|
|
|
else
|
|
|
|
event.type= EVT_TWEAK_M;
|
2008-11-24 10:45:36 +00:00
|
|
|
event.val= val;
|
|
|
|
/* mouse coords! */
|
2008-12-18 02:56:48 +00:00
|
|
|
wm_event_add(window, &event);
|
2008-11-24 10:45:36 +00:00
|
|
|
|
2009-01-02 14:11:18 +00:00
|
|
|
wm_gesture_end(C, op);
|
2008-11-24 10:45:36 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
else
|
2008-12-27 16:09:56 +00:00
|
|
|
wm_gesture_tag_redraw(C);
|
2008-11-24 10:45:36 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LEFTMOUSE:
|
|
|
|
case RIGHTMOUSE:
|
|
|
|
case MIDDLEMOUSE:
|
|
|
|
if(gesture->event_type==event->type) {
|
|
|
|
wm_gesture_evaluate(C, gesture);
|
2009-01-02 14:11:18 +00:00
|
|
|
wm_gesture_end(C, op);
|
2008-11-24 10:45:36 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WM_OT_tweak_gesture(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
ot->name= "Tweak Gesture";
|
|
|
|
ot->idname= "WM_OT_tweak_gesture";
|
|
|
|
|
|
|
|
ot->invoke= tweak_gesture_invoke;
|
|
|
|
ot->modal= tweak_gesture_modal;
|
|
|
|
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
}
|
|
|
|
|
2009-01-02 14:11:18 +00:00
|
|
|
/* *********************** lasso gesture ****************** */
|
|
|
|
|
|
|
|
int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
op->customdata= WM_gesture_new(C, event, WM_GESTURE_LASSO);
|
|
|
|
|
|
|
|
/* add modal handler */
|
|
|
|
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
|
|
|
|
|
|
|
|
wm_gesture_tag_redraw(C);
|
|
|
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void gesture_lasso_apply(bContext *C, wmOperator *op, int event_type)
|
|
|
|
{
|
|
|
|
wmGesture *gesture= op->customdata;
|
|
|
|
PointerRNA itemptr;
|
|
|
|
float loc[2];
|
|
|
|
int i;
|
|
|
|
short *lasso= gesture->customdata;
|
|
|
|
|
|
|
|
/* operator storage as path. */
|
|
|
|
|
|
|
|
for(i=0; i<gesture->points; i++, lasso+=2) {
|
|
|
|
loc[0]= lasso[0];
|
|
|
|
loc[1]= lasso[1];
|
|
|
|
RNA_collection_add(op->ptr, "path", &itemptr);
|
|
|
|
RNA_float_set_array(&itemptr, "loc", loc);
|
|
|
|
}
|
|
|
|
|
|
|
|
wm_gesture_end(C, op);
|
|
|
|
|
|
|
|
if(op->type->exec)
|
|
|
|
op->type->exec(C, op);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
{
|
|
|
|
wmGesture *gesture= op->customdata;
|
|
|
|
int sx, sy;
|
|
|
|
|
|
|
|
switch(event->type) {
|
|
|
|
case MOUSEMOVE:
|
|
|
|
|
|
|
|
wm_gesture_tag_redraw(C);
|
|
|
|
|
|
|
|
wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
|
|
|
|
if(gesture->points < WM_LASSO_MAX_POINTS) {
|
|
|
|
short *lasso= gesture->customdata;
|
|
|
|
lasso += 2 * gesture->points;
|
|
|
|
lasso[0] = event->x - sx;
|
|
|
|
lasso[1] = event->y - sy;
|
|
|
|
gesture->points++;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
gesture_lasso_apply(C, op, event->type);
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LEFTMOUSE:
|
|
|
|
case MIDDLEMOUSE:
|
|
|
|
case RIGHTMOUSE:
|
|
|
|
if(event->val==0) { /* key release */
|
|
|
|
gesture_lasso_apply(C, op, event->type);
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ESCKEY:
|
|
|
|
wm_gesture_end(C, op);
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* template to copy from */
|
|
|
|
|
|
|
|
static int gesture_lasso_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
RNA_BEGIN(op->ptr, itemptr, "path") {
|
|
|
|
float loc[2];
|
|
|
|
|
|
|
|
RNA_float_get_array(&itemptr, "loc", loc);
|
|
|
|
printf("Location: %f %f\n", loc[0], loc[1]);
|
|
|
|
}
|
|
|
|
RNA_END;
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WM_OT_lasso_gesture(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
ot->name= "Lasso Gesture";
|
|
|
|
ot->idname= "WM_OT_lasso_gesture";
|
|
|
|
|
|
|
|
ot->invoke= WM_gesture_lasso_invoke;
|
|
|
|
ot->modal= WM_gesture_lasso_modal;
|
|
|
|
ot->exec= gesture_lasso_exec;
|
|
|
|
|
|
|
|
ot->poll= WM_operator_winactive;
|
|
|
|
|
|
|
|
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
|
|
|
|
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
|
|
|
|
}
|
|
|
|
#endif
|
2008-11-24 10:45:36 +00:00
|
|
|
|
2.5: gesture code in WM
- Simplified and cleaned previous border code
It was a bit too complex, too many data manipulations
Original idea was to have WM API calls to manage border, circle, lines,
lasso, etc. This now means that WM provides callbacks for custom operators,
so it's very easy to make them. Check bottom of screen_edit.c for an
example.
Currently two borders were coded; with and without cross hair.
Press Bkey in any area-region to test it (note: time window has wrong matrix!)
Some specs to note:
- gestures are in region space, and draw 'over'. That latter still needs some
work when we do real composites.
- only the active region is redrawn.
- on todo is the generic gesture engine for 'tweak' or like how currently grab
gestures in Blender work. These will be configurable per area-region, and WM
then will send the proper "Gesture Event" with properties (N, S, E, W, etc)
to which you then can assign operators. Such events will be generated with low
priority, so other handlers who swallowed mouse events have preference.
2008-11-19 13:16:05 +00:00
|
|
|
/* ******************************************************* */
|
2008-01-19 17:54:05 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* called on initialize WM_exit() */
|
|
|
|
void wm_operatortype_free(void)
|
|
|
|
{
|
|
|
|
BLI_freelistN(&global_ops);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called on initialize WM_init() */
|
|
|
|
void wm_operatortype_init(void)
|
|
|
|
{
|
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_operatortype_append(WM_OT_window_duplicate);
|
|
|
|
WM_operatortype_append(WM_OT_save_homefile);
|
|
|
|
WM_operatortype_append(WM_OT_window_fullscreen_toggle);
|
|
|
|
WM_operatortype_append(WM_OT_exit_blender);
|
2008-11-24 10:45:36 +00:00
|
|
|
WM_operatortype_append(WM_OT_tweak_gesture);
|
2008-12-19 18:28:37 +00:00
|
|
|
WM_operatortype_append(WM_OT_open_recentfile);
|
2009-01-06 14:42:54 +00:00
|
|
|
WM_operatortype_append(WM_OT_open_mainfile);
|
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
|
|
|
WM_operatortype_append(WM_OT_jobs_timer);
|
2009-01-21 19:28:28 +00:00
|
|
|
WM_operatortype_append(WM_OT_save_as_mainfile);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* default keymap for windows and screens, only call once per WM */
|
|
|
|
void wm_window_keymap(wmWindowManager *wm)
|
|
|
|
{
|
2008-12-08 15:02:57 +00:00
|
|
|
ListBase *keymap= WM_keymap_listbase(wm, "Window", 0, 0);
|
|
|
|
|
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
|
|
|
/* items to make WM work */
|
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_jobs_timer", TIMERJOBS, KM_ANY, KM_ANY, 0);
|
|
|
|
|
2008-11-19 16:28:11 +00:00
|
|
|
/* note, this doesn't replace existing keymap items */
|
2008-12-08 15:02:57 +00:00
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_window_duplicate", AKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
|
2008-12-19 18:28:37 +00:00
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_open_recentfile", OKEY, KM_PRESS, KM_CTRL, 0);
|
2009-01-06 14:42:54 +00:00
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
|
2009-01-21 19:28:28 +00:00
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_save_as_mainfile", F2KEY, KM_PRESS, 0, 0);
|
2008-12-08 15:02:57 +00:00
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", FKEY, KM_PRESS, 0, 0);
|
2008-12-17 15:38:40 +00:00
|
|
|
WM_keymap_verify_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
|
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
|
|
|
}
|
|
|
|
|