diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index c7011777dbf..ca2fbe23c3e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -448,13 +448,24 @@ void WM_operator_properties_free(PointerRNA *ptr) /* ************ default op callbacks, exported *********** */ /* 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) { - PropertyRNA *prop= RNA_struct_find_property(op->ptr, "type"); + PropertyRNA *prop; uiPopupMenu *pup; uiLayout *layout; + prop= RNA_struct_find_property(op->ptr, "type"); + + if(!prop) { + RNA_STRUCT_BEGIN(op->ptr, findprop) { + if(RNA_property_type(findprop) == PROP_ENUM) { + prop= findprop; + break; + } + } + RNA_STRUCT_END; + } + if(prop==NULL) { printf("WM_menu_invoke: %s has no \"type\" enum property\n", op->type->idname); } @@ -464,7 +475,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) else { pup= uiPupMenuBegin(C, op->type->name, 0); layout= uiPupMenuLayout(pup); - uiItemsEnumO(layout, op->type->idname, "type"); + uiItemsEnumO(layout, op->type->idname, (char*)RNA_property_identifier(prop)); uiPupMenuEnd(C, pup); } |