Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-12-16 23:03:28 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-12-16 23:03:28 +0300
commitc1379f6613d327a7604700007afd52e36f48080a (patch)
treedff5af25582f4e343b7c0a7399d760c9dff4d54a /source
parent962870b2358775ebef96198da4efe61a4224b526 (diff)
UI:
* Added support for defining properties for operator buttons, with uiButGetOperatorPtrRNA. Needed to cleanup a hack that was there for operator properties in RNA, now a separate OperatorProperties type is used for storing operator properties, instead of being part of the Operator type itself. * Allow selecting menu items with mouse release instead of press again. * Fix some cases with hanging tooltips in the UI.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface.c22
-rw-r--r--source/blender/editors/interface/interface.h3
-rw-r--r--source/blender/editors/interface/interface_handlers.c92
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h1
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_access.c44
-rw-r--r--source/blender/makesrna/intern/rna_wm.c42
-rw-r--r--source/blender/windowmanager/WM_api.h3
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c12
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
13 files changed, 162 insertions, 66 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 77cb36055e6..0540c0b2a25 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -334,6 +334,8 @@ int uiButGetRetVal (uiBut *but);
void uiButSetFlag (uiBut *but, int flag);
void uiButClearFlag (uiBut *but, int flag);
+struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
+
void uiBlockSetHandleFunc(uiBlock *block, void (*func)(struct bContext *C, void *arg, int event), void *arg);
void uiBlockSetButmFunc (uiBlock *block, void (*func)(struct bContext *C, void *arg, int but_a2), void *arg);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index afb10a1bb26..398a526fbd8 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -42,6 +42,7 @@
#include "BLI_dynstr.h"
#include "BKE_global.h"
+#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_screen.h"
#include "BKE_texture.h"
@@ -1343,6 +1344,11 @@ static void ui_free_link(uiLink *link)
static void ui_free_but(const bContext *C, uiBut *but)
{
+ if(but->opproperties) {
+ IDP_FreeProperty(but->opproperties);
+ MEM_freeN(but->opproperties);
+ }
+ if(but->opptr) MEM_freeN(but->opptr);
if(but->active) ui_button_active_cancel(C, but);
if(but->str && but->str != but->strdata) MEM_freeN(but->str);
ui_free_link(but->link);
@@ -2553,6 +2559,22 @@ int uiButGetRetVal(uiBut *but)
return but->retval;
}
+PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
+{
+ wmOperatorType *ot;
+
+ if(but->opname && !but->opptr) {
+ ot= WM_operatortype_find(but->opname);
+
+ if(ot) {
+ but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
+ RNA_pointer_create(NULL, NULL, ot->srna, &but->opproperties, but->opptr);
+ }
+ }
+
+ return but->opptr;
+}
+
void uiBlockSetHandleFunc(uiBlock *block, void (*func)(struct bContext *C, void *arg, int event), void *arg)
{
block->handle_func= func;
diff --git a/source/blender/editors/interface/interface.h b/source/blender/editors/interface/interface.h
index 24e99b36e09..577a374c47d 100644
--- a/source/blender/editors/interface/interface.h
+++ b/source/blender/editors/interface/interface.h
@@ -35,6 +35,7 @@
struct ARegion;
struct bContext;
+struct IDProperty;
struct uiHandleButtonData;
struct wmWindow;
@@ -162,6 +163,8 @@ struct uiBut {
/* Operator */
const char *opname;
int opcontext;
+ struct IDProperty *opproperties;
+ struct PointerRNA *opptr;
/* active button data */
struct uiHandleButtonData *active;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 761e0ff0712..057f9863278 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -41,6 +41,7 @@
#include "PIL_time.h"
#include "BKE_colortools.h"
+#include "BKE_idprop.h"
#include "BKE_global.h"
#include "BKE_texture.h"
#include "BKE_utildefines.h"
@@ -143,6 +144,7 @@ typedef struct uiAfterFunc {
const char *opname;
int opcontext;
+ IDProperty *opproperties;
} uiAfterFunc;
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
@@ -182,6 +184,11 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->opname= but->opname;
after->opcontext= but->opcontext;
+ after->opproperties= but->opproperties;
+
+ but->opname= NULL;
+ but->opcontext= 0;
+ but->opproperties= NULL;
BLI_addtail(&UIAfterFuncs, after);
}
@@ -205,8 +212,12 @@ static void ui_apply_but_funcs_after(bContext *C)
if(after->butm_func)
after->butm_func(C, after->butm_func_arg, after->a2);
- if(after->opname) /* make WM_operatora_call option? */
- WM_operator_call(C, after->opname, after->opcontext);
+ if(after->opname)
+ WM_operator_call(C, after->opname, after->opcontext, after->opproperties);
+ if(after->opproperties) {
+ IDP_FreeProperty(after->opproperties);
+ MEM_freeN(after->opproperties);
+ }
}
BLI_freelistN(&funcs);
@@ -1430,6 +1441,10 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
return WM_UI_HANDLER_BREAK;
}
+ else if(event->type == LEFTMOUSE && but->block->handle) {
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ return WM_UI_HANDLER_BREAK;
+ }
else if(ELEM(event->type, PADENTER, RETKEY) && event->val) {
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
return WM_UI_HANDLER_BREAK;
@@ -2659,10 +2674,9 @@ static void ui_blocks_set_tooltips(ARegion *ar, int enable)
block->tooltipdisabled= !enable;
}
-static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
+static int ui_mouse_inside_region(ARegion *ar, int x, int y)
{
uiBlock *block;
- uiBut *but, *butover= NULL;
int mx, my;
/* check if the mouse is in the region, and in case of a view2d also check
@@ -2671,7 +2685,7 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
for(block=ar->uiblocks.first; block; block=block->next)
block->auto_open= 0;
- return NULL;
+ return 0;
}
if(ar->v2d.mask.xmin!=ar->v2d.mask.xmax) {
@@ -2680,9 +2694,34 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
ui_window_to_region(ar, &mx, &my);
if(!BLI_in_rcti(&ar->v2d.mask, mx, my))
- return NULL;
+ return 0;
}
+ return 1;
+}
+
+static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
+{
+ if(!ui_mouse_inside_region(ar, x, y))
+ return 0;
+
+ ui_window_to_block(ar, but->block, &x, &y);
+
+ if(!ui_but_contains_pt(but, x, y))
+ return 0;
+
+ return 1;
+}
+
+static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
+{
+ uiBlock *block;
+ uiBut *but, *butover= NULL;
+ int mx, my;
+
+ if(!ui_mouse_inside_region(ar, x, y))
+ return NULL;
+
for(block=ar->uiblocks.first; block; block=block->next) {
mx= x;
my= y;
@@ -2949,7 +2988,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
ARegion *ar;
uiBut *postbut;
uiButtonActivateType posttype;
- int retval, mx, my;
+ int retval;
data= but->active;
block= but->block;
@@ -2961,11 +3000,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
switch(event->type) {
case MOUSEMOVE:
/* verify if we are still over the button, if not exit */
- mx= event->x;
- my= event->y;
- ui_window_to_block(ar, block, &mx, &my);
-
- if(!ui_but_contains_pt(but, mx, my)) {
+ if(!ui_mouse_inside_button(ar, but, event->x, event->y)) {
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -2990,11 +3025,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
WM_event_remove_window_timer(data->window, data->autoopentimer);
data->autoopentimer= NULL;
- mx= event->x;
- my= event->y;
- ui_window_to_block(ar, block, &mx, &my);
-
- if(ui_but_contains_pt(but, mx, my))
+ if(ui_mouse_inside_button(ar, but, event->x, event->y))
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
}
@@ -3010,11 +3041,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
switch(event->type) {
case MOUSEMOVE:
/* deselect the button when moving the mouse away */
- mx= event->x;
- my= event->y;
- ui_window_to_block(ar, block, &mx, &my);
-
- if(ui_but_contains_pt(but, mx, my)) {
+ if(ui_mouse_inside_button(ar, but, event->x, event->y)) {
if(!(but->flag & UI_SELECT)) {
but->flag |= UI_SELECT;
data->cancel= 0;
@@ -3082,7 +3109,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
return retval;
}
-static void ui_handle_button_closed_submenu(bContext *C, uiBut *but)
+static void ui_handle_button_closed_submenu(bContext *C, wmEvent *event, uiBut *but)
{
uiHandleButtonData *data;
uiMenuBlockHandle *menu;
@@ -3105,8 +3132,15 @@ static void ui_handle_button_closed_submenu(bContext *C, uiBut *but)
button_activate_exit(C, data, but, 1);
}
- else if(menu->menuretval == UI_RETURN_OUT)
- button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
+ else if(menu->menuretval == UI_RETURN_OUT) {
+ if(ui_mouse_inside_button(data->region, but, event->x, event->y)) {
+ button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
+ }
+ else {
+ data->cancel= 1;
+ button_activate_exit(C, data, but, 1);
+ }
+ }
}
/* ******************** menu navigation helpers ************** */
@@ -3451,7 +3485,7 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiMenuBlockHandle *menu, i
return retval;
}
-static int ui_handle_menu_closed_submenu(bContext *C, uiMenuBlockHandle *menu)
+static int ui_handle_menu_closed_submenu(bContext *C, wmEvent *event, uiMenuBlockHandle *menu)
{
ARegion *ar;
uiBut *but;
@@ -3477,7 +3511,7 @@ static int ui_handle_menu_closed_submenu(bContext *C, uiMenuBlockHandle *menu)
/* now let activated button in this menu exit, which
* will actually close the submenu too */
- ui_handle_button_closed_submenu(C, but);
+ ui_handle_button_closed_submenu(C, event, but);
}
if(menu->menuretval)
@@ -3504,7 +3538,7 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiMenuBlockHan
/* now handle events for our own menu */
if(retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
if(submenu && submenu->menuretval)
- retval= ui_handle_menu_closed_submenu(C, menu);
+ retval= ui_handle_menu_closed_submenu(C, event, menu);
else
retval= ui_handle_menu_event(C, event, menu, (submenu == NULL));
}
@@ -3589,7 +3623,7 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata)
/* handle events for the activated button */
if(retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
if(data->menu->menuretval)
- ui_handle_button_closed_submenu(C, but);
+ ui_handle_button_closed_submenu(C, event, but);
else
ui_handle_button_event(C, event, but);
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 0c298b62070..e4b3157c6a1 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1679,7 +1679,7 @@ static void operator_callback(bContext *C, void *arg, int retval)
const char *opname= arg;
if(retval > 0)
- WM_operator_call(C, opname, WM_OP_DEFAULT);
+ WM_operator_call(C, opname, WM_OP_DEFAULT, NULL);
}
void okee_operator(bContext *C, char *opname, char *str, ...)
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index e50aaee3c0e..7144710ae47 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -142,7 +142,6 @@ typedef struct wmOperatorType {
typedef struct wmKeymapItem {
struct wmKeymapItem *next, *prev;
- /* these are same order as wmOperator because RNA depends on it, fixme XXX */
char idname[64]; /* used to retrieve operator type pointer */
IDProperty *properties; /* default operator properties */
struct PointerRNA *ptr; /* rna pointer to access properties */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index cfcc3eb3e75..28359f7ccbe 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -119,6 +119,7 @@ extern StructRNA RNA_NodeTree;
extern StructRNA RNA_NorController;
extern StructRNA RNA_Object;
extern StructRNA RNA_Operator;
+extern StructRNA RNA_OperatorProperties;
extern StructRNA RNA_OrController;
extern StructRNA RNA_PackedFile;
extern StructRNA RNA_Panel;
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 0b15d4fa996..df67e856402 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -75,11 +75,11 @@ void RNA_pointer_create(StructRNA *idtype, ID *id, StructRNA *type, void *data,
r_ptr->data= data;
}
-static void rna_pointer_inherit_id(PointerRNA *parent, PointerRNA *ptr)
+static void rna_pointer_inherit_id(StructRNA *type, PointerRNA *parent, PointerRNA *ptr)
{
- if(ptr->type && ptr->type->flag & STRUCT_ID) {
+ if(type && type->flag & STRUCT_ID) {
ptr->id.data= ptr->data;
- ptr->id.type= ptr->type;
+ ptr->id.type= type;
}
else {
ptr->id.data= parent->id.data;
@@ -103,16 +103,16 @@ IDProperty *rna_idproperties_get(StructRNA *type, void *data, int create)
return IDP_GetProperties(data, create);
else if(type == &RNA_IDPropertyGroup)
return data;
- else if(type->from == &RNA_Operator) {
- wmOperator *op= (wmOperator*)data;
+ else if(type->from == &RNA_OperatorProperties) {
+ IDProperty **properties= (IDProperty**)data;
- if(create && !op->properties) {
+ if(create && !*properties) {
IDPropertyTemplate val;
val.i = 0; /* silence MSVC warning about uninitialized var when debugging */
- op->properties= IDP_New(IDP_GROUP, val, "property");
+ *properties= IDP_New(IDP_GROUP, val, "property");
}
- return op->properties;
+ return *properties;
}
else
return NULL;
@@ -839,8 +839,12 @@ static StructRNA *rna_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop,
else
type= pprop->structtype;
- if(type && type->refine)
- type= type->refine(r_ptr);
+ if(type) {
+ rna_pointer_inherit_id(type, ptr, r_ptr);
+
+ if(type->refine)
+ type= type->refine(r_ptr);
+ }
r_ptr->type= type;
return type;
@@ -858,9 +862,7 @@ void RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_
else
r_ptr->data= NULL;
- if(r_ptr->data && rna_property_pointer_type(ptr, prop, r_ptr))
- rna_pointer_inherit_id(ptr, r_ptr);
- else
+ if(!(r_ptr->data && rna_property_pointer_type(ptr, prop, r_ptr)))
memset(r_ptr, 0, sizeof(*r_ptr));
}
@@ -882,9 +884,13 @@ static StructRNA *rna_property_collection_type(CollectionPropertyIterator *iter)
else
type= cprop->structtype;
- if(type->refine)
- type= type->refine(&iter->ptr);
+ if(type) {
+ rna_pointer_inherit_id(type, &iter->parent, &iter->ptr);
+ if(type->refine)
+ type= type->refine(&iter->ptr);
+ }
+
iter->ptr.type= type;
return type;
}
@@ -895,9 +901,7 @@ static void rna_property_collection_get(CollectionPropertyIterator *iter)
iter->ptr.data= cprop->get(iter);
- if(iter->ptr.data && rna_property_collection_type(iter))
- rna_pointer_inherit_id(&iter->parent, &iter->ptr);
- else
+ if(!(iter->ptr.data && rna_property_collection_type(iter)))
memset(&iter->ptr, 0, sizeof(iter->ptr));
}
@@ -970,7 +974,7 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k
if(r_ptr->data) {
if(!r_ptr->type)
r_ptr->type= cprop->structtype;
- rna_pointer_inherit_id(ptr, r_ptr);
+ rna_pointer_inherit_id(r_ptr->type, ptr, r_ptr);
return 1;
}
@@ -1011,7 +1015,7 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co
if(r_ptr->data) {
if(!r_ptr->type)
r_ptr->type= cprop->structtype;
- rna_pointer_inherit_id(ptr, r_ptr);
+ rna_pointer_inherit_id(r_ptr->type, ptr, r_ptr);
return 1;
}
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 0ec62cd5666..c039bd79ac4 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -33,13 +33,30 @@
#ifdef RNA_RUNTIME
-static StructRNA *rna_Operator_refine(PointerRNA *ptr)
+static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
{
- wmOperator *op= (wmOperator*)ptr->data;
- return op->type->srna;
+ wmWindowManager *wm= ptr->id.data;
+ wmOperator *op;
+
+ if(wm)
+ for(op=wm->operators.first; op; op=op->next)
+ if(op->properties == ptr->data)
+ return op;
+
+ return NULL;
+}
+
+static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr)
+{
+ wmOperator *op= rna_OperatorProperties_find_operator(ptr);
+
+ if(op)
+ return op->type->srna;
+ else
+ return &RNA_OperatorProperties;
}
-/*static void rna_Operator_name_get(PointerRNA *ptr, char *value)
+static void rna_Operator_name_get(PointerRNA *ptr, char *value)
{
wmOperator *op= (wmOperator*)ptr->data;
strcpy(value, op->type->name);
@@ -49,17 +66,30 @@ static int rna_Operator_name_length(PointerRNA *ptr)
{
wmOperator *op= (wmOperator*)ptr->data;
return strlen(op->type->name);
-}*/
+}
#else
static void rna_def_operator(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
srna= RNA_def_struct(brna, "Operator", NULL, "Operator");
RNA_def_struct_sdna(srna, "wmOperator");
- RNA_def_struct_funcs(srna, NULL, "rna_Operator_refine");
+
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "OperatorProperties");
+ RNA_def_property_ui_text(prop, "Properties", "");
+
+ srna= RNA_def_struct(brna, "OperatorProperties", NULL, "Operator Properties");
+ RNA_def_struct_funcs(srna, NULL, "rna_OperatorProperties_refine");
}
static void rna_def_windowmanager(BlenderRNA *brna)
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index a2b5049b8b5..ded0cb854b9 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -32,6 +32,7 @@
#include "DNA_windowmanager_types.h"
struct bContext;
+struct IDProperty;
struct wmEvent;
struct wmEventHandler;
struct wmGesture;
@@ -112,7 +113,7 @@ int WM_operator_winactive (struct bContext *C);
wmOperatorType *WM_operatortype_find(const char *idname);
void WM_operatortype_append (void (*opfunc)(wmOperatorType*));
-int WM_operator_call (struct bContext *C, const char *opstring, int context);
+int WM_operator_call (struct bContext *C, const char *opstring, int context, struct IDProperty *properties);
/* default operator callbacks for border/lasso */
int WM_border_select_invoke (struct bContext *C, wmOperator *op, struct wmEvent *event);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 7bfda3437a9..74f3fd33f29 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -295,7 +295,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, I
BLI_strncpy(op->idname, ot->idname, OP_MAX_TYPENAME);
op->ptr= MEM_callocN(sizeof(PointerRNA), "wmOperatorPtrRNA");
- RNA_pointer_create(&RNA_WindowManager, &C->wm->id, ot->srna, op, op->ptr);
+ RNA_pointer_create(&RNA_WindowManager, &C->wm->id, ot->srna, &op->properties, op->ptr);
if(op->type->invoke)
retval= (*op->type->invoke)(C, op, event);
@@ -314,7 +314,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, I
}
/* invokes operator in context */
-int WM_operator_call(bContext *C, const char *opstring, int context)
+int WM_operator_call(bContext *C, const char *opstring, int context, IDProperty *properties)
{
wmOperatorType *ot= WM_operatortype_find(opstring);
int retval;
@@ -334,7 +334,7 @@ int WM_operator_call(bContext *C, const char *opstring, int context)
C->region= ar1;
}
- retval= wm_operator_invoke(C, ot, C->window->eventstate, NULL);
+ retval= wm_operator_invoke(C, ot, C->window->eventstate, properties);
/* set region back */
C->region= ar;
@@ -346,7 +346,7 @@ int WM_operator_call(bContext *C, const char *opstring, int context)
ARegion *ar= C->region;
C->region= NULL;
- retval= wm_operator_invoke(C, ot, C->window->eventstate, NULL);
+ retval= wm_operator_invoke(C, ot, C->window->eventstate, properties);
C->region= ar;
return retval;
@@ -358,14 +358,14 @@ int WM_operator_call(bContext *C, const char *opstring, int context)
C->region= NULL;
C->area= NULL;
- retval= wm_operator_invoke(C, ot, C->window->eventstate, NULL);
+ retval= wm_operator_invoke(C, ot, C->window->eventstate, properties);
C->region= ar;
C->area= area;
return retval;
}
else
- return wm_operator_invoke(C, ot, C->window->eventstate, NULL);
+ return wm_operator_invoke(C, ot, C->window->eventstate, properties);
}
return 0;
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 9a231148c36..139fff45b48 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -84,7 +84,7 @@ static void keymap_properties_set(wmKeymapItem *kmi)
if(ot) {
kmi->ptr= MEM_callocN(sizeof(PointerRNA), "wmKeymapItemPtr");
- RNA_pointer_create(NULL, NULL, ot->srna, kmi, kmi->ptr);
+ RNA_pointer_create(NULL, NULL, ot->srna, &kmi->properties, kmi->ptr);
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index a7b54289616..e87451c2a8e 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -80,7 +80,7 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
wmOperatorType *ot;
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
- ot->srna= RNA_def_struct(&BLENDER_RNA, "", "Operator", "");
+ ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties", "");
opfunc(ot);
RNA_def_struct_identifier(ot->srna, ot->idname, ot->name);
BLI_addtail(&global_ops, ot);