diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index c3ffeaf6f6f..5f60ecf449b 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1420,6 +1420,39 @@ static void rna_operator_cancel_cb(bContext *C, wmOperator *op) RNA_parameter_list_free(&list); } +static char *rna_operator_description_cb(bContext *C, wmOperatorType *ot, PointerRNA *prop_ptr) +{ + extern FunctionRNA rna_Operator_description_func; + + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + void *ret; + char *result; + + RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */ + func = &rna_Operator_description_func; /* RNA_struct_find_function(&ptr, "description"); */ + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "context", &C); + RNA_parameter_set_lookup(&list, "properties", prop_ptr); + ot->ext.call(C, &ptr, func, &list); + + RNA_parameter_get_lookup(&list, "result", &ret); + result = (char *)ret; + + if (result && result[0]) { + result = BLI_strdup(result); + } + else { + result = NULL; + } + + RNA_parameter_list_free(&list); + + return result; +} + static void rna_Operator_unregister(struct Main *bmain, StructRNA *type); /* bpy_operator_wrap.c */ @@ -1437,7 +1470,7 @@ static StructRNA *rna_Operator_register(Main *bmain, wmOperatorType dummyot = {NULL}; wmOperator dummyop = {NULL}; PointerRNA dummyotr; - int have_function[7]; + int have_function[8]; struct { char idname[OP_MAX_TYPENAME]; @@ -1531,6 +1564,7 @@ static StructRNA *rna_Operator_register(Main *bmain, dummyot.modal = (have_function[4]) ? rna_operator_modal_cb : NULL; dummyot.ui = (have_function[5]) ? rna_operator_draw_cb : NULL; dummyot.cancel = (have_function[6]) ? rna_operator_cancel_cb : NULL; + dummyot.get_description = (have_function[7]) ? rna_operator_description_cb : NULL; WM_operatortype_append_ptr(BPY_RNA_operator_wrapper, (void *)&dummyot); /* update while blender is running */ |