Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/BPY_extern.h2
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops_call.c16
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.h2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_utils.c2
-rw-r--r--source/blender/python/generic/idprop_py_api.c2
-rw-r--r--source/blender/python/generic/imbuf_py_api.c2
-rw-r--r--source/blender/python/generic/py_capi_utils.c12
-rw-r--r--source/blender/python/gpu/gpu_py_uniformbuffer.c2
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c6
-rw-r--r--source/blender/python/intern/bpy_app_translations.c4
-rw-r--r--source/blender/python/intern/bpy_driver.c10
-rw-r--r--source/blender/python/intern/bpy_gizmo_wrap.c2
-rw-r--r--source/blender/python/intern/bpy_interface.c6
-rw-r--r--source/blender/python/intern/bpy_interface_atexit.c5
-rw-r--r--source/blender/python/intern/bpy_library_load.c5
-rw-r--r--source/blender/python/intern/bpy_msgbus.c8
-rw-r--r--source/blender/python/intern/bpy_operator.c10
-rw-r--r--source/blender/python/intern/bpy_props.c8
-rw-r--r--source/blender/python/intern/bpy_rna.c129
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c2
-rw-r--r--source/blender/python/intern/bpy_rna_array.c4
-rw-r--r--source/blender/python/intern/bpy_rna_gizmo.c4
-rw-r--r--source/blender/python/intern/bpy_rna_id_collection.c4
-rw-r--r--source/blender/python/intern/bpy_utils_previews.c1
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c2
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c8
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c2
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c9
-rw-r--r--source/blender/python/mathutils/mathutils_bvhtree.c2
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c2
33 files changed, 173 insertions, 110 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 90f54c50a6d..84d804f8bdf 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -20,8 +20,8 @@
#pragma once
-struct AnimationEvalContext;
struct ARegionType;
+struct AnimationEvalContext;
struct ChannelDriver; /* DNA_anim_types.h */
struct ID; /* DNA_ID.h */
struct ListBase; /* DNA_listBase.h */
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index d198c6ca559..24887b24eb6 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -44,10 +44,10 @@ BLI_STATIC_ASSERT(sizeof(PyC_FlagSet) == sizeof(BMO_FlagSet), "size mismatch");
static int bpy_bm_op_as_py_error(BMesh *bm)
{
- if (BMO_error_occurred(bm)) {
- /* note: we could have multiple errors */
+ if (BMO_error_occurred_at_level(bm, BMO_ERROR_FATAL)) {
+ /* NOTE: we could have multiple errors. */
const char *errmsg;
- if (BMO_error_get(bm, &errmsg, NULL)) {
+ if (BMO_error_get(bm, &errmsg, NULL, NULL)) {
PyErr_Format(PyExc_RuntimeError, "bmesh operator: %.200s", errmsg);
BMO_error_clear(bm);
return -1;
@@ -243,7 +243,7 @@ static int bpy_slot_from_py(BMesh *bm,
break;
}
case BMO_OP_SLOT_MAT: {
- /* XXX - BMesh operator design is crappy here, operator slot should define matrix size,
+ /* XXX: BMesh operator design is crappy here, operator slot should define matrix size,
* not the caller! */
MatrixObject *pymat;
if (!Matrix_ParseAny(value, &pymat)) {
@@ -583,7 +583,7 @@ static int bpy_slot_from_py(BMesh *bm,
break;
}
default:
- /* TODO --- many others */
+ /* TODO: many others. */
PyErr_Format(PyExc_NotImplementedError,
"%.200s: keyword \"%.200s\" type %d not working yet!",
opname,
@@ -608,7 +608,7 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
/* keep switch in same order as above */
switch (slot->slot_type) {
case BMO_OP_SLOT_BOOL:
- item = PyBool_FromLong((BMO_SLOT_AS_BOOL(slot)));
+ item = PyBool_FromLong(BMO_SLOT_AS_BOOL(slot));
break;
case BMO_OP_SLOT_INT:
item = PyLong_FromLong(BMO_SLOT_AS_INT(slot));
@@ -776,8 +776,8 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
return NULL;
}
- /* TODO - error check this!, though we do the error check on attribute access */
- /* TODO - make flags optional */
+ /* TODO: error check this!, though we do the error check on attribute access. */
+ /* TODO: make flags optional. */
BMO_op_init(bm, &bmop, BMO_FLAG_DEFAULTS, self->opname);
if (kw && PyDict_Size(kw) > 0) {
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 9334e9893b0..612446e6d19 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -553,7 +553,7 @@ static PyObject *bpy_bmloop_is_convex_get(BPy_BMLoop *self)
/* ElemSeq
* ^^^^^^^ */
-/* note: use for bmvert/edge/face/loop seq's use these, not bmelemseq directly */
+/* NOTE: use for bmvert/edge/face/loop seq's use these, not bmelemseq directly. */
PyDoc_STRVAR(bpy_bmelemseq_layers_vert_doc,
"custom-data layers (read-only).\n\n:type: :class:`BMLayerAccessVert`");
PyDoc_STRVAR(bpy_bmelemseq_layers_edge_doc,
@@ -2588,7 +2588,7 @@ PyDoc_STRVAR(
* If a portable alternative to qsort_r becomes available, remove this static
* var hack!
*
- * Note: the functions below assumes the keys array has been allocated and it
+ * NOTE: the functions below assumes the keys array has been allocated and it
* has enough elements to complete the task.
*/
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
index ed307ce59a0..043c5322735 100644
--- a/source/blender/python/bmesh/bmesh_py_types.h
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -114,7 +114,7 @@ typedef struct BPy_BMElemSeq {
/* we hold a reference to this.
* check in case the owner becomes invalid on access */
- /* TODO - make this a GC'd object!, will function OK without this though */
+ /* TODO: make this a GC'd object!, will function OK without this though. */
BPy_BMElem *py_ele;
/* iterator type */
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index d9a82f52be0..8f4e07c30d3 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -500,7 +500,7 @@ static PySequenceMethods bpy_bmdeformvert_as_sequence = {
NULL, /* sq_concat */
NULL, /* sq_repeat */
- /* Note: if this is set #PySequence_Check() returns True,
+ /* NOTE: if this is set #PySequence_Check() returns True,
* but in this case we don't want to be treated as a seq. */
NULL, /* sq_item */
diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c
index c1e28182c53..1c3334f1adc 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.c
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -189,7 +189,7 @@ static PyObject *bpy_bm_utils_vert_dissolve(PyObject *UNUSED(self), PyObject *ar
bm = py_vert->bm;
- return PyBool_FromLong((BM_vert_dissolve(bm, py_vert->v)));
+ return PyBool_FromLong(BM_vert_dissolve(bm, py_vert->v));
}
PyDoc_STRVAR(bpy_bm_utils_vert_splice_doc,
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index c6afb694413..bfdc763e4df 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -1547,7 +1547,7 @@ static PySequenceMethods BPy_IDGroup_Seq = {
NULL, /* binaryfunc sq_concat */
NULL, /* ssizeargfunc sq_repeat */
NULL,
- /* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */
+ /* ssizeargfunc sq_item */ /* TODO: setting this will allow PySequence_Check to return True. */
NULL, /* intintargfunc ***was_sq_slice*** */
NULL, /* intobjargproc sq_ass_item */
NULL, /* ssizeobjargproc ***was_sq_ass_slice*** */
diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c
index 57e148b56c8..08ddef992a3 100644
--- a/source/blender/python/generic/imbuf_py_api.c
+++ b/source/blender/python/generic/imbuf_py_api.c
@@ -443,7 +443,7 @@ static PyObject *M_imbuf_new(PyObject *UNUSED(self), PyObject *args, PyObject *k
return NULL;
}
- /* TODO, make options */
+ /* TODO: make options. */
const uchar planes = 4;
const uint flags = IB_rect;
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 127380feec1..a27ef30c849 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -367,7 +367,7 @@ void PyC_LineSpit(void)
const char *filename;
int lineno;
- /* Note, allow calling from outside python (RNA) */
+ /* NOTE: allow calling from outside python (RNA). */
if (!PyC_IsInterpreterActive()) {
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
return;
@@ -381,7 +381,7 @@ void PyC_LineSpit(void)
void PyC_StackSpit(void)
{
- /* Note, allow calling from outside python (RNA) */
+ /* NOTE: allow calling from outside python (RNA). */
if (!PyC_IsInterpreterActive()) {
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
return;
@@ -826,13 +826,13 @@ PyObject *PyC_UnicodeFromByte(const char *str)
/*****************************************************************************
* Description: This function creates a new Python dictionary object.
- * note: dict is owned by sys.modules["__main__"] module, reference is borrowed
- * note: important we use the dict from __main__, this is what python expects
+ * NOTE: dict is owned by sys.modules["__main__"] module, reference is borrowed
+ * NOTE: important we use the dict from __main__, this is what python expects
* for 'pickle' to work as well as strings like this...
* >> foo = 10
* >> print(__import__("__main__").foo)
*
- * note: this overwrites __main__ which gives problems with nested calls.
+ * NOTE: this overwrites __main__ which gives problems with nested calls.
* be sure to run PyC_MainModule_Backup & PyC_MainModule_Restore if there is
* any chance that python is in the call stack.
****************************************************************************/
@@ -846,7 +846,7 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
PyModule_AddStringConstant(mod_main, "__name__", "__main__");
if (filename) {
/* __file__ mainly for nice UI'ness
- * note: this won't map to a real file when executing text-blocks and buttons. */
+ * NOTE: this won't map to a real file when executing text-blocks and buttons. */
PyModule_AddObject(mod_main, "__file__", PyC_UnicodeFromByte(filename));
}
PyModule_AddObject(mod_main, "__builtins__", builtins);
diff --git a/source/blender/python/gpu/gpu_py_uniformbuffer.c b/source/blender/python/gpu/gpu_py_uniformbuffer.c
index edcec486398..cfef20e2e4d 100644
--- a/source/blender/python/gpu/gpu_py_uniformbuffer.c
+++ b/source/blender/python/gpu/gpu_py_uniformbuffer.c
@@ -104,7 +104,7 @@ static PyObject *pygpu_uniformbuffer__tp_new(PyTypeObject *UNUSED(self),
}
PyDoc_STRVAR(pygpu_uniformbuffer_update_doc,
- ".. method::update(data)\n"
+ ".. method:: update(data)\n"
"\n"
" Update the data of the uniform buffer object.\n");
static PyObject *pygpu_uniformbuffer_update(BPyGPUUniformBuf *self, PyObject *obj)
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index bc05c51414f..d66643c5d61 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -225,7 +225,7 @@ PyObject *BPY_app_handlers_struct(void)
#endif
if (PyType_Ready(&BPyPersistent_Type) < 0) {
- BLI_assert(!"error initializing 'bpy.app.handlers.persistent'");
+ BLI_assert_msg(0, "error initializing 'bpy.app.handlers.persistent'");
}
PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc);
@@ -283,7 +283,7 @@ void BPY_app_handlers_reset(const short do_all)
for (i = PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
- if ((PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
+ if (PyFunction_Check((item = PyList_GET_ITEM(ls, i))) &&
(dict_ptr = _PyObject_GetDictPtr(item)) && (*dict_ptr) &&
(PyDict_GetItem(*dict_ptr, perm_id_str) != NULL)) {
/* keep */
@@ -347,7 +347,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main),
}
/* Iterate the list and run the callbacks
- * note: don't store the list size since the scripts may remove themselves */
+ * NOTE: don't store the list size since the scripts may remove themselves. */
for (pos = 0; pos < PyList_GET_SIZE(cb_list); pos++) {
func = PyList_GET_ITEM(cb_list, pos);
PyObject *args = choose_arguments(func, args_all, args_single);
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index 478ae61aecd..7437598582f 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -101,7 +101,7 @@ static bool _ghashutil_keycmp(const void *a, const void *b)
const GHashKey *A = a;
const GHashKey *B = b;
- /* Note: comparing msgid first, most of the time it will be enough! */
+ /* NOTE: comparing msgid first, most of the time it will be enough! */
if (BLI_ghashutil_strcmp(A->msgid, B->msgid) == false) {
return BLI_ghashutil_strcmp(A->msgctxt, B->msgctxt);
}
@@ -497,7 +497,7 @@ static PyObject *app_translations_locale_get(PyObject *UNUSED(self), void *UNUSE
return PyUnicode_FromString(BLT_lang_get());
}
-/* Note: defining as getter, as (even if quite unlikely), this *may* change during runtime... */
+/* NOTE: defining as getter, as (even if quite unlikely), this *may* change during runtime... */
PyDoc_STRVAR(app_translations_locales_doc,
"All locales currently known by Blender (i.e. available as translations).");
static PyObject *app_translations_locales_get(PyObject *UNUSED(self), void *UNUSED(userdata))
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index a7b99f211c2..7effa25e6e8 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -175,7 +175,7 @@ int bpy_pydriver_create_dict(void)
return 0;
}
-/* note, this function should do nothing most runs, only when changing frame */
+/* NOTE: this function should do nothing most runs, only when changing frame. */
/* not thread safe but neither is python */
static struct {
float evaltime;
@@ -266,7 +266,7 @@ static void pydriver_error(ChannelDriver *driver)
"\nError in Driver: The following Python expression failed:\n\t'%s'\n\n",
driver->expression);
- // BPy_errors_to_report(NULL); /* TODO - reports */
+ // BPy_errors_to_report(NULL); /* TODO: reports. */
PyErr_Print();
PyErr_Clear();
}
@@ -433,12 +433,12 @@ static void bpy_pydriver_namespace_add_depsgraph(PyObject *driver_vars,
* This evaluates Python driver expressions, `driver_orig->expression`
* is a Python expression that should evaluate to a float number, which is returned.
*
- * (old)note: PyGILState_Ensure() isn't always called because python can call
+ * (old) NOTE: PyGILState_Ensure() isn't always called because python can call
* the bake operator which intern starts a thread which calls scene update
* which does a driver update. to avoid a deadlock check #PyC_IsInterpreterActive()
* if #PyGILState_Ensure() is needed, see T27683.
*
- * (new)note: checking if python is running is not thread-safe T28114
+ * (new) NOTE: checking if python is running is not thread-safe T28114
* now release the GIL on python operator execution instead, using
* #PyEval_SaveThread() / #PyEval_RestoreThread() so we don't lock up blender.
*
@@ -613,7 +613,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
fprintf(
stderr, "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n", dvar->name);
- // BPy_errors_to_report(NULL); /* TODO - reports */
+ // BPy_errors_to_report(NULL); /* TODO: reports. */
PyErr_Print();
PyErr_Clear();
}
diff --git a/source/blender/python/intern/bpy_gizmo_wrap.c b/source/blender/python/intern/bpy_gizmo_wrap.c
index 686a4d88266..34d2ba16e69 100644
--- a/source/blender/python/intern/bpy_gizmo_wrap.c
+++ b/source/blender/python/intern/bpy_gizmo_wrap.c
@@ -49,7 +49,7 @@
static bool bpy_gizmotype_target_property_def(wmGizmoType *gzt, PyObject *item)
{
- /* Note: names based on 'rna_rna.c' */
+ /* NOTE: names based on `rna_rna.c`. */
PyObject *empty_tuple = PyTuple_New(0);
struct {
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 832af9e8460..f91ba4d362c 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -154,7 +154,7 @@ void bpy_context_clear(bContext *UNUSED(C), const PyGILState_STATE *gilstate)
fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n");
}
else if (py_call_level == 0) {
- /* XXX - Calling classes currently won't store the context :\,
+ /* XXX: Calling classes currently won't store the context :\,
* can't set NULL because of this. but this is very flakey still. */
#if 0
BPY_context_set(NULL);
@@ -763,7 +763,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
}
#ifdef WITH_PYTHON_MODULE
-/* TODO, reloading the module isn't functional at the moment. */
+/* TODO: reloading the module isn't functional at the moment. */
static void bpy_module_free(void *mod);
@@ -825,7 +825,7 @@ static void dealloc_obj_dealloc(PyObject *self)
{
bpy_module_delay_init(((dealloc_obj *)self)->mod);
- /* Note, for subclassed PyObjects we can't just call PyObject_DEL() directly or it will crash */
+ /* NOTE: for subclassed PyObjects we can't just call PyObject_DEL() directly or it will crash. */
dealloc_obj_Type.tp_free(self);
}
diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c
index 03d51b2fd59..f92a48eb597 100644
--- a/source/blender/python/intern/bpy_interface_atexit.c
+++ b/source/blender/python/intern/bpy_interface_atexit.c
@@ -46,9 +46,8 @@ static PyObject *func_bpy_atregister = NULL; /* borrowed reference, `atexit` hol
static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
{
- /* note - no error checking, if any of these fail we'll get a crash
- * this is intended, but if its problematic it could be changed
- * - campbell */
+ /* NOTE(campbell): no error checking, if any of these fail we'll get a crash
+ * this is intended, but if its problematic it could be changed. */
PyObject *atexit_mod = PyImport_ImportModuleLevel("atexit", NULL, NULL, NULL, 0);
PyObject *atexit_func = PyObject_GetAttrString(atexit_mod, func_name);
diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c
index 28a97c3fa3b..d9a357c5e2e 100644
--- a/source/blender/python/intern/bpy_library_load.c
+++ b/source/blender/python/intern/bpy_library_load.c
@@ -66,6 +66,8 @@ typedef struct {
char relpath[FILE_MAX];
char abspath[FILE_MAX]; /* absolute path */
BlendHandle *blo_handle;
+ /* Referenced by `blo_handle`, so stored here to keep alive for long enough. */
+ BlendFileReadReport bf_reports;
int flag;
PyObject *dict;
/* Borrowed reference to the `bmain`, taken from the RNA instance of #RNA_BlendDataLibraries.
@@ -259,7 +261,8 @@ static PyObject *bpy_lib_enter(BPy_Library *self)
BKE_reports_init(&reports, RPT_STORE);
BlendFileReadReport bf_reports = {.reports = &reports};
- self->blo_handle = BLO_blendhandle_from_file(self->abspath, &bf_reports);
+ self->bf_reports = bf_reports;
+ self->blo_handle = BLO_blendhandle_from_file(self->abspath, &self->bf_reports);
if (self->blo_handle == NULL) {
if (BPy_reports_to_error(&reports, PyExc_IOError, true) != -1) {
diff --git a/source/blender/python/intern/bpy_msgbus.c b/source/blender/python/intern/bpy_msgbus.c
index 4e6d2aacb49..04220cf3105 100644
--- a/source/blender/python/intern/bpy_msgbus.c
+++ b/source/blender/python/intern/bpy_msgbus.c
@@ -90,12 +90,12 @@ static int py_msgbus_rna_key_from_py(PyObject *py_sub,
msg_key_params->prop = data_prop->prop;
}
else if (BPy_StructRNA_Check(py_sub)) {
- /* note, this isn't typically used since we don't edit structs directly. */
+ /* NOTE: this isn't typically used since we don't edit structs directly. */
BPy_StructRNA *data_srna = (BPy_StructRNA *)py_sub;
PYRNA_STRUCT_CHECK_INT(data_srna);
msg_key_params->ptr = data_srna->ptr;
}
- /* TODO - property / type, not instance. */
+ /* TODO: property / type, not instance. */
else if (PyType_Check(py_sub)) {
StructRNA *data_type = pyrna_struct_as_srna(py_sub, false, error_prefix);
if (data_type == NULL) {
@@ -264,7 +264,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args
return NULL;
}
- /* Note: we may want to have a way to pass this in. */
+ /* NOTE: we may want to have a way to pass this in. */
bContext *C = BPY_context_get();
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
wmMsgParams_RNA msg_key_params = {{0}};
@@ -339,7 +339,7 @@ static PyObject *bpy_msgbus_publish_rna(PyObject *UNUSED(self), PyObject *args,
return NULL;
}
- /* Note: we may want to have a way to pass this in. */
+ /* NOTE: we may want to have a way to pass this in. */
bContext *C = BPY_context_get();
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
wmMsgParams_RNA msg_key_params = {{0}};
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 055dd624ea8..9ee9f2e477f 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -82,8 +82,8 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
int context = WM_OP_EXEC_DEFAULT;
- /* XXX Todo, work out a better solution for passing on context,
- * could make a tuple from self and pack the name and Context into it... */
+ /* XXX TODO: work out a better solution for passing on context,
+ * could make a tuple from self and pack the name and Context into it. */
bContext *C = BPY_context_get();
if (C == NULL) {
@@ -169,8 +169,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
int context = WM_OP_EXEC_DEFAULT;
int is_undo = false;
- /* XXX Todo, work out a better solution for passing on context,
- * could make a tuple from self and pack the name and Context into it... */
+ /* XXX TODO: work out a better solution for passing on context,
+ * could make a tuple from self and pack the name and Context into it. */
bContext *C = BPY_context_get();
if (C == NULL) {
@@ -276,7 +276,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
#ifdef BPY_RELEASE_GIL
/* release GIL, since a thread could be started from an operator
* that updates a driver */
- /* note: I have not seen any examples of code that does this
+ /* NOTE: I have not seen any examples of code that does this
* so it may not be officially supported but seems to work ok. */
{
PyThreadState *ts = PyEval_SaveThread();
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 0d451a8dd7f..f332d547965 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -1779,12 +1779,12 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast,
item = seq_fast_items[i];
- if ((PyTuple_CheckExact(item)) && (item_size = PyTuple_GET_SIZE(item)) &&
+ if (PyTuple_CheckExact(item) && (item_size = PyTuple_GET_SIZE(item)) &&
(item_size >= 3 && item_size <= 5) &&
(tmp.identifier = PyUnicode_AsUTF8AndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
(tmp.name = PyUnicode_AsUTF8AndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
(tmp.description = PyUnicode_AsUTF8AndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
- /* TODO, number isn't ensured to be unique from the script author */
+ /* TODO: number isn't ensured to be unique from the script author. */
(item_size != 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value)) &&
(item_size != 5 || ((py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.icon) ||
(tmp_icon = PyUnicode_AsUTF8(PyTuple_GET_ITEM(item, 3)))) &&
@@ -3509,7 +3509,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
if (def) {
/* Only support getting integer default values here. */
if (!py_long_as_int(def, &defvalue)) {
- /* note, using type error here is odd but python does this for invalid arguments */
+ /* NOTE: using type error here is odd but python does this for invalid arguments. */
PyErr_SetString(
PyExc_TypeError,
"EnumProperty(...): 'default' can only be an integer when 'items' is a function");
@@ -3557,7 +3557,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_duplicate_pointers(srna, prop);
if (is_itemf == false) {
- /* note: this must be postponed until after #RNA_def_property_duplicate_pointers
+ /* NOTE: this must be postponed until after #RNA_def_property_duplicate_pointers
* otherwise if this is a generator it may free the strings before we copy them */
Py_DECREF(items_fast);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index a3c5d4e9d66..e6f3e509469 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -734,12 +734,12 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
const short order = pyrna_rotation_euler_order_get(
ptr, EULER_ORDER_XYZ, &prop_eul_order);
- ret = Euler_CreatePyObject(NULL, order, NULL); /* TODO, get order from RNA. */
+ ret = Euler_CreatePyObject(NULL, order, NULL); /* TODO: get order from RNA. */
RNA_property_float_get_array(ptr, prop, ((EulerObject *)ret)->eul);
}
else {
/* Order will be updated from callback on use. */
- /* TODO, get order from RNA. */
+ /* TODO: get order from RNA. */
PyObject *eul_cb = Euler_CreatePyObject_cb(
ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL);
Py_DECREF(ret); /* The euler owns 'ret' now. */
@@ -817,7 +817,7 @@ int pyrna_enum_value_from_id(const EnumPropertyItem *item,
return 0;
}
-/* note on __cmp__:
+/* NOTE(campbell): Regarding comparison `__cmp__`:
* checking the 'ptr->data' matches works in almost all cases,
* however there are a few RNA properties that are fake sub-structs and
* share the pointer with the parent, in those cases this happens 'a.b == a'
@@ -825,8 +825,7 @@ int pyrna_enum_value_from_id(const EnumPropertyItem *item,
*
* So compare the 'ptr->type' as well to avoid this problem.
* It's highly unlikely this would happen that 'ptr->data' and 'ptr->prop' would match,
- * but _not_ 'ptr->type' but include this check for completeness.
- * - campbell */
+ * but _not_ 'ptr->type' but include this check for completeness. */
static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
{
@@ -1196,7 +1195,7 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self)
}
#endif /* !USE_PYRNA_STRUCT_REFERENCE */
- /* Note, for subclassed PyObjects calling PyObject_DEL() directly crashes. */
+ /* NOTE: for subclassed PyObjects calling PyObject_DEL() directly crashes. */
Py_TYPE(self)->tp_free(self);
}
@@ -1225,7 +1224,7 @@ static void pyrna_prop_dealloc(BPy_PropertyRNA *self)
PyObject_ClearWeakRefs((PyObject *)self);
}
#endif
- /* Note, for subclassed PyObjects calling PyObject_DEL() directly crashes. */
+ /* NOTE: for subclassed PyObjects calling PyObject_DEL() directly crashes. */
Py_TYPE(self)->tp_free(self);
}
@@ -1236,7 +1235,7 @@ static void pyrna_prop_array_dealloc(BPy_PropertyRNA *self)
PyObject_ClearWeakRefs((PyObject *)self);
}
#endif
- /* Note, for subclassed PyObjects calling PyObject_DEL() directly crashes. */
+ /* NOTE: for subclassed PyObjects calling PyObject_DEL() directly crashes. */
Py_TYPE(self)->tp_free(self);
}
@@ -1879,7 +1878,7 @@ static int pyrna_py_to_prop(
#ifdef USE_STRING_COERCE
PyObject *value_coerce = NULL;
if (ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
- /* TODO, get size. */
+ /* TODO: get size. */
param = PyC_UnicodeAsByte(value, &value_coerce);
}
else {
@@ -2640,7 +2639,7 @@ static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self,
}
/**
- * TODO - dimensions
+ * TODO: dimensions
* \note Could also use pyrna_prop_array_to_py_index(self, count) in a loop, but it's much slower
* since at the moment it reads (and even allocates) the entire array for each index.
*/
@@ -2729,7 +2728,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self,
break;
}
default:
- BLI_assert(!"Invalid array type");
+ BLI_assert_msg(0, "Invalid array type");
PyErr_SetString(PyExc_TypeError, "not an array type");
Py_DECREF(tuple);
@@ -2853,7 +2852,7 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val
return -1;
}
-/* note: currently this is a copy of 'pyrna_prop_collection_subscript' with
+/* NOTE: currently this is a copy of 'pyrna_prop_collection_subscript' with
* large blocks commented, we may support slice/key indices later */
static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self,
PyObject *key,
@@ -2884,7 +2883,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self,
return pyrna_prop_collection_ass_subscript_int(self, i, value);
}
-#if 0 /* TODO, fake slice assignment. */
+#if 0 /* TODO: fake slice assignment. */
else if (PySlice_Check(key)) {
PySliceObject *key_slice = (PySliceObject *)key;
Py_ssize_t step = 1;
@@ -2967,7 +2966,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
return NULL;
}
if (key_slice->start == Py_None && key_slice->stop == Py_None) {
- /* Note: no significant advantage with optimizing [:] slice as with collections,
+ /* NOTE: no significant advantage with optimizing [:] slice as with collections,
* but include here for consistency with collection slice func */
const Py_ssize_t len = (Py_ssize_t)pyrna_prop_array_length(self);
return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len);
@@ -4113,7 +4112,7 @@ static PyObject *pyrna_struct_bl_rna_get_subclass(PyObject *cls, PyObject *args)
}
}
else {
- /* TODO, panels, menus etc. */
+ /* TODO: panels, menus etc. */
PyErr_Format(
PyExc_ValueError, "Class type \"%.200s\" not supported", RNA_struct_identifier(srna_base));
return NULL;
@@ -4254,6 +4253,56 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
return ret;
}
+PyDoc_STRVAR(pyrna_struct_id_properties_ensure_doc,
+ ".. method:: id_properties_ensure()\n"
+ " :return: the parent group for an RNA struct's custom IDProperties.\n"
+ " :rtype: :class:`bpy.types.IDPropertyGroup`\n");
+static PyObject *pyrna_struct_id_properties_ensure(BPy_StructRNA *self)
+{
+ PYRNA_STRUCT_CHECK_OBJ(self);
+
+ if (RNA_struct_idprops_check(self->ptr.type) == 0) {
+ PyErr_SetString(PyExc_TypeError, "This type doesn't support IDProperties");
+ return NULL;
+ }
+
+ IDProperty *idprops = RNA_struct_idprops(&self->ptr, true);
+
+ /* This is a paranoid check that theoretically might not be necessary.
+ * It allows the possibility that some structs can't ensure IDProperties. */
+ if (idprops == NULL) {
+ return Py_None;
+ }
+
+ BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
+ group->owner_id = self->ptr.owner_id;
+ group->prop = idprops;
+ group->parent = NULL;
+ return (PyObject *)group;
+}
+
+PyDoc_STRVAR(pyrna_struct_id_properties_clear_doc,
+ ".. method:: id_properties_clear()\n"
+ " :return: Remove the parent group for an RNA struct's custom IDProperties.\n");
+static PyObject *pyrna_struct_id_properties_clear(BPy_StructRNA *self)
+{
+ PYRNA_STRUCT_CHECK_OBJ(self);
+
+ if (RNA_struct_idprops_check(self->ptr.type) == 0) {
+ PyErr_SetString(PyExc_TypeError, "This type doesn't support IDProperties");
+ return NULL;
+ }
+
+ IDProperty **idprops = RNA_struct_idprops_p(&self->ptr);
+
+ if (*idprops) {
+ IDP_FreeProperty(*idprops);
+ *idprops = NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
/* ---------------getattr-------------------------------------------- */
static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
{
@@ -4326,7 +4375,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
}
default:
/* Should never happen. */
- BLI_assert(!"Invalid context type");
+ BLI_assert_msg(0, "Invalid context type");
PyErr_Format(PyExc_AttributeError,
"bpy_struct: Context type invalid %d, can't get \"%.200s\" from context",
@@ -5183,7 +5232,7 @@ static int foreach_parse_args(BPy_PropertyRNA *self,
return -1;
}
- /* TODO - buffer may not be a sequence! array.array() is though. */
+ /* TODO: buffer may not be a sequence! array.array() is though. */
*r_tot = PySequence_Size(*r_seq);
if (*r_tot > 0) {
@@ -5340,7 +5389,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
break;
case PROP_RAW_UNSET:
/* Should never happen. */
- BLI_assert(!"Invalid array type - set");
+ BLI_assert_msg(0, "Invalid array type - set");
break;
}
@@ -5357,7 +5406,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
Py_buffer buf;
PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
- /* Check if the buffer matches, TODO - signed/unsigned types. */
+ /* Check if the buffer matches, TODO: signed/unsigned types. */
buffer_is_compat = foreach_compat_buffer(raw_type, attr_signed, buf.format);
@@ -5404,7 +5453,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
break;
default: /* PROP_RAW_UNSET */
/* Should never happen. */
- BLI_assert(!"Invalid array type - get");
+ BLI_assert_msg(0, "Invalid array type - get");
item = Py_None;
Py_INCREF(item);
break;
@@ -5744,6 +5793,14 @@ static struct PyMethodDef pyrna_struct_methods[] = {
METH_VARARGS | METH_CLASS,
pyrna_struct_bl_rna_get_subclass_doc},
{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
+ {"id_properties_ensure",
+ (PyCFunction)pyrna_struct_id_properties_ensure,
+ METH_NOARGS,
+ pyrna_struct_id_properties_ensure_doc},
+ {"id_properties_clear",
+ (PyCFunction)pyrna_struct_id_properties_clear,
+ METH_NOARGS,
+ pyrna_struct_id_properties_clear_doc},
/* experimental */
/* unused for now */
@@ -5817,8 +5874,10 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
{NULL, NULL, 0, NULL},
};
-/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
- * todo - also accept useful args */
+/**
+ * only needed for sub-typing, so a new class gets a valid #BPy_StructRNA
+ * TODO: also accept useful args.
+ */
static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
{
if (PyTuple_GET_SIZE(args) == 1) {
@@ -5865,8 +5924,10 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
return NULL;
}
-/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
- * todo - also accept useful args */
+/**
+ * Only needed for sub-typing, so a new class gets a valid #BPy_StructRNA
+ * TODO: also accept useful args.
+ */
static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
{
BPy_PropertyRNA *base;
@@ -6025,7 +6086,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
RNA_id_pointer_create(*(void **)data, &newptr);
}
else {
- /* note: this is taken from the function's ID pointer
+ /* NOTE: this is taken from the function's ID pointer
* and will break if a function returns a pointer from
* another ID block, watch this! - it should at least be
* easy to debug since they are all ID's */
@@ -6088,7 +6149,7 @@ static PyObject *small_dict_get_item_string(PyObject *dict, const char *key_look
static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject *kw)
{
- /* Note, both BPy_StructRNA and BPy_PropertyRNA can be used here. */
+ /* NOTE: both BPy_StructRNA and BPy_PropertyRNA can be used here. */
PointerRNA *self_ptr = &self->ptr;
FunctionRNA *self_func = self->func;
@@ -6436,11 +6497,11 @@ static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *UNUSED(closure)
}
/* Subclasses of pyrna_struct_Type which support idprop definitions use this as a metaclass. */
-/* note: tp_base member is set to &PyType_Type on init */
+/* NOTE: tp_base member is set to &PyType_Type on init. */
PyTypeObject pyrna_struct_meta_idprop_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "bpy_struct_meta_idprop", /* tp_name */
- /* NOTE! would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's */
+ /* NOTE: would be PyTypeObject, but subtypes of Type must be PyHeapTypeObject's. */
sizeof(PyHeapTypeObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -7216,7 +7277,7 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
RNA_pointer_create(NULL, &RNA_Struct, srna, &ptr);
item = pyrna_struct_CreatePyObject(&ptr);
- /* Note, must set the class not the __dict__ else the internal slots are not updated correctly.
+ /* NOTE: must set the class not the __dict__ else the internal slots are not updated correctly.
*/
PyObject_SetAttr(newclass, bpy_intern_str_bl_rna, item);
Py_DECREF(item);
@@ -7433,7 +7494,9 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna)
return newclass;
}
-/* Use for subtyping so we know which srna is used for a PointerRNA. */
+/**
+ * Use for sub-typing so we know which SRNA is used for a #PointerRNA.
+ */
static StructRNA *srna_from_ptr(PointerRNA *ptr)
{
if (ptr->type == &RNA_Struct) {
@@ -7454,7 +7517,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
{
BPy_StructRNA *pyrna = NULL;
- /* Note: don't rely on this to return None since NULL data with a valid type can often crash. */
+ /* NOTE: don't rely on this to return None since NULL data with a valid type can often crash. */
if (ptr->data == NULL && ptr->type == NULL) { /* Operator RNA has NULL data. */
Py_RETURN_NONE;
}
@@ -8367,7 +8430,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
return bpy_class_validate_recursive(dummyptr, dummyptr->type, py_data, have_function);
}
-/* TODO - multiple return values like with RNA functions. */
+/* TODO: multiple return values like with RNA functions. */
static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
{
PyObject *args;
@@ -8772,7 +8835,7 @@ void pyrna_free_types(void)
void *py_ptr = RNA_struct_py_type_get(srna);
if (py_ptr) {
-#if 0 /* XXX - should be able to do this, but makes Python crash on exit. */
+#if 0 /* XXX: should be able to do this, but makes Python crash on exit. */
bpy_class_free(py_ptr);
#endif
RNA_struct_py_type_set(srna, NULL);
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index b359e93315e..9745f39b6b8 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -240,7 +240,7 @@ static int pyrna_struct_keyframe_parse(PointerRNA *ptr,
PyObject *pyoptions = NULL;
const char *path;
- /* note, parse_str MUST start with 's|ifsO!' */
+ /* NOTE: `parse_str` MUST start with `s|ifsO!`. */
if (!PyArg_ParseTupleAndKeywords(args,
kw,
parse_str,
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index aafc787b6fc..abbc332d89d 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -548,7 +548,7 @@ static int py_to_array(PyObject *seq,
}
if (totitem) {
- /* note: this code is confusing */
+ /* NOTE: this code is confusing. */
if (param_data && RNA_property_flag(prop) & PROP_DYNAMIC) {
/* not freeing allocated mem, RNA_parameter_list_free() will do this */
ParameterDynAlloc *param_alloc = (ParameterDynAlloc *)param_data;
@@ -990,7 +990,7 @@ PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop)
return pyrna_prop_CreatePyObject(ptr, prop);
}
-/* TODO, multi-dimensional arrays */
+/* TODO: multi-dimensional arrays. */
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
{
const int len = RNA_property_array_length(ptr, prop);
diff --git a/source/blender/python/intern/bpy_rna_gizmo.c b/source/blender/python/intern/bpy_rna_gizmo.c
index 1f27e4bcca8..869019692df 100644
--- a/source/blender/python/intern/bpy_rna_gizmo.c
+++ b/source/blender/python/intern/bpy_rna_gizmo.c
@@ -246,7 +246,7 @@ static PyObject *bpy_gizmo_target_set_handler(PyObject *UNUSED(self), PyObject *
.py_fn_slots = {NULL},
};
- /* Note: this is a counter-part to functions:
+ /* NOTE: this is a counter-part to functions:
* 'Gizmo.target_set_prop & target_set_operator'
* (see: rna_wm_gizmo_api.c). conventions should match. */
static const char *const _keywords[] = {"self", "target", "get", "set", "range", NULL};
@@ -537,7 +537,7 @@ bool BPY_rna_gizmo_module(PyObject *mod_par)
PyObject *func_inst = PyInstanceMethod_New(func);
char name_prefix[128];
PyOS_snprintf(name_prefix, sizeof(name_prefix), "_rna_gizmo_%s", m->ml_name);
- /* TODO, return a type that binds nearly to a method. */
+ /* TODO: return a type that binds nearly to a method. */
PyModule_AddObject(mod_par, name_prefix, func_inst);
}
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index ac061c3dd60..66044311321 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -130,7 +130,7 @@ static int foreach_libblock_id_user_map_callback(LibraryIDLinkCallbackData *cb_d
}
PyDoc_STRVAR(bpy_user_map_doc,
- ".. method:: user_map([subset=(id1, id2, ...)], key_types={..}, value_types={..})\n"
+ ".. method:: user_map(subset, key_types, value_types)\n"
"\n"
" Returns a mapping of all ID data-blocks in current ``bpy.data`` to a set of all "
"datablocks using them.\n"
@@ -277,7 +277,7 @@ error:
}
PyDoc_STRVAR(bpy_batch_remove_doc,
- ".. method:: batch_remove(ids=(id1, id2, ...))\n"
+ ".. method:: batch_remove(ids)\n"
"\n"
" Remove (delete) several IDs at once.\n"
"\n"
diff --git a/source/blender/python/intern/bpy_utils_previews.c b/source/blender/python/intern/bpy_utils_previews.c
index 7a826d99a3d..6a46d2a1a96 100644
--- a/source/blender/python/intern/bpy_utils_previews.c
+++ b/source/blender/python/intern/bpy_utils_previews.c
@@ -59,7 +59,6 @@ PyDoc_STRVAR(
" :type name: string\n"
" :return: The Preview matching given name, or a new empty one.\n"
" :rtype: :class:`bpy.types.ImagePreview`\n"
- " :rtype: :class:`bpy.types.ImagePreview`\n"
/* This is only true when accessed via 'bpy.utils.previews.ImagePreviewCollection.load',
* however this is the public API, allow this minor difference to the internal version here. */
" :raises KeyError: if ``name`` already exists.");
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 8a7f782de3c..7546f2ef730 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -68,7 +68,7 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
/* -----------------------------METHODS---------------------------- */
-/* note: BaseMath_ReadCallback must be called beforehand */
+/* NOTE: BaseMath_ReadCallback must be called beforehand. */
static PyObject *Color_ToTupleExt(ColorObject *self, int ndigits)
{
PyObject *ret;
@@ -570,7 +570,7 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
}
}
else {
- BLI_assert(!"internal error");
+ BLI_assert_msg(0, "internal error");
}
PyErr_Format(PyExc_TypeError,
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 4e1b31b6371..595d03b533b 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -110,7 +110,7 @@ short euler_order_from_string(const char *str, const char *error_prefix)
return -1;
}
-/* note: BaseMath_ReadCallback must be called beforehand */
+/* NOTE: BaseMath_ReadCallback must be called beforehand. */
static PyObject *Euler_ToTupleExt(EulerObject *self, int ndigits)
{
PyObject *ret;
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 3dde0177648..8b8130f3cc2 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -263,7 +263,7 @@ Mathutils_Callback mathutils_matrix_col_cb = {
/* ----------------------------------------------------------------------------
* matrix row callbacks
* this is so you can do matrix.translation = val
- * note, this is _exactly like matrix.col except the 4th component is always omitted */
+ * NOTE: this is _exactly like matrix.col except the 4th component is always omitted. */
uchar mathutils_matrix_translation_cb_index = -1;
@@ -1938,7 +1938,7 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
return NULL;
}
- /* TODO, different sized matrix */
+ /* TODO: different sized matrix. */
if (self->num_col == 4 && self->num_row == 4) {
#ifdef MATH_STANDALONE
blend_m4_m4m4((float(*)[4])mat, (float(*)[4])self->matrix, (float(*)[4])mat2->matrix, fac);
@@ -2998,7 +2998,7 @@ static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNU
return -1;
}
- if ((mathutils_array_parse(tvec, 3, 3, value, "Matrix.translation")) == -1) {
+ if (mathutils_array_parse(tvec, 3, 3, value, "Matrix.translation") == -1) {
return -1;
}
@@ -3614,7 +3614,7 @@ static int MatrixAccess_ass_subscript(MatrixAccessObject *self, PyObject *item,
}
return Matrix_ass_item_col(matrix_user, i, value);
}
- /* TODO, slice */
+ /* TODO: slice. */
PyErr_Format(
PyExc_TypeError, "matrix indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 88aa1f146e2..77a30dcd447 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -42,7 +42,7 @@ static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args);
/* -----------------------------METHODS------------------------------ */
-/* note: BaseMath_ReadCallback must be called beforehand */
+/* NOTE: BaseMath_ReadCallback must be called beforehand. */
static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits)
{
PyObject *ret;
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index a9cb125f715..c2223b023ad 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -149,7 +149,7 @@ static PyObject *C_Vector_Fill(PyObject *cls, PyObject *args)
}
PyDoc_STRVAR(C_Vector_Range_doc,
- ".. classmethod:: Range(start=0, stop, step=1)\n"
+ ".. classmethod:: Range(start, stop, step=1)\n"
"\n"
" Create a filled with a range of values.\n"
"\n"
@@ -628,7 +628,7 @@ PyDoc_STRVAR(Vector_to_tuple_doc,
" :type precision: int\n"
" :return: the values of the vector rounded by *precision*\n"
" :rtype: tuple\n");
-/* note: BaseMath_ReadCallback must be called beforehand */
+/* NOTE: BaseMath_ReadCallback must be called beforehand. */
static PyObject *Vector_to_tuple_ex(VectorObject *self, int ndigits)
{
PyObject *ret;
@@ -2553,7 +2553,7 @@ static PyGetSetDef Vector_getseters[] = {
NULL},
{"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
- /* autogenerated swizzle attrs, see Python script above */
+ /* Auto-generated swizzle attributes, see Python script above. */
{"xx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SWIZZLE2(0, 0)},
{"xxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SWIZZLE3(0, 0, 0)},
{"xxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SWIZZLE4(0, 0, 0, 0)},
@@ -3019,8 +3019,7 @@ static struct PyMethodDef Vector_methods[] = {
};
/**
- * Note:
- * #Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing
+ * NOTE: #Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing
* but this means for eg that (vec * mat) and (mat * vec)
* both get sent to Vector_mul and it needs to sort out the order
*/
diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c
index 80919e014d5..588d3753eab 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -1109,7 +1109,7 @@ PyDoc_STRVAR(C_BVHTree_FromObject_doc,
" :type cage: bool\n" PYBVH_FROM_GENERIC_EPSILON_DOC);
static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyObject *kwargs)
{
- /* note, options here match 'bpy_bmesh_from_object' */
+ /* NOTE: options here match #bpy_bmesh_from_object. */
const char *keywords[] = {"object", "depsgraph", "deform", "cage", "epsilon", NULL};
PyObject *py_ob, *py_depsgraph;
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 3b1a6524ed9..88b3bddddf6 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -1102,7 +1102,7 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a
return NULL;
}
- /* note, this could be refactored into plain C easy - py bits are noted */
+ /* NOTE: this could be refactored into plain C easy - py bits are noted. */
struct PointsInPlanes_UserData user_data = {
.py_verts = PyList_New(0),