Cleanup: PyMethodDef formatting

Missed these changes in [0].

Also replace designated initializers in some C code, as it's not used
often and would need to be removed when converting to C++.

[0] e555ede626
This commit is contained in:
2022-11-08 11:13:58 +11:00
parent 3e71220efc
commit 4eb9322eda
38 changed files with 326 additions and 256 deletions

View File

@@ -162,14 +162,14 @@ static struct PyMethodDef M_AppIcons_methods[] = {
static struct PyModuleDef M_AppIcons_module_def = {
PyModuleDef_HEAD_INIT,
"bpy.app.icons", /* m_name */
NULL, /* m_doc */
0, /* m_size */
M_AppIcons_methods, /* m_methods */
NULL, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
/*m_name*/ "bpy.app.icons",
/*m_doc*/ NULL,
/*m_size*/ 0,
/*m_methods*/ M_AppIcons_methods,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ NULL,
};
PyObject *BPY_app_icons_module(void)

View File

@@ -164,14 +164,14 @@ static struct PyMethodDef M_AppTimers_methods[] = {
static struct PyModuleDef M_AppTimers_module_def = {
PyModuleDef_HEAD_INIT,
"bpy.app.timers", /* m_name */
NULL, /* m_doc */
0, /* m_size */
M_AppTimers_methods, /* m_methods */
NULL, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
/*m_name*/ "bpy.app.timers",
/*m_doc*/ NULL,
/*m_size*/ 0,
/*m_methods*/ M_AppTimers_methods,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ NULL,
};
PyObject *BPY_app_timers_module(void)

View File

@@ -768,14 +768,14 @@ extern void main_python_exit(void);
static struct PyModuleDef bpy_proxy_def = {
PyModuleDef_HEAD_INIT,
"bpy", /* m_name */
NULL, /* m_doc */
0, /* m_size */
NULL, /* m_methods */
NULL, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
bpy_module_free, /* m_free */
/*m_name*/ "bpy",
/*m_doc*/ NULL,
/*m_size*/ 0,
/*m_methods*/ NULL,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ bpy_module_free,
};
typedef struct {

View File

@@ -393,8 +393,14 @@ static struct PyMethodDef BPy_msgbus_methods[] = {
static struct PyModuleDef _bpy_msgbus_def = {
PyModuleDef_HEAD_INIT,
.m_name = "msgbus",
.m_methods = BPy_msgbus_methods,
/*m_name*/ "msgbus",
/*m_doc*/ NULL,
/*m_size*/ 0,
/*m_methods*/ BPy_msgbus_methods,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ NULL,
};
PyObject *BPY_msgbus_module(void)

View File

@@ -493,14 +493,14 @@ static struct PyMethodDef bpy_ops_methods[] = {
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,
/*m_name*/ "_bpy.ops",
/*m_doc*/ NULL,
/*m_size*/ -1, /* multiple "initialization" just copies the module dict. */
/*m_methods*/ bpy_ops_methods,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ NULL,
};
PyObject *BPY_operator_module(void)

View File

@@ -22,14 +22,14 @@ extern const char *imb_ext_audio[];
/*----------------------------MODULE INIT-------------------------*/
static struct PyModuleDef _bpy_path_module_def = {
PyModuleDef_HEAD_INIT,
"_bpy_path", /* m_name */
NULL, /* m_doc */
0, /* m_size */
NULL, /* m_methods */
NULL, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
/*m_name*/ "_bpy_path",
/*m_doc*/ NULL,
/*m_size*/ 0,
/*m_methods*/ NULL,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ NULL,
};
PyObject *BPyInit__bpy_path(void)

View File

@@ -4621,21 +4621,25 @@ static int props_clear(PyObject *UNUSED(self))
return 0;
}
static struct PyModuleDef props_module = {
PyModuleDef_HEAD_INIT,
"bpy.props",
PyDoc_STRVAR(
props_module_doc,
"This module defines properties to extend Blender's internal data. The result of these "
"functions"
" is used to assign properties to classes registered with Blender and can't be used "
"directly.\n"
"\n"
".. note:: All parameters to these functions must be passed as keywords.\n",
-1, /* multiple "initialization" just copies the module dict. */
props_methods,
NULL,
props_visit,
props_clear,
NULL,
".. note:: All parameters to these functions must be passed as keywords.\n");
static struct PyModuleDef props_module = {
PyModuleDef_HEAD_INIT,
/*m_name*/ "bpy.props",
/*m_doc*/ props_module_doc,
/*m_size*/ -1, /* multiple "initialization" just copies the module dict. */
/*m_methods*/ props_methods,
/*m_slots*/ NULL,
/*m_traverse*/ props_visit,
/*m_clear*/ props_clear,
/*m_free*/ NULL,
};
PyObject *BPY_rna_props(void)

View File

@@ -7672,14 +7672,14 @@ static struct PyMethodDef bpy_types_module_methods[] = {
PyDoc_STRVAR(bpy_types_module_doc, "Access to internal Blender types");
static struct PyModuleDef bpy_types_module_def = {
PyModuleDef_HEAD_INIT,
"bpy.types", /* m_name */
bpy_types_module_doc, /* m_doc */
sizeof(struct BPy_TypesModule_State), /* m_size */
bpy_types_module_methods, /* m_methods */
NULL, /* m_slots */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
/*m_name*/ "bpy.types",
/*m_doc*/ bpy_types_module_doc,
/*m_size*/ sizeof(struct BPy_TypesModule_State),
/*m_methods*/ bpy_types_module_methods,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ NULL,
};
PyObject *BPY_rna_types(void)

View File

@@ -163,14 +163,14 @@ PyDoc_STRVAR(
"(low-level API, not exposed to final users).");
static struct PyModuleDef bpy_utils_previews_module = {
PyModuleDef_HEAD_INIT,
"bpy._utils_previews",
bpy_utils_previews_doc,
0,
bpy_utils_previews_methods,
NULL,
NULL,
NULL,
NULL,
/*m_name*/ "bpy._utils_previews",
/*m_doc*/ bpy_utils_previews_doc,
/*m_size*/ 0,
/*m_methods*/ bpy_utils_previews_methods,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ NULL,
};
PyObject *BPY_utils_previews_module(void)

View File

@@ -336,14 +336,14 @@ PyDoc_STRVAR(bpyunits_doc, "This module contains some data/methods regarding uni
static struct PyModuleDef bpyunits_module = {
PyModuleDef_HEAD_INIT,
"bpy.utils.units",
bpyunits_doc,
-1, /* multiple "initialization" just copies the module dict. */
bpyunits_methods,
NULL,
NULL,
NULL,
NULL,
/*m_name*/ "bpy.utils.units",
/*m_doc*/ bpyunits_doc,
/*m_size*/ -1, /* multiple "initialization" just copies the module dict. */
/*m_methods*/ bpyunits_methods,
/*m_slots*/ NULL,
/*m_traverse*/ NULL,
/*m_clear*/ NULL,
/*m_free*/ NULL,
};
PyObject *BPY_utils_units(void)