whitespace edits for bpy api, split some really long lines.

This commit is contained in:
2011-04-30 13:58:31 +00:00
parent d2218cb7f3
commit f86565c90e
9 changed files with 512 additions and 171 deletions

View File

@@ -79,14 +79,19 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
ot= WM_operatortype_find(opname, TRUE);
if (ot == NULL) {
PyErr_Format(PyExc_AttributeError, "Polling operator \"bpy.ops.%s\" error, could not be found", opname);
PyErr_Format(PyExc_AttributeError,
"Polling operator \"bpy.ops.%s\" error, "
"could not be found", opname);
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.poll\" error, expected a string enum in (%.200s)", opname, enum_str);
PyErr_Format(PyExc_TypeError,
"Calling operator \"bpy.ops.%s.poll\" error, "
"expected a string enum in (%.200s)",
opname, enum_str);
MEM_freeN(enum_str);
return NULL;
}
@@ -96,7 +101,10 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
context_dict= NULL;
}
else if (!PyDict_Check(context_dict)) {
PyErr_Format(PyExc_TypeError, "Calling operator \"bpy.ops.%s.poll\" error, custom context expected a dict or None, got a %.200s", opname, Py_TYPE(context_dict)->tp_name);
PyErr_Format(PyExc_TypeError,
"Calling operator \"bpy.ops.%s.poll\" error, "
"custom context expected a dict or None, got a %.200s",
opname, Py_TYPE(context_dict)->tp_name);
return NULL;
}
@@ -146,19 +154,27 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
ot= WM_operatortype_find(opname, TRUE);
if (ot == NULL) {
PyErr_Format(PyExc_AttributeError, "Calling operator \"bpy.ops.%s\" error, could not be found", opname);
PyErr_Format(PyExc_AttributeError,
"Calling operator \"bpy.ops.%s\" error, "
"could not be found", opname);
return NULL;
}
if(!pyrna_write_check()) {
PyErr_Format(PyExc_RuntimeError, "Calling operator \"bpy.ops.%s\" error, can't modify blend data in this state (drawing/rendering)", opname);
PyErr_Format(PyExc_RuntimeError,
"Calling operator \"bpy.ops.%s\" error, "
"can't modify blend data in this state (drawing/rendering)",
opname);
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);
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;
}
@@ -168,7 +184,10 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
context_dict= NULL;
}
else if (!PyDict_Check(context_dict)) {
PyErr_Format(PyExc_TypeError, "Calling operator \"bpy.ops.%s\" error, custom context expected a dict or None, got a %.200s", opname, Py_TYPE(context_dict)->tp_name);
PyErr_Format(PyExc_TypeError,
"Calling operator \"bpy.ops.%s\" error, "
"custom context expected a dict or None, got a %.200s",
opname, Py_TYPE(context_dict)->tp_name);
return NULL;
}
@@ -179,7 +198,9 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
if(WM_operator_poll_context((bContext*)C, ot, context) == FALSE) {
const char *msg= CTX_wm_operator_poll_msg_get(C);
PyErr_Format(PyExc_RuntimeError, "Operator bpy.ops.%.200s.poll() %.200s", opname, msg ? msg : "failed, context is incorrect");
PyErr_Format(PyExc_RuntimeError,
"Operator bpy.ops.%.200s.poll() %.200s",
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;
}
@@ -225,7 +246,9 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
{
/* no props */
if (kw != NULL) {
PyErr_Format(PyExc_AttributeError, "Operator \"%s\" does not take any args", opname);
PyErr_Format(PyExc_AttributeError,
"Operator \"%s\" does not take any args",
opname);
return NULL;
}
@@ -281,7 +304,9 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
ot= WM_operatortype_find(opname, TRUE);
if (ot == NULL) {
PyErr_Format(PyExc_AttributeError, "_bpy.ops.as_string: operator \"%.200s\"could not be found", opname);
PyErr_Format(PyExc_AttributeError,
"_bpy.ops.as_string: operator \"%.200s\" "
"could not be found", opname);
return NULL;
}