diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-08-21 16:57:47 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-08-21 16:57:47 +0400 |
commit | 1c614f6cf63fb65622b855123d8db76898d3c9ca (patch) | |
tree | f3e576a33418ab929db9459ddb7028b40ce81923 /source/blender/makesrna/intern/rna_ui_api.c | |
parent | 27797a45ee6cbc987350269e6827197f47daf036 (diff) |
2.5: layout.itemO now returns OperatorProperties to be filled in,
when passing properties=True as argument.
Other changes:
* uiItemR, uiItemFullR, uiItemFullO now accept a flag argument rather
than multiple different "boolean" arguments, but still exposed as
booleans to python.
* Fix RNA to support setting PROP_RNAPTR for return values.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 82694098e69..587ff57a0b5 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -37,6 +37,23 @@ #ifdef RNA_RUNTIME +static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, char *propname, int expand, int slider, int toggle) +{ + int flag= 0; + + flag |= (slider)? UI_ITEM_R_SLIDER: 0; + flag |= (expand)? UI_ITEM_R_EXPAND: 0; + flag |= (toggle)? UI_ITEM_R_TOGGLE: 0; + + uiItemR(layout, name, icon, ptr, propname, flag); +} + +static PointerRNA rna_uiItemO(uiLayout *layout, char *name, int icon, char *opname, int properties) +{ + int flag= (properties)? UI_ITEM_O_RETURN_PROPS: 0; + return uiItemFullO(layout, name, icon, opname, NULL, uiLayoutGetOperatorContext(layout), flag); +} + #else #define DEF_ICON(name) {name, #name, 0, #name, ""}, @@ -122,7 +139,7 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at.", 0.0f, 1.0f); /* items */ - func= RNA_def_function(srna, "itemR", "uiItemR"); + func= RNA_def_function(srna, "itemR", "rna_uiItemR"); api_ui_item_common(func); api_ui_item_rna_common(func); RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); @@ -150,8 +167,12 @@ void RNA_api_ui_layout(StructRNA *srna) parm= RNA_def_string(func, "search_property", "", 0, "", "Identifier of search collection property."); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "itemO", "uiItemO"); + func= RNA_def_function(srna, "itemO", "rna_uiItemO"); api_ui_item_op_common(func); + parm= RNA_def_boolean(func, "properties", 0, "Properties", "Return operator properties to fill in manually."); + parm= RNA_def_pointer(func, "return_properties", "OperatorProperties", "", "Operator properties to fill in, return when 'properties' is set to true."); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); + RNA_def_function_return(func, parm); func= RNA_def_function(srna, "item_enumO", "uiItemEnumO_string"); api_ui_item_op_common(func); @@ -292,10 +313,6 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "view3d_select_metaballmenu", "uiTemplate_view3d_select_metaballmenu"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); - func= RNA_def_function(srna, "view3d_select_armaturemenu", "uiTemplate_view3d_select_armaturemenu"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); - func= RNA_def_function(srna, "view3d_select_posemenu", "uiTemplate_view3d_select_posemenu"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); func= RNA_def_function(srna, "view3d_select_faceselmenu", "uiTemplate_view3d_select_faceselmenu"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); |