forked from bartvdbraak/blender
Another fix in BPY_flag_from_seq: unrecognized flag is also an error.
Print operator return value for debugging.
This commit is contained in:
parent
c7cdb9cc38
commit
07e1b84ca8
@ -112,7 +112,7 @@ class SCRIPT_OT_reload_scripts(bpy.types.Operator):
|
|||||||
register_op(cls)
|
register_op(cls)
|
||||||
print("Registered it.")
|
print("Registered it.")
|
||||||
|
|
||||||
return 'FINISHED'
|
return ('FINISHED',)
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
print("SCRIPT_OT_reload_scripts: invoke")
|
print("SCRIPT_OT_reload_scripts: invoke")
|
||||||
|
@ -317,6 +317,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
|
|||||||
/* the returned value could not be converted into a flag */
|
/* the returned value could not be converted into a flag */
|
||||||
pyop_error_report(op->reports);
|
pyop_error_report(op->reports);
|
||||||
|
|
||||||
|
ret_flag = OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
/* there is no need to copy the py keyword dict modified by
|
/* there is no need to copy the py keyword dict modified by
|
||||||
* pyot->py_invoke(), back to the operator props since they are just
|
* pyot->py_invoke(), back to the operator props since they are just
|
||||||
@ -329,6 +330,29 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
|
|||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* print operator return value */
|
||||||
|
if (mode != PYOP_POLL) {
|
||||||
|
char flag_str[100];
|
||||||
|
char class_name[100];
|
||||||
|
BPY_flag_def *flag_def = pyop_ret_flags;
|
||||||
|
|
||||||
|
strcpy(flag_str, "");
|
||||||
|
|
||||||
|
while(flag_def->name) {
|
||||||
|
if (ret_flag & flag_def->flag) {
|
||||||
|
flag_str[1] ? sprintf(flag_str, "%s | %s", flag_str, flag_def->name) : strcpy(flag_str, flag_def->name);
|
||||||
|
}
|
||||||
|
flag_def++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get class name */
|
||||||
|
item= PyObject_GetAttrString(py_class, PYOP_ATTR_IDNAME);
|
||||||
|
Py_DECREF(item);
|
||||||
|
strcpy(class_name, _PyUnicode_AsString(item));
|
||||||
|
|
||||||
|
fprintf(stderr, "%s's %s returned %s\n", class_name, mode == PYOP_EXEC ? "exec" : "invoke", flag_str);
|
||||||
|
}
|
||||||
|
|
||||||
PyGILState_Release(gilstate);
|
PyGILState_Release(gilstate);
|
||||||
|
|
||||||
return ret_flag;
|
return ret_flag;
|
||||||
|
@ -109,6 +109,9 @@ int BPY_flag_from_seq(BPY_flag_def *flagdef, PyObject *seq, int *flag)
|
|||||||
error_val= 1;
|
error_val= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*flag == 0)
|
||||||
|
error_val = 1;
|
||||||
|
|
||||||
if (error_val) {
|
if (error_val) {
|
||||||
char *buf = bpy_flag_error_str(flagdef);
|
char *buf = bpy_flag_error_str(flagdef);
|
||||||
PyErr_SetString(PyExc_AttributeError, buf);
|
PyErr_SetString(PyExc_AttributeError, buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user