diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-02-01 05:37:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-02-01 05:37:12 +0300 |
commit | 2755d48d4efed7318bbc084482858f675b3dcdb3 (patch) | |
tree | 0bb95fd5abb21b7b671e83109eb2c9b41cad9a2e /source/blender/windowmanager | |
parent | 75f7f1f21a2214a883acdec027157f663d71598d (diff) |
- Change 2 operators from using int properties into enums.
- Renamed MESH_OT_mesh_selection_mode_menu to MESH_OT_mesh_selection_type since the operator doesnt have to be accessed from a menu.
Shaul, you might want to look over this, using enums means WM_menu_invoke can be used instead of writing an invoke function for each operator.
Added error messages to WM_menu_invoke if no enum "type" property is found.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 50de3a03b82..0ae47c029c2 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -204,8 +204,14 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) const EnumPropertyItem *item; int totitem, i, len= strlen(op->type->name) + 8; char *menu, *p; - - if(prop) { + + if(prop==NULL) { + printf("WM_menu_invoke: %s has no \"type\" enum property\n", op->type->idname); + } + else if (RNA_property_type(op->ptr, prop) != PROP_ENUM) { + printf("WM_menu_invoke: %s \"type\" is not an enum property\n", op->type->idname); + } + else { RNA_property_enum_items(op->ptr, prop, &item, &totitem); for (i=0; i<totitem; i++) |