diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_operator_type.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_type.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c index 8f3052ace5e..96fbac3aecc 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.c +++ b/source/blender/windowmanager/intern/wm_operator_type.c @@ -595,4 +595,35 @@ const char *WM_operatortype_name(struct wmOperatorType *ot, struct PointerRNA *p return (name && name[0]) ? name : RNA_struct_ui_name(ot->srna); } +char *WM_operatortype_description(struct bContext *C, + struct wmOperatorType *ot, + struct PointerRNA *properties) +{ + if (ot->get_description && properties) { + char *description = ot->get_description(C, ot, properties); + + if (description) { + if (description[0]) { + return description; + } + else { + MEM_freeN(description); + } + } + } + + const char *info = RNA_struct_ui_description(ot->srna); + + if (!(info && info[0])) { + info = RNA_struct_ui_name(ot->srna); + } + + if (info && info[0]) { + return BLI_strdup(info); + } + else { + return NULL; + } +} + /** \} */ |