Merge branch 'blender-v3.4-release'

This commit is contained in:
Campbell Barton 2022-11-08 12:18:52 +11:00
commit fddcdcc20c
Notes: blender-bot 2023-02-14 10:37:49 +01:00
Referenced by issue #103027, Weight Paint gradient tool doesn't work with Paint Mask on
15 changed files with 50 additions and 49 deletions

View File

@ -89,7 +89,7 @@ static Py_ssize_t FEdge_sq_length(BPy_FEdge * /*self*/)
return 2;
}
static PyObject *FEdge_sq_item(BPy_FEdge *self, int keynum)
static PyObject *FEdge_sq_item(BPy_FEdge *self, Py_ssize_t keynum)
{
if (keynum < 0) {
keynum += FEdge_sq_length(self);

View File

@ -74,7 +74,7 @@ static Py_ssize_t Stroke_sq_length(BPy_Stroke *self)
return self->s->strokeVerticesSize();
}
static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum)
static PyObject *Stroke_sq_item(BPy_Stroke *self, Py_ssize_t keynum)
{
if (keynum < 0) {
keynum += Stroke_sq_length(self);

View File

@ -3118,7 +3118,7 @@ static Py_ssize_t bpy_bmelemseq_length(BPy_BMElemSeq *self)
}
}
static PyObject *bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, int keynum)
static PyObject *bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, Py_ssize_t keynum)
{
BPY_BM_CHECK_OBJ(self);

View File

@ -740,7 +740,8 @@ static PyObject *bpy_bmlayercollection_subscript_str(BPy_BMLayerCollection *self
return NULL;
}
static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection *self, int keynum)
static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection *self,
Py_ssize_t keynum)
{
Py_ssize_t len;
BPY_BM_CHECK_OBJ(self);

View File

@ -391,7 +391,7 @@ typedef struct BPy_BMDeformVert {
/* Mapping Protocols
* ================= */
static int bpy_bmdeformvert_len(BPy_BMDeformVert *self)
static Py_ssize_t bpy_bmdeformvert_len(BPy_BMDeformVert *self)
{
return self->data->totweight;
}

View File

@ -163,7 +163,7 @@ static Py_ssize_t bpy_bmeditselseq_length(BPy_BMEditSelSeq *self)
return BLI_listbase_count(&self->bm->selected);
}
static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, int keynum)
static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, Py_ssize_t keynum)
{
BMEditSelection *ese;

View File

@ -417,11 +417,11 @@ static PyObject *Method_ShaderSource(PyObject *self, PyObject *args);
/* Buffer sequence methods */
static int Buffer_len(Buffer *self);
static PyObject *Buffer_item(Buffer *self, int i);
static PyObject *Buffer_slice(Buffer *self, int begin, int end);
static int Buffer_ass_item(Buffer *self, int i, PyObject *v);
static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq);
static Py_ssize_t Buffer_len(Buffer *self);
static PyObject *Buffer_item(Buffer *self, Py_ssize_t i);
static PyObject *Buffer_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end);
static int Buffer_ass_item(Buffer *self, Py_ssize_t i, PyObject *v);
static int Buffer_ass_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq);
static PyObject *Buffer_subscript(Buffer *self, PyObject *item);
static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value);
@ -794,12 +794,12 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
/* Buffer sequence methods */
static int Buffer_len(Buffer *self)
static Py_ssize_t Buffer_len(Buffer *self)
{
return self->dimensions[0];
}
static PyObject *Buffer_item(Buffer *self, int i)
static PyObject *Buffer_item(Buffer *self, Py_ssize_t i)
{
if (i >= self->dimensions[0] || i < 0) {
PyErr_SetString(PyExc_IndexError, "array index out of range");
@ -837,10 +837,9 @@ static PyObject *Buffer_item(Buffer *self, int i)
return NULL;
}
static PyObject *Buffer_slice(Buffer *self, int begin, int end)
static PyObject *Buffer_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end)
{
PyObject *list;
int count;
if (begin < 0) {
begin = 0;
@ -854,13 +853,13 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
list = PyList_New(end - begin);
for (count = begin; count < end; count++) {
for (Py_ssize_t count = begin; count < end; count++) {
PyList_SET_ITEM(list, count - begin, Buffer_item(self, count));
}
return list;
}
static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
static int Buffer_ass_item(Buffer *self, Py_ssize_t i, PyObject *v)
{
if (i >= self->dimensions[0] || i < 0) {
PyErr_SetString(PyExc_IndexError, "array assignment index out of range");
@ -895,10 +894,11 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
}
}
static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
static int Buffer_ass_slice(Buffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq)
{
PyObject *item;
int count, err = 0;
int err = 0;
Py_ssize_t count;
if (begin < 0) {
begin = 0;
@ -918,7 +918,7 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
return -1;
}
/* re-use count var */
/* Re-use count variable. */
if ((count = PySequence_Size(seq)) != (end - begin)) {
PyErr_Format(PyExc_TypeError,
"buffer[:] = value, size mismatch in assignment. "

View File

@ -1695,12 +1695,12 @@ static PyMethodDef BPy_IDArray_methods[] = {
{NULL, NULL, 0, NULL},
};
static int BPy_IDArray_Len(BPy_IDArray *self)
static Py_ssize_t BPy_IDArray_Len(BPy_IDArray *self)
{
return self->prop->len;
}
static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, Py_ssize_t index)
{
if (index < 0 || index >= self->prop->len) {
PyErr_SetString(PyExc_IndexError, "index out of range!");
@ -1722,7 +1722,7 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
return NULL;
}
static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
static int BPy_IDArray_SetItem(BPy_IDArray *self, Py_ssize_t index, PyObject *value)
{
if (index < 0 || index >= self->prop->len) {
PyErr_SetString(PyExc_RuntimeError, "index out of range!");

View File

@ -159,7 +159,7 @@ static BPyGPUBuffer *pygpu_buffer_make_from_data(PyObject *parent,
return buffer;
}
static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, int i)
static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, Py_ssize_t i)
{
if (i >= self->shape[0] || i < 0) {
PyErr_SetString(PyExc_IndexError, "array index out of range");
@ -200,10 +200,10 @@ static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, int i)
static PyObject *pygpu_buffer_to_list(BPyGPUBuffer *self)
{
int i, len = self->shape[0];
const Py_ssize_t len = self->shape[0];
PyObject *list = PyList_New(len);
for (i = 0; i < len; i++) {
for (Py_ssize_t i = 0; i < len; i++) {
PyList_SET_ITEM(list, i, pygpu_buffer__sq_item(self, i));
}
@ -313,7 +313,7 @@ static PyObject *pygpu_buffer__tp_repr(BPyGPUBuffer *self)
return repr;
}
static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, int i, PyObject *v);
static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, Py_ssize_t i, PyObject *v);
static int pygpu_buffer_ass_slice(BPyGPUBuffer *self,
Py_ssize_t begin,
@ -430,7 +430,7 @@ static int pygpu_buffer__tp_is_gc(BPyGPUBuffer *self)
/* BPyGPUBuffer sequence methods */
static int pygpu_buffer__sq_length(BPyGPUBuffer *self)
static Py_ssize_t pygpu_buffer__sq_length(BPyGPUBuffer *self)
{
return self->shape[0];
}
@ -458,7 +458,7 @@ static PyObject *pygpu_buffer_slice(BPyGPUBuffer *self, Py_ssize_t begin, Py_ssi
return list;
}
static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, int i, PyObject *v)
static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, Py_ssize_t i, PyObject *v)
{
if (i >= self->shape[0] || i < 0) {
PyErr_SetString(PyExc_IndexError, "array assignment index out of range");

View File

@ -2328,7 +2328,7 @@ static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self,
return 0;
}
static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int keynum)
static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, Py_ssize_t keynum)
{
int len;
@ -2883,7 +2883,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
if (key_slice->start == Py_None && key_slice->stop == Py_None) {
/* 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);
const Py_ssize_t len = pyrna_prop_array_length(self);
return pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len);
}

View File

@ -351,13 +351,13 @@ static Py_hash_t Color_hash(ColorObject *self)
* \{ */
/** Sequence length: `len(object)`. */
static int Color_len(ColorObject *UNUSED(self))
static Py_ssize_t Color_len(ColorObject *UNUSED(self))
{
return COLOR_SIZE;
}
/** Sequence accessor (get): `x = object[i]`. */
static PyObject *Color_item(ColorObject *self, int i)
static PyObject *Color_item(ColorObject *self, Py_ssize_t i)
{
if (i < 0) {
i = COLOR_SIZE - i;
@ -378,7 +378,7 @@ static PyObject *Color_item(ColorObject *self, int i)
}
/** Sequence accessor (set): `object[i] = x`. */
static int Color_ass_item(ColorObject *self, int i, PyObject *value)
static int Color_ass_item(ColorObject *self, Py_ssize_t i, PyObject *value)
{
float f;

View File

@ -434,13 +434,13 @@ static Py_hash_t Euler_hash(EulerObject *self)
* \{ */
/** Sequence length: `len(object)`. */
static int Euler_len(EulerObject *UNUSED(self))
static Py_ssize_t Euler_len(EulerObject *UNUSED(self))
{
return EULER_SIZE;
}
/** Sequence accessor (get): `x = object[i]`. */
static PyObject *Euler_item(EulerObject *self, int i)
static PyObject *Euler_item(EulerObject *self, Py_ssize_t i)
{
if (i < 0) {
i = EULER_SIZE - i;
@ -461,7 +461,7 @@ static PyObject *Euler_item(EulerObject *self, int i)
}
/** Sequence accessor (set): `object[i] = x`. */
static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
static int Euler_ass_item(EulerObject *self, Py_ssize_t i, PyObject *value)
{
float f;

View File

@ -2379,7 +2379,7 @@ static Py_hash_t Matrix_hash(MatrixObject *self)
* \{ */
/** Sequence length: `len(object)`. */
static int Matrix_len(MatrixObject *self)
static Py_ssize_t Matrix_len(MatrixObject *self)
{
return self->row_num;
}
@ -2388,7 +2388,7 @@ static int Matrix_len(MatrixObject *self)
* Sequence accessor (get): `x = object[i]`.
* \note the wrapped vector gives direct access to the matrix data.
*/
static PyObject *Matrix_item_row(MatrixObject *self, int row)
static PyObject *Matrix_item_row(MatrixObject *self, Py_ssize_t row)
{
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
@ -2407,7 +2407,7 @@ static PyObject *Matrix_item_row(MatrixObject *self, int row)
* Sequence accessor (get): `x = object.col[i]`.
* \note the wrapped vector gives direct access to the matrix data.
*/
static PyObject *Matrix_item_col(MatrixObject *self, int col)
static PyObject *Matrix_item_col(MatrixObject *self, Py_ssize_t col)
{
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
@ -3633,15 +3633,15 @@ static int MatrixAccess_len(MatrixAccessObject *self)
return (self->type == MAT_ACCESS_ROW) ? self->matrix_user->row_num : self->matrix_user->col_num;
}
static PyObject *MatrixAccess_slice(MatrixAccessObject *self, int begin, int end)
static PyObject *MatrixAccess_slice(MatrixAccessObject *self, Py_ssize_t begin, Py_ssize_t end)
{
PyObject *tuple;
int count;
Py_ssize_t count;
/* row/col access */
MatrixObject *matrix_user = self->matrix_user;
int matrix_access_len;
PyObject *(*Matrix_item_new)(MatrixObject *, int);
PyObject *(*Matrix_item_new)(MatrixObject *, Py_ssize_t);
if (self->type == MAT_ACCESS_ROW) {
matrix_access_len = matrix_user->row_num;

View File

@ -881,13 +881,13 @@ static Py_hash_t Quaternion_hash(QuaternionObject *self)
* \{ */
/** Sequence length: `len(object)`. */
static int Quaternion_len(QuaternionObject *UNUSED(self))
static Py_ssize_t Quaternion_len(QuaternionObject *UNUSED(self))
{
return QUAT_SIZE;
}
/** Sequence accessor (get): `x = object[i]`. */
static PyObject *Quaternion_item(QuaternionObject *self, int i)
static PyObject *Quaternion_item(QuaternionObject *self, Py_ssize_t i)
{
if (i < 0) {
i = QUAT_SIZE - i;
@ -908,7 +908,7 @@ static PyObject *Quaternion_item(QuaternionObject *self, int i)
}
/** Sequence accessor (set): `object[i] = x`. */
static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
static int Quaternion_ass_item(QuaternionObject *self, Py_ssize_t i, PyObject *ob)
{
float f;

View File

@ -1667,7 +1667,7 @@ static Py_hash_t Vector_hash(VectorObject *self)
* \{ */
/** Sequence length: `len(object)`. */
static int Vector_len(VectorObject *self)
static Py_ssize_t Vector_len(VectorObject *self)
{
return self->vec_num;
}
@ -1699,7 +1699,7 @@ static PyObject *vector_item_internal(VectorObject *self, int i, const bool is_a
}
/** Sequence accessor (get): `x = object[i]`. */
static PyObject *Vector_item(VectorObject *self, int i)
static PyObject *Vector_item(VectorObject *self, Py_ssize_t i)
{
return vector_item_internal(self, i, false);
}
@ -1747,7 +1747,7 @@ static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value,
}
/** Sequence accessor (set): `object[i] = x`. */
static int Vector_ass_item(VectorObject *self, int i, PyObject *value)
static int Vector_ass_item(VectorObject *self, Py_ssize_t i, PyObject *value)
{
return vector_ass_item_internal(self, i, value, false);
}