diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-07-30 03:12:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-07-30 03:12:30 +0400 |
commit | 239b78c6377c41ba49e36a1dbd3cede6a3347f64 (patch) | |
tree | de928373585b2e0c4bf07938413ea3cb0749b99d /source/blender/windowmanager | |
parent | 408ba429e6aa392f769aac4a442a7a06c1740326 (diff) |
- include operator commands in tooltips (needs sanitizing for transform operators, there are massive :|)
- WM_operator_pystring can now be used with an operator type and properties (rather then a wmOperator instance)
- removed menus from file selector
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 16 |
4 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index f65e5b1b077..3670f1a613f 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -172,7 +172,7 @@ void WM_operator_properties_free(struct PointerRNA *ptr); void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter); /* operator as a python command (resultuing string must be free'd) */ -char *WM_operator_pystring(struct wmOperator *op); +char *WM_operator_pystring(struct wmOperatorType *ot, struct PointerRNA *opptr); void WM_operator_bl_idname(char *to, const char *from); void WM_operator_py_idname(char *to, const char *from); diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index c0ac7b06f5a..46cf13f7d75 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -103,7 +103,7 @@ void wm_operator_register(bContext *C, wmOperator *op) /* Report the string representation of the operator */ - buf = WM_operator_pystring(op); + buf = WM_operator_pystring(op->type, op->ptr); BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf); MEM_freeN(buf); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 3f668b23b24..86de5498ce9 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -362,7 +362,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P static void wm_operator_print(wmOperator *op) { - char *buf = WM_operator_pystring(op); + char *buf = WM_operator_pystring(op->type, op->ptr); printf("%s\n", buf); MEM_freeN(buf); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 2b7a18dc1cf..d0d50810fdc 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -340,8 +340,12 @@ void WM_operator_bl_idname(char *to, const char *from) } /* print a string representation of the operator, with the args that it runs - * so python can run it again */ -char *WM_operator_pystring(wmOperator *op) + * so python can run it again, + * + * When calling from an existing wmOperator do. + * WM_operator_pystring(op->type, op->ptr); + */ +char *WM_operator_pystring(wmOperatorType *ot, PointerRNA *opptr) { const char *arg_name= NULL; char idname_py[OP_MAX_TYPENAME]; @@ -353,18 +357,18 @@ char *WM_operator_pystring(wmOperator *op) char *cstring, *buf; int first_iter=1; - WM_operator_py_idname(idname_py, op->idname); + WM_operator_py_idname(idname_py, ot->idname); BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", idname_py); - iterprop= RNA_struct_iterator_property(op->ptr->type); + iterprop= RNA_struct_iterator_property(opptr->type); - RNA_PROP_BEGIN(op->ptr, propptr, iterprop) { + RNA_PROP_BEGIN(opptr, propptr, iterprop) { prop= propptr.data; arg_name= RNA_property_identifier(prop); if (strcmp(arg_name, "rna_type")==0) continue; - buf= RNA_property_as_string(op->ptr, prop); + buf= RNA_property_as_string(opptr, prop); BLI_dynstr_appendf(dynstr, first_iter?"%s=%s":", %s=%s", arg_name, buf); |