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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-09 15:10:28 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-09 15:10:28 +0400
commit8878c30b9b032f1a630c13c5ebb260cb9029ce3c (patch)
treecc0378b444e5b7069eb5c094f31b375a038437c7
parentb9f1117336e17438cab1db6174f7cf66eebc6b3e (diff)
2.5: WM_menu_invoke now uses the first enum property it can find,
if no enum property named "type" is available.
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c17
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);
}