python access to operators now hides the _OT_ syntax, eg. SOME_OT_operator -> some.operator
this works for the calling operators from python and using the RNA api. bpy.ops.CONSOLE_exec() is now bpy.ops.console.exec() eg. split.itemO("PARTICLE_OT_editable_set", text="Free Edit") becomes... split.itemO("particle.editable_set", text="Free Edit") For now any operator thats called checks if its missing _OT_ and assumes its python syntax and converts it before doing the lookup. bpy.ops is a python class in release/ui/bpy_ops.py which does the fake submodules and conversion, the C operator api is at bpy.__ops__ personally Id still rather rename C id-names not to contain the _OT_ text which would avoid the conversion, its called a lot since the UI has to convert the operators.
This commit is contained in:
@@ -436,9 +436,16 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
|
||||
PyObject *pyrna_func_to_py(BPy_StructRNA *pyrna, FunctionRNA *func)
|
||||
{
|
||||
static PyMethodDef func_meth = {"<generic rna function>", (PyCFunction)pyrna_func_call, METH_VARARGS|METH_KEYWORDS, "python rna function"};
|
||||
PyObject *self= PyTuple_New(2);
|
||||
PyObject *self;
|
||||
PyObject *ret;
|
||||
|
||||
if(func==NULL) {
|
||||
PyErr_Format( PyExc_RuntimeError, "%.200s: type attempted to get NULL function", RNA_struct_identifier(pyrna->ptr.type));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self= PyTuple_New(2);
|
||||
|
||||
PyTuple_SET_ITEM(self, 0, (PyObject *)pyrna);
|
||||
Py_INCREF(pyrna);
|
||||
|
||||
@@ -1912,6 +1919,17 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
|
||||
const char *parm_id;
|
||||
void *retdata= NULL;
|
||||
|
||||
/* Should never happen but it does in rare cases */
|
||||
if(self_ptr==NULL) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "rna functions internal rna pointer is NULL, this is a bug. aborting");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(self_func==NULL) {
|
||||
PyErr_Format(PyExc_RuntimeError, "%.200s.???(): rna function internal function is NULL, this is a bug. aborting", RNA_struct_identifier(self_ptr->type));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* setup */
|
||||
RNA_pointer_create(NULL, &RNA_Function, self_func, &funcptr);
|
||||
|
||||
|
Reference in New Issue
Block a user