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:
authorYimingWu <xp8110@outlook.com>2021-07-04 08:25:58 +0300
committerYimingWu <xp8110@outlook.com>2021-07-04 08:25:58 +0300
commitc56ef6fd89c149a87afe62dffc81c9083dd7a2c2 (patch)
tree8056bfb005fbb664e0e09ce84a5ee80397971859 /source/blender/python/intern/bpy_rna.c
parent442f269a72e8f07393fd246f642e210171a1c9bc (diff)
parentb73dc36859e03845f702a3e985b536ac9afef63a (diff)
Merge remote-tracking branch 'origin/master' into lineart-bvhlineart-bvh
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r--source/blender/python/intern/bpy_rna.c63
1 files changed, 34 insertions, 29 deletions
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);