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/bmesh/bmesh_py_types.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c6
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_select.c21
-rw-r--r--source/blender/python/generic/blf_py_api.c1
-rw-r--r--source/blender/python/generic/py_capi_utils.h4
-rw-r--r--source/blender/python/gpu/gpu_py_buffer.c6
-rw-r--r--source/blender/python/gpu/gpu_py_capabilities.c162
-rw-r--r--source/blender/python/gpu/gpu_py_offscreen.c29
-rw-r--r--source/blender/python/gpu/gpu_py_platform.c36
-rw-r--r--source/blender/python/gpu/gpu_py_shader.c45
-rw-r--r--source/blender/python/intern/bpy.c3
-rw-r--r--source/blender/python/intern/bpy_app_icons.c6
-rw-r--r--source/blender/python/intern/bpy_app_translations.c2
-rw-r--r--source/blender/python/intern/bpy_gizmo_wrap.c2
-rw-r--r--source/blender/python/intern/bpy_interface.c11
-rw-r--r--source/blender/python/intern/bpy_rna.c67
-rw-r--r--source/blender/python/intern/bpy_rna.h1
-rw-r--r--source/blender/python/intern/bpy_rna_array.c2
-rw-r--r--source/blender/python/intern/bpy_rna_id_collection.c2
-rw-r--r--source/blender/python/intern/bpy_rna_operator.c2
-rw-r--r--source/blender/python/intern/bpy_utils_units.c2
-rw-r--r--source/blender/python/mathutils/mathutils.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c4
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c2
25 files changed, 312 insertions, 112 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 612446e6d19..e5e601e0eb6 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -3241,9 +3241,11 @@ static PyObject *bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key)
const Py_ssize_t len = bpy_bmelemseq_length(self);
if (start < 0) {
start += len;
+ CLAMP_MIN(start, 0);
}
if (stop < 0) {
stop += len;
+ CLAMP_MIN(stop, 0);
}
}
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index ff06cf43026..0aa92158524 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -843,9 +843,11 @@ static PyObject *bpy_bmlayercollection_subscript(BPy_BMLayerCollection *self, Py
const Py_ssize_t len = bpy_bmlayercollection_length(self);
if (start < 0) {
start += len;
+ CLAMP_MIN(start, 0);
}
if (stop < 0) {
stop += len;
+ CLAMP_MIN(stop, 0);
}
}
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 8f4e07c30d3..d0c745e6a1d 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -443,7 +443,7 @@ static int bpy_bmdeformvert_ass_subscript(BPy_BMDeformVert *self, PyObject *key,
}
if (value) {
- /* dvert[group_index] = 0.5 */
+ /* Handle `dvert[group_index] = 0.5`. */
if (i < 0) {
PyErr_SetString(PyExc_KeyError,
"BMDeformVert[key] = x: "
@@ -453,7 +453,7 @@ static int bpy_bmdeformvert_ass_subscript(BPy_BMDeformVert *self, PyObject *key,
MDeformWeight *dw = BKE_defvert_ensure_index(self->data, i);
const float f = PyFloat_AsDouble(value);
- if (f == -1 && PyErr_Occurred()) { // parsed key not a number
+ if (f == -1 && PyErr_Occurred()) { /* Parsed key not a number. */
PyErr_SetString(PyExc_TypeError,
"BMDeformVert[key] = x: "
"assigned value not a number");
@@ -463,7 +463,7 @@ static int bpy_bmdeformvert_ass_subscript(BPy_BMDeformVert *self, PyObject *key,
dw->weight = clamp_f(f, 0.0f, 1.0f);
}
else {
- /* del dvert[group_index] */
+ /* Handle `del dvert[group_index]`. */
MDeformWeight *dw = BKE_defvert_find_index(self->data, i);
if (dw == NULL) {
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c
index 9bb9815f731..b89822a080c 100644
--- a/source/blender/python/bmesh/bmesh_py_types_select.c
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -205,7 +205,6 @@ static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self,
Py_ssize_t stop)
{
int count = 0;
- bool ok;
PyObject *list;
BMEditSelection *ese;
@@ -214,30 +213,22 @@ static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self,
list = PyList_New(0);
- ese = self->bm->selected.first;
-
- ok = (ese != NULL);
-
- if (UNLIKELY(ok == false)) {
- return list;
- }
-
- /* first loop up-until the start */
- for (ok = true; ok; ok = ((ese = ese->next) != NULL)) {
+ /* First loop up-until the start. */
+ for (ese = self->bm->selected.first; ese; ese = ese->next) {
if (count == start) {
break;
}
count++;
}
- /* add items until stop */
- do {
+ /* Add items until stop. */
+ for (; ese; ese = ese->next) {
PyList_APPEND(list, BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head));
count++;
if (count == stop) {
break;
}
- } while ((ese = ese->next));
+ }
return list;
}
@@ -282,9 +273,11 @@ static PyObject *bpy_bmeditselseq_subscript(BPy_BMEditSelSeq *self, PyObject *ke
const Py_ssize_t len = bpy_bmeditselseq_length(self);
if (start < 0) {
start += len;
+ CLAMP_MIN(start, 0);
}
if (stop < 0) {
stop += len;
+ CLAMP_MIN(stop, 0);
}
}
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 0ec66e22fa9..9e725730d40 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -493,7 +493,6 @@ PyObject *BPyInit_blf(void)
PyModule_AddIntConstant(submodule, "ROTATION", BLF_ROTATION);
PyModule_AddIntConstant(submodule, "CLIPPING", BLF_CLIPPING);
PyModule_AddIntConstant(submodule, "SHADOW", BLF_SHADOW);
- PyModule_AddIntConstant(submodule, "KERNING_DEFAULT", BLF_KERNING_DEFAULT);
PyModule_AddIntConstant(submodule, "WORD_WRAP", BLF_WORD_WRAP);
PyModule_AddIntConstant(submodule, "MONOCHROME", BLF_MONOCHROME);
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 1591413530c..bfe0e66e393 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -42,13 +42,13 @@ void PyC_Err_PrintWithFunc(PyObject *py_func);
void PyC_FileAndNum(const char **r_filename, int *r_lineno);
void PyC_FileAndNum_Safe(const char **r_filename, int *r_lineno); /* checks python is running */
int PyC_AsArray_FAST(void *array,
- const size_t array_elem_size,
+ const size_t array_item_size,
PyObject *value_fast,
const Py_ssize_t length,
const PyTypeObject *type,
const char *error_prefix);
int PyC_AsArray(void *array,
- const size_t array_elem_size,
+ const size_t array_item_size,
PyObject *value,
const Py_ssize_t length,
const PyTypeObject *type,
diff --git a/source/blender/python/gpu/gpu_py_buffer.c b/source/blender/python/gpu/gpu_py_buffer.c
index a1fc89e772e..0fef59d6352 100644
--- a/source/blender/python/gpu/gpu_py_buffer.c
+++ b/source/blender/python/gpu/gpu_py_buffer.c
@@ -37,7 +37,7 @@
#include "gpu_py_buffer.h"
-//#define PYGPU_BUFFER_PROTOCOL
+#define PYGPU_BUFFER_PROTOCOL
#define MAX_DIMENSIONS 64
/* -------------------------------------------------------------------- */
@@ -608,7 +608,7 @@ static void pygpu_buffer_strides_calc(const eGPUDataFormat format,
}
/* Here is the buffer interface function */
-static int pygpu_buffer__bf_getbuffer(BPyGPUBuffer *self, Py_buffer *view, int flags)
+static int pygpu_buffer__bf_getbuffer(BPyGPUBuffer *self, Py_buffer *view, int UNUSED(flags))
{
if (view == NULL) {
PyErr_SetString(PyExc_ValueError, "NULL view in getbuffer");
@@ -620,7 +620,7 @@ static int pygpu_buffer__bf_getbuffer(BPyGPUBuffer *self, Py_buffer *view, int f
view->len = bpygpu_Buffer_size(self);
view->readonly = 0;
view->itemsize = GPU_texture_dataformat_size(self->format);
- view->format = pygpu_buffer_formatstr(self->format);
+ view->format = (char *)pygpu_buffer_formatstr(self->format);
view->ndim = self->shape_len;
view->shape = self->shape;
view->strides = MEM_mallocN(view->ndim * sizeof(*view->strides), "BPyGPUBuffer strides");
diff --git a/source/blender/python/gpu/gpu_py_capabilities.c b/source/blender/python/gpu/gpu_py_capabilities.c
index f3fb93021b2..11e7d48f096 100644
--- a/source/blender/python/gpu/gpu_py_capabilities.c
+++ b/source/blender/python/gpu/gpu_py_capabilities.c
@@ -33,66 +33,166 @@
/** \name Functions
* \{ */
+PyDoc_STRVAR(pygpu_max_texture_size_get_doc,
+ ".. function:: max_texture_size_get()\n"
+ "\n"
+ " Get estimated maximum texture size to be able to handle.\n"
+ "\n"
+ " :return: Texture size.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_texture_size_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_texture_size());
}
+PyDoc_STRVAR(pygpu_max_texture_layers_get_doc,
+ ".. function:: max_texture_layers_get()\n"
+ "\n"
+ " Get maximum number of layers in texture.\n"
+ "\n"
+ " :return: Number of layers.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_texture_layers_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_texture_layers());
}
+PyDoc_STRVAR(pygpu_max_textures_get_doc,
+ ".. function:: max_textures_get()\n"
+ "\n"
+ " Get maximum supported texture image units used for\n"
+ " accessing texture maps from the vertex shader and the\n"
+ " fragment processor.\n"
+ "\n"
+ " :return: Texture image units.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_textures_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_textures());
}
+PyDoc_STRVAR(pygpu_max_textures_vert_get_doc,
+ ".. function:: max_textures_vert_get()\n"
+ "\n"
+ " Get maximum supported texture image units used for\n"
+ " accessing texture maps from the vertex shader.\n"
+ "\n"
+ " :return: Texture image units.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_textures_vert_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_textures_vert());
}
+PyDoc_STRVAR(pygpu_max_textures_geom_get_doc,
+ ".. function:: max_textures_geom_get()\n"
+ "\n"
+ " Get maximum supported texture image units used for\n"
+ " accessing texture maps from the geometry shader.\n"
+ "\n"
+ " :return: Texture image units.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_textures_geom_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_textures_geom());
}
+PyDoc_STRVAR(pygpu_max_textures_frag_get_doc,
+ ".. function:: max_textures_frag_get()\n"
+ "\n"
+ " Get maximum supported texture image units used for\n"
+ " accessing texture maps from the fragment shader.\n"
+ "\n"
+ " :return: Texture image units.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_textures_frag_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_textures_frag());
}
+PyDoc_STRVAR(pygpu_max_uniforms_vert_get_doc,
+ ".. function:: max_uniforms_vert_get()\n"
+ "\n"
+ " Get maximum number of values held in uniform variable\n"
+ " storage for a vertex shader.\n"
+ "\n"
+ " :return: Number of values.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_uniforms_vert_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_uniforms_vert());
}
+PyDoc_STRVAR(pygpu_max_uniforms_frag_get_doc,
+ ".. function:: max_uniforms_frag_get()\n"
+ "\n"
+ " Get maximum number of values held in uniform variable\n"
+ " storage for a fragment shader.\n"
+ "\n"
+ " :return: Number of values.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_uniforms_frag_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_uniforms_frag());
}
+PyDoc_STRVAR(pygpu_max_batch_indices_get_doc,
+ ".. function:: max_batch_indices_get()\n"
+ "\n"
+ " Get maximum number of vertex array indices.\n"
+ "\n"
+ " :return: Number of indices.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_batch_indices_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_batch_indices());
}
+PyDoc_STRVAR(pygpu_max_batch_vertices_get_doc,
+ ".. function:: max_batch_vertices_get()\n"
+ "\n"
+ " Get maximum number of vertex array vertices.\n"
+ "\n"
+ " :return: Number of vertices.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_batch_vertices_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_batch_vertices());
}
+PyDoc_STRVAR(pygpu_max_vertex_attribs_get_doc,
+ ".. function:: max_vertex_attribs_get()\n"
+ "\n"
+ " Get maximum number of vertex attributes accessible to\n"
+ " a vertex shader.\n"
+ "\n"
+ " :return: Number of attributes.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_vertex_attribs_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_vertex_attribs());
}
+PyDoc_STRVAR(pygpu_max_varying_floats_get_doc,
+ ".. function:: max_varying_floats_get()\n"
+ "\n"
+ " Get maximum number of varying variables used by\n"
+ " vertex and fragment shaders.\n"
+ "\n"
+ " :return: Number of variables.\n"
+ " :rtype: int\n");
static PyObject *pygpu_max_varying_floats_get(PyObject *UNUSED(self))
{
return PyLong_FromLong(GPU_max_varying_floats());
}
+PyDoc_STRVAR(pygpu_extensions_get_doc,
+ ".. function:: extensions_get()\n"
+ "\n"
+ " Get supported extensions in the current context.\n"
+ "\n"
+ " :return: Extensions.\n"
+ " :rtype: tuple of string\n");
static PyObject *pygpu_extensions_get(PyObject *UNUSED(self))
{
int extensions_len = GPU_extensions_len();
@@ -112,19 +212,55 @@ static PyObject *pygpu_extensions_get(PyObject *UNUSED(self))
* \{ */
static struct PyMethodDef pygpu_capabilities__tp_methods[] = {
- {"max_texture_size_get", (PyCFunction)pygpu_max_texture_size_get, METH_NOARGS, NULL},
- {"max_texture_layers_get", (PyCFunction)pygpu_max_texture_layers_get, METH_NOARGS, NULL},
- {"max_textures_get", (PyCFunction)pygpu_max_textures_get, METH_NOARGS, NULL},
- {"max_textures_vert_get", (PyCFunction)pygpu_max_textures_vert_get, METH_NOARGS, NULL},
- {"max_textures_geom_get", (PyCFunction)pygpu_max_textures_geom_get, METH_NOARGS, NULL},
- {"max_textures_frag_get", (PyCFunction)pygpu_max_textures_frag_get, METH_NOARGS, NULL},
- {"max_uniforms_vert_get", (PyCFunction)pygpu_max_uniforms_vert_get, METH_NOARGS, NULL},
- {"max_uniforms_frag_get", (PyCFunction)pygpu_max_uniforms_frag_get, METH_NOARGS, NULL},
- {"max_batch_indices_get", (PyCFunction)pygpu_max_batch_indices_get, METH_NOARGS, NULL},
- {"max_batch_vertices_get", (PyCFunction)pygpu_max_batch_vertices_get, METH_NOARGS, NULL},
- {"max_vertex_attribs_get", (PyCFunction)pygpu_max_vertex_attribs_get, METH_NOARGS, NULL},
- {"max_varying_floats_get", (PyCFunction)pygpu_max_varying_floats_get, METH_NOARGS, NULL},
- {"extensions_get", (PyCFunction)pygpu_extensions_get, METH_NOARGS, NULL},
+ {"max_texture_size_get",
+ (PyCFunction)pygpu_max_texture_size_get,
+ METH_NOARGS,
+ pygpu_max_texture_size_get_doc},
+ {"max_texture_layers_get",
+ (PyCFunction)pygpu_max_texture_layers_get,
+ METH_NOARGS,
+ pygpu_max_texture_layers_get_doc},
+ {"max_textures_get",
+ (PyCFunction)pygpu_max_textures_get,
+ METH_NOARGS,
+ pygpu_max_textures_get_doc},
+ {"max_textures_vert_get",
+ (PyCFunction)pygpu_max_textures_vert_get,
+ METH_NOARGS,
+ pygpu_max_textures_vert_get_doc},
+ {"max_textures_geom_get",
+ (PyCFunction)pygpu_max_textures_geom_get,
+ METH_NOARGS,
+ pygpu_max_textures_geom_get_doc},
+ {"max_textures_frag_get",
+ (PyCFunction)pygpu_max_textures_frag_get,
+ METH_NOARGS,
+ pygpu_max_textures_frag_get_doc},
+ {"max_uniforms_vert_get",
+ (PyCFunction)pygpu_max_uniforms_vert_get,
+ METH_NOARGS,
+ pygpu_max_uniforms_vert_get_doc},
+ {"max_uniforms_frag_get",
+ (PyCFunction)pygpu_max_uniforms_frag_get,
+ METH_NOARGS,
+ pygpu_max_uniforms_frag_get_doc},
+ {"max_batch_indices_get",
+ (PyCFunction)pygpu_max_batch_indices_get,
+ METH_NOARGS,
+ pygpu_max_batch_indices_get_doc},
+ {"max_batch_vertices_get",
+ (PyCFunction)pygpu_max_batch_vertices_get,
+ METH_NOARGS,
+ pygpu_max_batch_vertices_get_doc},
+ {"max_vertex_attribs_get",
+ (PyCFunction)pygpu_max_vertex_attribs_get,
+ METH_NOARGS,
+ pygpu_max_vertex_attribs_get_doc},
+ {"max_varying_floats_get",
+ (PyCFunction)pygpu_max_varying_floats_get,
+ METH_NOARGS,
+ pygpu_max_varying_floats_get_doc},
+ {"extensions_get", (PyCFunction)pygpu_extensions_get, METH_NOARGS, pygpu_extensions_get_doc},
{NULL, NULL, 0, NULL},
};
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c
index 457f00b1267..6f23c2213e2 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.c
+++ b/source/blender/python/gpu/gpu_py_offscreen.c
@@ -227,7 +227,7 @@ static PyObject *pygpu_offscreen__tp_new(PyTypeObject *UNUSED(self),
}
if (GPU_context_active_get()) {
- ofs = GPU_offscreen_create(width, height, true, false, err_out);
+ ofs = GPU_offscreen_create(width, height, true, GPU_RGBA8, err_out);
}
else {
STRNCPY(err_out, "No active GPU context found");
@@ -279,7 +279,8 @@ static PyObject *pygpu_offscreen_texture_color_get(BPyGPUOffScreen *self, void *
PyDoc_STRVAR(
pygpu_offscreen_draw_view3d_doc,
- ".. method:: draw_view3d(scene, view_layer, view3d, region, view_matrix, projection_matrix)\n"
+ ".. method:: draw_view3d(scene, view_layer, view3d, region, view_matrix, projection_matrix, "
+ "do_color_management=False)\n"
"\n"
" Draw the 3d viewport in the offscreen object.\n"
"\n"
@@ -294,7 +295,9 @@ PyDoc_STRVAR(
" :arg view_matrix: View Matrix (e.g. ``camera.matrix_world.inverted()``).\n"
" :type view_matrix: :class:`mathutils.Matrix`\n"
" :arg projection_matrix: Projection Matrix (e.g. ``camera.calc_matrix_camera(...)``).\n"
- " :type projection_matrix: :class:`mathutils.Matrix`\n");
+ " :type projection_matrix: :class:`mathutils.Matrix`\n"
+ " :arg do_color_management: Color manage the output.\n"
+ " :type do_color_management: bool\n");
static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *args, PyObject *kwds)
{
MatrixObject *py_mat_view, *py_mat_projection;
@@ -306,12 +309,20 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
View3D *v3d;
ARegion *region;
+ bool do_color_management = false;
+
BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
- static const char *_keywords[] = {
- "scene", "view_layer", "view3d", "region", "view_matrix", "projection_matrix", NULL};
+ static const char *_keywords[] = {"scene",
+ "view_layer",
+ "view3d",
+ "region",
+ "view_matrix",
+ "projection_matrix",
+ "do_color_management",
+ NULL};
- static _PyArg_Parser _parser = {"OOOOO&O&:draw_view3d", _keywords, 0};
+ static _PyArg_Parser _parser = {"OOOOO&O&|$O&:draw_view3d", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(args,
kwds,
&_parser,
@@ -322,7 +333,9 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
Matrix_Parse4x4,
&py_mat_view,
Matrix_Parse4x4,
- &py_mat_projection) ||
+ &py_mat_projection,
+ PyC_ParseBool,
+ &do_color_management) ||
(!(scene = PyC_RNA_AsPointer(py_scene, "Scene")) ||
!(view_layer = PyC_RNA_AsPointer(py_view_layer, "ViewLayer")) ||
!(v3d = PyC_RNA_AsPointer(py_view3d, "SpaceView3D")) ||
@@ -354,7 +367,7 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
true,
true,
"",
- false,
+ do_color_management,
true,
self->ofs,
NULL);
diff --git a/source/blender/python/gpu/gpu_py_platform.c b/source/blender/python/gpu/gpu_py_platform.c
index 132052b6f1d..62310a83642 100644
--- a/source/blender/python/gpu/gpu_py_platform.c
+++ b/source/blender/python/gpu/gpu_py_platform.c
@@ -33,16 +33,37 @@
/** \name Functions
* \{ */
+PyDoc_STRVAR(pygpu_platform_vendor_get_doc,
+ ".. function:: vendor_get()\n"
+ "\n"
+ " Get GPU vendor.\n"
+ "\n"
+ " :return: Vendor name.\n"
+ " :rtype: str\n");
static PyObject *pygpu_platform_vendor_get(PyObject *UNUSED(self))
{
return PyUnicode_FromString(GPU_platform_vendor());
}
+PyDoc_STRVAR(pygpu_platform_renderer_get_doc,
+ ".. function:: renderer_get()\n"
+ "\n"
+ " Get GPU to be used for rendering.\n"
+ "\n"
+ " :return: GPU name.\n"
+ " :rtype: str\n");
static PyObject *pygpu_platform_renderer_get(PyObject *UNUSED(self))
{
return PyUnicode_FromString(GPU_platform_renderer());
}
+PyDoc_STRVAR(pygpu_platform_version_get_doc,
+ ".. function:: version_get()\n"
+ "\n"
+ " Get GPU driver version.\n"
+ "\n"
+ " :return: Driver version.\n"
+ " :rtype: str\n");
static PyObject *pygpu_platform_version_get(PyObject *UNUSED(self))
{
return PyUnicode_FromString(GPU_platform_version());
@@ -55,9 +76,18 @@ static PyObject *pygpu_platform_version_get(PyObject *UNUSED(self))
* \{ */
static struct PyMethodDef pygpu_platform__tp_methods[] = {
- {"vendor_get", (PyCFunction)pygpu_platform_vendor_get, METH_NOARGS, NULL},
- {"renderer_get", (PyCFunction)pygpu_platform_renderer_get, METH_NOARGS, NULL},
- {"version_get", (PyCFunction)pygpu_platform_version_get, METH_NOARGS, NULL},
+ {"vendor_get",
+ (PyCFunction)pygpu_platform_vendor_get,
+ METH_NOARGS,
+ pygpu_platform_vendor_get_doc},
+ {"renderer_get",
+ (PyCFunction)pygpu_platform_renderer_get,
+ METH_NOARGS,
+ pygpu_platform_renderer_get_doc},
+ {"version_get",
+ (PyCFunction)pygpu_platform_version_get,
+ METH_NOARGS,
+ pygpu_platform_version_get_doc},
{NULL, NULL, 0, NULL},
};
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index b3f1c186716..145586d8ab0 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -44,14 +44,28 @@
/** \name Enum Conversion.
* \{ */
+#define PYDOC_BUILTIN_SHADER_LIST \
+ " - ``2D_FLAT_COLOR``\n" \
+ " - ``2D_IMAGE``\n" \
+ " - ``2D_SMOOTH_COLOR``\n" \
+ " - ``2D_UNIFORM_COLOR``\n" \
+ " - ``3D_FLAT_COLOR``\n" \
+ " - ``3D_SMOOTH_COLOR``\n" \
+ " - ``3D_UNIFORM_COLOR``\n" \
+ " - ``3D_POLYLINE_FLAT_COLOR``\n" \
+ " - ``3D_POLYLINE_SMOOTH_COLOR``\n" \
+ " - ``3D_POLYLINE_UNIFORM_COLOR``\n"
+
static const struct PyC_StringEnumItems pygpu_shader_builtin_items[] = {
- {GPU_SHADER_2D_UNIFORM_COLOR, "2D_UNIFORM_COLOR"},
{GPU_SHADER_2D_FLAT_COLOR, "2D_FLAT_COLOR"},
- {GPU_SHADER_2D_SMOOTH_COLOR, "2D_SMOOTH_COLOR"},
{GPU_SHADER_2D_IMAGE, "2D_IMAGE"},
- {GPU_SHADER_3D_UNIFORM_COLOR, "3D_UNIFORM_COLOR"},
+ {GPU_SHADER_2D_SMOOTH_COLOR, "2D_SMOOTH_COLOR"},
+ {GPU_SHADER_2D_UNIFORM_COLOR, "2D_UNIFORM_COLOR"},
{GPU_SHADER_3D_FLAT_COLOR, "3D_FLAT_COLOR"},
{GPU_SHADER_3D_SMOOTH_COLOR, "3D_SMOOTH_COLOR"},
+ {GPU_SHADER_3D_UNIFORM_COLOR, "3D_UNIFORM_COLOR"},
+ {GPU_SHADER_3D_POLYLINE_FLAT_COLOR, "3D_POLYLINE_FLAT_COLOR"},
+ {GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR, "3D_POLYLINE_SMOOTH_COLOR"},
{GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, "3D_POLYLINE_UNIFORM_COLOR"},
{0, NULL},
};
@@ -197,8 +211,9 @@ static bool pygpu_shader_uniform_vector_impl(PyObject *args,
return false;
}
- if (r_pybuffer->len != (*r_length * *r_count * elem_size)) {
- PyErr_SetString(PyExc_BufferError, "GPUShader.uniform_vector_*: buffer size does not match.");
+ if (r_pybuffer->len < (*r_length * *r_count * elem_size)) {
+ PyErr_SetString(PyExc_OverflowError,
+ "GPUShader.uniform_vector_*: buffer size smaller than required.");
return false;
}
@@ -704,14 +719,8 @@ PyDoc_STRVAR(pygpu_shader_from_builtin_doc,
" For more details, you can check the shader code with the\n"
" :func:`gpu.shader.code_from_builtin` function.\n"
"\n"
- " :param pygpu_shader_name: One of these builtin shader names:\n\n"
- " - ``2D_UNIFORM_COLOR``\n"
- " - ``2D_FLAT_COLOR``\n"
- " - ``2D_SMOOTH_COLOR``\n"
- " - ``2D_IMAGE``\n"
- " - ``3D_UNIFORM_COLOR``\n"
- " - ``3D_FLAT_COLOR``\n"
- " - ``3D_SMOOTH_COLOR``\n"
+ " :param pygpu_shader_name: One of these builtin shader names:\n"
+ "\n" PYDOC_BUILTIN_SHADER_LIST
" :type pygpu_shader_name: str\n"
" :return: Shader object corresponding to the given name.\n"
" :rtype: :class:`bpy.types.GPUShader`\n");
@@ -734,14 +743,8 @@ PyDoc_STRVAR(pygpu_shader_code_from_builtin_doc,
"\n"
" Exposes the internal shader code for query.\n"
"\n"
- " :param pygpu_shader_name: One of these builtin shader names:\n\n"
- " - ``2D_UNIFORM_COLOR``\n"
- " - ``2D_FLAT_COLOR``\n"
- " - ``2D_SMOOTH_COLOR``\n"
- " - ``2D_IMAGE``\n"
- " - ``3D_UNIFORM_COLOR``\n"
- " - ``3D_FLAT_COLOR``\n"
- " - ``3D_SMOOTH_COLOR``\n"
+ " :param pygpu_shader_name: One of these builtin shader names:\n"
+ "\n" PYDOC_BUILTIN_SHADER_LIST
" :type pygpu_shader_name: str\n"
" :return: Vertex, fragment and geometry shader codes.\n"
" :rtype: dict\n");
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 30a61067c9e..0e0f431cb19 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -417,9 +417,6 @@ void BPy_init_modules(struct bContext *C)
PyDict_SetItemString(PyImport_GetModuleDict(), "_bpy", mod);
Py_DECREF(mod);
- /* run first, initializes rna types */
- BPY_rna_init();
-
/* needs to be first so bpy_types can run */
PyModule_AddObject(mod, "types", BPY_rna_types());
diff --git a/source/blender/python/intern/bpy_app_icons.c b/source/blender/python/intern/bpy_app_icons.c
index 7cca3ae4700..acd809fb8d5 100644
--- a/source/blender/python/intern/bpy_app_icons.c
+++ b/source/blender/python/intern/bpy_app_icons.c
@@ -35,7 +35,7 @@
/* We may want to load direct from file. */
PyDoc_STRVAR(
bpy_app_icons_new_triangles_doc,
- ".. function:: new_triangles(range, coords, colors)"
+ ".. function:: new_triangles(range, coords, colors)\n"
"\n"
" Create a new icon from triangle geometry.\n"
"\n"
@@ -91,7 +91,7 @@ static PyObject *bpy_app_icons_new_triangles(PyObject *UNUSED(self), PyObject *a
}
PyDoc_STRVAR(bpy_app_icons_new_triangles_from_file_doc,
- ".. function:: new_triangles_from_file(filename)"
+ ".. function:: new_triangles_from_file(filename)\n"
"\n"
" Create a new icon from triangle geometry.\n"
"\n"
@@ -122,7 +122,7 @@ static PyObject *bpy_app_icons_new_triangles_from_file(PyObject *UNUSED(self),
}
PyDoc_STRVAR(bpy_app_icons_release_doc,
- ".. function:: release(icon_id)"
+ ".. function:: release(icon_id)\n"
"\n"
" Release the icon.\n");
static PyObject *bpy_app_icons_release(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index 7437598582f..de70035eb2b 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -746,7 +746,7 @@ static PyObject *app_translations_new(PyTypeObject *type,
PyObject *UNUSED(args),
PyObject *UNUSED(kw))
{
- /* printf("%s (%p)\n", __func__, _translations); */
+ // printf("%s (%p)\n", __func__, _translations);
if (!_translations) {
_translations = (BlenderAppTranslations *)type->tp_alloc(type, 0);
diff --git a/source/blender/python/intern/bpy_gizmo_wrap.c b/source/blender/python/intern/bpy_gizmo_wrap.c
index 42e0c7d0003..a05ec6b7000 100644
--- a/source/blender/python/intern/bpy_gizmo_wrap.c
+++ b/source/blender/python/intern/bpy_gizmo_wrap.c
@@ -79,7 +79,7 @@ static bool bpy_gizmotype_target_property_def(wmGizmoType *gzt, PyObject *item)
goto fail;
}
- if ((params.array_length < 1 || params.array_length > RNA_MAX_ARRAY_LENGTH)) {
+ if ((params.array_length < 1) || (params.array_length > RNA_MAX_ARRAY_LENGTH)) {
PyErr_SetString(PyExc_ValueError, "'array_length' out of range");
goto fail;
}
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index f91ba4d362c..1a308414bc3 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -155,7 +155,7 @@ void bpy_context_clear(bContext *UNUSED(C), const PyGILState_STATE *gilstate)
}
else if (py_call_level == 0) {
/* XXX: Calling classes currently won't store the context :\,
- * can't set NULL because of this. but this is very flakey still. */
+ * can't set NULL because of this. but this is very flaky still. */
#if 0
BPY_context_set(NULL);
#endif
@@ -502,7 +502,10 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
}
#endif
- /* bpy.* and lets us import it */
+ /* Run first, initializes RNA types. */
+ BPY_rna_init();
+
+ /* Defines `bpy.*` and lets us import it. */
BPy_init_modules(C);
pyrna_alloc_types();
@@ -541,6 +544,8 @@ void BPY_python_end(void)
/* free other python data. */
pyrna_free_types();
+ BPY_rna_exit();
+
/* clear all python data from structs */
bpy_intern_string_exit();
@@ -650,7 +655,7 @@ void BPY_modules_load_user(bContext *C)
bpy_context_set(C, &gilstate);
for (text = bmain->texts.first; text; text = text->id.next) {
- if (text->flags & TXT_ISSCRIPT && BLI_path_extension_check(text->id.name + 2, ".py")) {
+ if (text->flags & TXT_ISSCRIPT) {
if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) {
if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET)) {
G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index dff96f74d62..ac1a7f68885 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -181,23 +181,13 @@ static PyMethodDef id_free_weakref_cb_def = {
/* Adds a reference to the list, remember to decref. */
static GHash *id_weakref_pool_get(ID *id)
{
- GHash *weakinfo_hash = NULL;
-
- if (id_weakref_pool) {
- weakinfo_hash = BLI_ghash_lookup(id_weakref_pool, (void *)id);
- }
- else {
- /* First time, allocate pool. */
- id_weakref_pool = BLI_ghash_ptr_new("rna_global_pool");
- weakinfo_hash = NULL;
- }
-
+ GHash *weakinfo_hash = BLI_ghash_lookup(id_weakref_pool, (void *)id);
if (weakinfo_hash == NULL) {
- /* We use a ghash as a set, we could use libHX's HXMAP_SINGULAR, but would be an extra dep. */
+ /* This could be a set, values are used to keep a reference back to the ID
+ * (all of them are the same). */
weakinfo_hash = BLI_ghash_ptr_new("rna_id");
BLI_ghash_insert(id_weakref_pool, id, weakinfo_hash);
}
-
return weakinfo_hash;
}
@@ -283,14 +273,6 @@ static void id_release_weakref_list(struct ID *id, GHash *weakinfo_hash)
BLI_ghash_remove(id_weakref_pool, (void *)id, NULL, NULL);
BLI_ghash_free(weakinfo_hash, NULL, NULL);
-
- if (BLI_ghash_len(id_weakref_pool) == 0) {
- BLI_ghash_free(id_weakref_pool, NULL, NULL);
- id_weakref_pool = NULL;
-# ifdef DEBUG_RNA_WEAKREF
- printf("id_release_weakref freeing pool\n");
-# endif
- }
}
static void id_release_weakref(struct ID *id)
@@ -310,7 +292,8 @@ void BPY_id_release(struct ID *id)
#endif
#ifdef USE_PYRNA_INVALIDATE_WEAKREF
- if (id_weakref_pool) {
+ /* Check for NULL since this may run before Python has been started. */
+ if (id_weakref_pool != NULL) {
PyGILState_STATE gilstate = PyGILState_Ensure();
id_release_weakref(id);
@@ -2825,9 +2808,11 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
const Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
if (start < 0) {
start += len;
+ CLAMP_MIN(start, 0);
}
if (stop < 0) {
stop += len;
+ CLAMP_MIN(stop, 0);
}
}
@@ -2955,9 +2940,11 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self,
Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop);
if (start < 0) {
start += len;
+ CLAMP_MIN(start, 0);
}
if (stop < 0) {
stop += len;
+ CLAMP_MIN(stop, 0);
}
}
@@ -4488,7 +4475,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr
if ((ret == NULL) /* || BPy_PropDeferred_CheckTypeExact(ret) */ ) {
StructRNA *srna = srna_from_self(cls, "StructRNA.__getattr__");
if (srna) {
- PropertyRNA *prop = RNA_struct_type_find_property(srna, PyUnicode_AsUTF8(attr));
+ PropertyRNA *prop = RNA_struct_type_find_property_no_base(srna, PyUnicode_AsUTF8(attr));
if (prop) {
PointerRNA tptr;
PyErr_Clear(); /* Clear error from tp_getattro. */
@@ -4510,7 +4497,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
const char *attr_str = PyUnicode_AsUTF8(attr);
if (srna && !pyrna_write_check() &&
- (is_deferred_prop || RNA_struct_type_find_property(srna, attr_str))) {
+ (is_deferred_prop || RNA_struct_type_find_property_no_base(srna, attr_str))) {
PyErr_Format(PyExc_AttributeError,
"pyrna_struct_meta_idprop_setattro() "
"can't set in readonly state '%.200s.%S'",
@@ -7518,7 +7505,7 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna)
/* Newclass will now have 2 ref's, ???,
* probably 1 is internal since #Py_DECREF here segfaults. */
- /* PyC_ObSpit("new class ref", newclass); */
+ // PyC_ObSpit("new class ref", newclass);
if (newclass) {
/* srna owns one, and the other is owned by the caller. */
@@ -7772,6 +7759,32 @@ void BPY_rna_init(void)
return;
}
#endif
+
+#ifdef USE_PYRNA_INVALIDATE_WEAKREF
+ BLI_assert(id_weakref_pool == NULL);
+ id_weakref_pool = BLI_ghash_ptr_new("rna_global_pool");
+#endif
+}
+
+void BPY_rna_exit(void)
+{
+#ifdef USE_PYRNA_INVALIDATE_WEAKREF
+ /* This can help track down which kinds of data were not released.
+ * If they were in fact freed by Blender, printing their names
+ * will crash giving a useful error with address sanitizer. The likely cause
+ * for this list not being empty is a missing call to: #BKE_libblock_free_data_py. */
+ const int id_weakref_pool_len = BLI_ghash_len(id_weakref_pool);
+ if (id_weakref_pool_len != id_weakref_pool_len) {
+ printf("Found %d unreleased ID's\n", id_weakref_pool_len);
+ GHashIterator gh_iter;
+ GHASH_ITER (gh_iter, id_weakref_pool) {
+ ID *id = BLI_ghashIterator_getKey(&gh_iter);
+ printf("ID: %s\n", id->name);
+ }
+ }
+ BLI_ghash_free(id_weakref_pool, NULL, NULL);
+ id_weakref_pool = NULL;
+#endif
}
/* 'bpy.data' from Python. */
@@ -8677,6 +8690,8 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
}
#ifdef USE_PEDANTIC_WRITE
+ /* Handle nested draw calls, see: T89253. */
+ const bool rna_disallow_writes_prev = rna_disallow_writes;
rna_disallow_writes = is_readonly ? true : false;
#endif
/* *** Main Caller *** */
@@ -8686,7 +8701,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
/* *** Done Calling *** */
#ifdef USE_PEDANTIC_WRITE
- rna_disallow_writes = false;
+ rna_disallow_writes = rna_disallow_writes_prev;
#endif
RNA_parameter_list_end(&iter);
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 24dbad53eb3..fd468bed470 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -181,6 +181,7 @@ StructRNA *srna_from_self(PyObject *self, const char *error_prefix);
StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *error_prefix);
void BPY_rna_init(void);
+void BPY_rna_exit(void);
PyObject *BPY_rna_module(void);
void BPY_update_rna_module(void);
// PyObject *BPY_rna_doc(void);
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index abbc332d89d..fcc796d4545 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -334,7 +334,7 @@ static int validate_array_length(PyObject *rvalue,
}
if (tot != len) {
- /* BLI_snprintf(error_str, error_str_size, "sequence must have length of %d", len); */
+ // BLI_snprintf(error_str, error_str_size, "sequence must have length of %d", len);
PyErr_Format(PyExc_ValueError,
"%s %.200s.%.200s, sequence must have %d items total, not %d",
error_prefix,
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index 1bb68babc3c..7bdb0e30410 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -227,7 +227,7 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
}
if (!data_cb.is_subset &&
- /* We do not want to pre-add keys of flitered out types. */
+ /* We do not want to pre-add keys of filtered out types. */
(key_types_bitmap == NULL || id_check_type(id, key_types_bitmap)) &&
/* We do not want to pre-add keys when we have filter on value types,
* but not on key types. */
diff --git a/source/blender/python/intern/bpy_rna_operator.c b/source/blender/python/intern/bpy_rna_operator.c
index 490d9aa5212..d3ec54fc12d 100644
--- a/source/blender/python/intern/bpy_rna_operator.c
+++ b/source/blender/python/intern/bpy_rna_operator.c
@@ -91,7 +91,7 @@ static void pyop_poll_message_free_fn(bContext *UNUSED(C), void *user_data)
}
PyDoc_STRVAR(BPY_rna_operator_poll_message_set_doc,
- ".. method:: poll_message_set(message, ...)\n"
+ ".. method:: poll_message_set(message, *args)\n"
"\n"
" Set the message to show in the tool-tip when poll fails.\n"
"\n"
diff --git a/source/blender/python/intern/bpy_utils_units.c b/source/blender/python/intern/bpy_utils_units.c
index aa8cf8f2a9f..62f5a17c4dd 100644
--- a/source/blender/python/intern/bpy_utils_units.c
+++ b/source/blender/python/intern/bpy_utils_units.c
@@ -114,7 +114,7 @@ static PyObject *py_structseq_from_strings(PyTypeObject *py_type,
BLI_assert(py_struct_seq != NULL);
for (str_iter = str_items; *str_iter; str_iter++) {
- PyStructSequence_SET_ITEM(py_struct_seq, pos++, PyUnicode_FromString((*str_iter)));
+ PyStructSequence_SET_ITEM(py_struct_seq, pos++, PyUnicode_FromString(*str_iter));
}
return py_struct_seq;
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 5beca7bd71a..be7dae6871b 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -95,7 +95,11 @@ Py_hash_t mathutils_array_hash(const float *array, size_t array_len)
x = 0x345678UL;
i = 0;
while (--len >= 0) {
+#if PY_VERSION_HEX >= 0x30a0000 /* Version: 3.10. */
+ y = _Py_HashDouble(NULL, (double)(array[i++]));
+#else
y = _Py_HashDouble((double)(array[i++]));
+#endif
if (y == -1) {
return -1;
}
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index c2223b023ad..efcaa9b6a51 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1926,7 +1926,7 @@ static PyObject *Vector_imatmul(PyObject *v1, PyObject *v2)
return NULL;
}
-/* divid: obj / obj */
+/* divide: obj / obj */
static PyObject *Vector_div(PyObject *v1, PyObject *v2)
{
float *vec = NULL, scalar;
@@ -2939,7 +2939,7 @@ static int row_vector_multiplication(float r_vec[MAX_DIMENSIONS],
memcpy(vec_cpy, vec->vec, vec_size * sizeof(float));
r_vec[3] = 1.0f;
- /* muliplication */
+ /* Multiplication. */
for (col = 0; col < mat->num_col; col++) {
double dot = 0.0;
for (row = 0; row < mat->num_row; row++) {
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index c73dea79aac..5868c76b28f 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -201,7 +201,7 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
}
if (result == 0) {
- /* collinear */
+ /* Collinear. */
Py_RETURN_NONE;
}