diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-27 16:21:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-27 16:21:23 +0400 |
commit | d6c8b411446793dd23a54734ce8ee621a755ab3e (patch) | |
tree | d5312eee205395f16740eaead01d2e80f72e9b16 /source/blender/python | |
parent | 11ce49830a2d8dfff1db293f88ecd601b0f3c8c7 (diff) |
added CTX_wm_operator_poll_msg_get/set so failing poll functions can set messages when poll fails, at the moment only python uses this but theres nothing python specific.
only added 1 message to a poll function, so messages still need to be set in many more places to be useful.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index eeab1fce4b2..2b475a57de6 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -127,7 +127,9 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) Py_XINCREF(context_dict); /* so we done loose it */ if(WM_operator_poll((bContext*)C, ot) == FALSE) { - PyErr_Format( PyExc_SystemError, "Operator bpy.ops.%.200s.poll() failed, context is incorrect", opname); + const char *msg= CTX_wm_operator_poll_msg_get(C); + PyErr_Format( PyExc_SystemError, "Operator bpy.ops.%.200s.poll() %s", opname, msg ? msg : "failed, context is incorrect"); + CTX_wm_operator_poll_msg_set(C, NULL); /* better set to NULL else it could be used again */ error_val= -1; } else { |