diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-12 08:27:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-12 08:31:02 +0300 |
commit | 5234ced102e003d4239db82174dc90266d6f880a (patch) | |
tree | f5e5e4d2ba6fc9cdff34d0e7d3e9f5117f9719a0 /source/blender/makesrna/intern/rna_ui_api.c | |
parent | 819c00483dad75c25256e940ca43a6e3992f55de (diff) |
RNA: support None text argument to UI functions
Without this there isn't a convenient way to write wrapper UI functions
that forward a text argument that optionally uses the default text.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 973f92c6575..046e68a5738 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -452,8 +452,12 @@ static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propna static void api_ui_item_common_text(FunctionRNA *func) { - RNA_def_string(func, "text", NULL, 0, "", "Override automatic text of the item"); - RNA_def_string(func, "text_ctxt", NULL, 0, "", "Override automatic translation context of the given text"); + PropertyRNA *prop; + + prop = RNA_def_string(func, "text", NULL, 0, "", "Override automatic text of the item"); + RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); + prop = RNA_def_string(func, "text_ctxt", NULL, 0, "", "Override automatic translation context of the given text"); + RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); RNA_def_boolean(func, "translate", true, "", "Translate the given text, when UI translation is enabled"); } |