diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-17 16:47:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-17 16:47:20 +0400 |
commit | 0862abf68bf1c9601080d4fb142c8f7edc6b300f (patch) | |
tree | 02a3c6fa59a2a78b0c6c1254fd22ac9bd9b18af5 /source/blender/python | |
parent | d00f664ee0c042569900110db21d567c21c391db (diff) |
change unit evaluation only to do try the units replacements if evaluating with python fails, in rare cases its possible a valid python expression could get units applied to it.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/BPY_extern.h | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 7901957e5e4..e8796a6f8dd 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -86,7 +86,7 @@ void BPY_modules_load_user(struct bContext *C); void BPY_driver_reset(void); float BPY_driver_exec(struct ChannelDriver *driver); -int BPY_button_exec(struct bContext *C, const char *expr, double *value); +int BPY_button_exec(struct bContext *C, const char *expr, double *value, const short verbose); int BPY_string_exec(struct bContext *C, const char *expr); void BPY_DECREF(void *pyob_ptr); /* Py_DECREF() */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 83c52464c9c..555b42eb6fb 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -471,7 +471,8 @@ void BPY_DECREF(void *pyob_ptr) PyGILState_Release(gilstate); } -int BPY_button_exec(bContext *C, const char *expr, double *value) +/* return -1 on error, else 0 */ +int BPY_button_exec(bContext *C, const char *expr, double *value, const short verbose) { PyGILState_STATE gilstate; PyObject *py_dict, *mod, *retval; @@ -536,7 +537,12 @@ int BPY_button_exec(bContext *C, const char *expr, double *value) } if(error_ret) { - BPy_errors_to_report(CTX_wm_reports(C)); + if(verbose) { + BPy_errors_to_report(CTX_wm_reports(C)); + } + else { + PyErr_Clear(); + } } PyC_MainModule_Backup(&main_mod); |