definition/syntax edits for operators and rna (no functional changes)

This commit is contained in:
2010-09-09 17:36:54 +00:00
parent 49585914e2
commit f9367c4c4d
2 changed files with 35 additions and 35 deletions

View File

@@ -289,24 +289,36 @@ static PyObject *pyop_getrna(PyObject *self, PyObject *value)
return (PyObject *)pyrna;
}
PyObject *BPY_operator_module( void )
static struct PyMethodDef bpy_ops_methods[] = {
{"poll", (PyCFunction) pyop_poll, METH_VARARGS, NULL},
{"call", (PyCFunction) pyop_call, METH_VARARGS, NULL},
{"as_string", (PyCFunction) pyop_as_string, METH_VARARGS, NULL},
{"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL},
{"get_rna", (PyCFunction) pyop_getrna, METH_O, NULL},
{"macro_define", (PyCFunction) PYOP_wrap_macro_define, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef bpy_ops_module = {
PyModuleDef_HEAD_INIT,
"_bpy.ops",
NULL,
-1,/* multiple "initialization" just copies the module dict. */
bpy_ops_methods,
NULL, NULL, NULL, NULL
};
PyObject *BPY_operator_module(void)
{
static PyMethodDef pyop_poll_meth = {"poll", (PyCFunction) pyop_poll, METH_VARARGS, NULL};
static PyMethodDef pyop_call_meth = {"call", (PyCFunction) pyop_call, METH_VARARGS, NULL};
static PyMethodDef pyop_as_string_meth ={"as_string", (PyCFunction) pyop_as_string, METH_VARARGS, NULL};
static PyMethodDef pyop_dir_meth = {"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL};
static PyMethodDef pyop_getrna_meth = {"get_rna", (PyCFunction) pyop_getrna, METH_O, NULL};
static PyMethodDef pyop_macro_def_meth ={"macro_define", (PyCFunction) PYOP_wrap_macro_define, METH_VARARGS, NULL};
PyObject *submodule;
submodule= PyModule_Create(&bpy_ops_module);
PyDict_SetItemString(PyImport_GetModuleDict(), bpy_ops_module.m_name, submodule);
PyObject *submodule = PyModule_New("_bpy.ops");
PyDict_SetItemString(PyImport_GetModuleDict(), "_bpy.ops", submodule);
PyModule_AddObject( submodule, "poll", PyCFunction_New(&pyop_poll_meth, NULL) );
PyModule_AddObject( submodule, "call", PyCFunction_New(&pyop_call_meth, NULL) );
PyModule_AddObject( submodule, "as_string",PyCFunction_New(&pyop_as_string_meth, NULL) );
PyModule_AddObject( submodule, "dir", PyCFunction_New(&pyop_dir_meth, NULL) );
PyModule_AddObject( submodule, "get_rna", PyCFunction_New(&pyop_getrna_meth, NULL) );
PyModule_AddObject( submodule, "macro_define",PyCFunction_New(&pyop_macro_def_meth, NULL) );
/* INCREF since its its assumed that all these functions return the
* module with a new ref like PyDict_New, since they are passed to
* PyModule_AddObject which steals a ref */
Py_INCREF(submodule);
return submodule;
}

View File

@@ -404,8 +404,7 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
return NULL;
}
Py_INCREF(res);
return res;
return Py_INCREF(res), res;
}
static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
@@ -434,8 +433,7 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
return NULL;
}
Py_INCREF(res);
return res;
return Py_INCREF(res), res;
}
/*----------------------repr--------------------------------------------*/
@@ -2761,7 +2759,6 @@ static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyObject *value)
{
PyObject *ret;
int key= PyLong_AsSsize_t(value);
if (key==-1 && PyErr_Occurred()) {
@@ -2774,15 +2771,11 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
return NULL;
}
ret = Py_None;
Py_INCREF(ret);
return ret;
Py_RETURN_NONE;
}
static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObject *args)
{
PyObject *ret;
int key=0, pos=0;
if (!PyArg_ParseTuple(args, "ii", &key, &pos)) {
@@ -2795,10 +2788,7 @@ static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObje
return NULL;
}
ret = Py_None;
Py_INCREF(ret);
return ret;
Py_RETURN_NONE;
}
static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
@@ -2937,8 +2927,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
return BPy_IDGroup_WrapData(self->ptr.id.data, idprop);
}
Py_INCREF(def);
return def;
return Py_INCREF(def), def;
}
static char pyrna_struct_as_pointer_doc[] =
@@ -2968,9 +2957,8 @@ static PyObject *pyrna_prop_get(BPy_PropertyRNA *self, PyObject *args)
if(RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr))
return pyrna_struct_CreatePyObject(&newptr);
Py_INCREF(def);
return def;
return Py_INCREF(def), def;
}
static void foreach_attr_type( BPy_PropertyRNA *self, char *attr,