diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-02-13 04:13:16 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-02-13 04:13:16 +0300 |
commit | 135a944c66c57f11fd77b4f7231686353112e7ac (patch) | |
tree | 3928c457f44f544113e84b3356ab101e3820072e /source/blender/python/intern/bpy_operator.c | |
parent | 1b3948f9aad25fec1923f5ccd36ea525d8e34fb6 (diff) | |
parent | 33b1cbf06d2c822c68676390b1775eb5d78de6e6 (diff) |
Merged changes in the trunk up to revision 26856.
Diffstat (limited to 'source/blender/python/intern/bpy_operator.c')
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index bdd3255ccea..b2a8f5be097 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Contributor(s): Campbell Barton * @@ -48,8 +48,9 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) int error_val = 0; PointerRNA ptr; int operator_ret= OPERATOR_CANCELLED; - + char *opname; + char *context_str= NULL; PyObject *kw= NULL; /* optional args */ PyObject *context_dict= NULL; /* optional args */ PyObject *context_dict_back; @@ -60,7 +61,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) // XXX Todo, work out a better solution for passing on context, could make a tuple from self and pack the name and Context into it... bContext *C = BPy_GetContext(); - if (!PyArg_ParseTuple(args, "sO|O!i:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context)) + if (!PyArg_ParseTuple(args, "sO|O!s:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context_str)) return NULL; ot= WM_operatortype_exists(opname); @@ -70,6 +71,15 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) return NULL; } + if(context_str) { + if(RNA_enum_value_from_id(operator_context_items, context_str, &context)==0) { + char *enum_str= BPy_enum_as_string(operator_context_items); + PyErr_Format(PyExc_TypeError, "Calling operator \"bpy.ops.%s\" error, expected a string enum in (%.200s)", opname, enum_str); + MEM_freeN(enum_str); + return NULL; + } + } + if(!PyDict_Check(context_dict)) context_dict= NULL; |