diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-07-03 16:08:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-07-03 17:43:40 +0300 |
commit | 9b89de2571b0c3fa2276b5c2ae589e0ec831d1f5 (patch) | |
tree | 63f1007a5262b4d6f1c1a96734c521d836eb6fc6 /source/blender/python | |
parent | 05f970847e12ce30e8c4c624677d94ae239ce2bc (diff) |
Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXX
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
Diffstat (limited to 'source/blender/python')
27 files changed, 92 insertions, 89 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index d198c6ca559..6d500c44fb2 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -45,7 +45,7 @@ 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 */ + /* NOTE: we could have multiple errors. */ const char *errmsg; if (BMO_error_get(bm, &errmsg, NULL)) { PyErr_Format(PyExc_RuntimeError, "bmesh operator: %.200s", errmsg); @@ -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, @@ -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/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/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index bc05c51414f..7c5c1122aea 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -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_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..14e25e02d84 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1784,7 +1784,7 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, (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..e6479df2fa8 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. */ @@ -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; @@ -5183,7 +5182,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) { @@ -5357,7 +5356,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); @@ -5817,8 +5816,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 +5866,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 +6028,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 +6091,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 +6439,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 +7219,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 +7436,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 +7459,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 +8372,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 +8777,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/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 8a7f782de3c..819874e4355 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; 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..dc98e3313c9 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); @@ -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..7afae6f1fce 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -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; @@ -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), |