Cleanup: use "num" as a suffix in: source/blender/python
See T85728
This commit is contained in:
@@ -305,23 +305,24 @@ static PyObject *M_Noise_random_unit_vector(PyObject *UNUSED(self), PyObject *ar
|
||||
static const char *kwlist[] = {"size", NULL};
|
||||
float vec[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
float norm = 2.0f;
|
||||
int size = 3;
|
||||
int vec_num = 3;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|$i:random_unit_vector", (char **)kwlist, &size)) {
|
||||
if (!PyArg_ParseTupleAndKeywords(
|
||||
args, kw, "|$i:random_unit_vector", (char **)kwlist, &vec_num)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size > 4 || size < 2) {
|
||||
if (vec_num > 4 || vec_num < 2) {
|
||||
PyErr_SetString(PyExc_ValueError, "Vector(): invalid size");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (norm == 0.0f || norm > 1.0f) {
|
||||
rand_vn(vec, size);
|
||||
norm = normalize_vn(vec, size);
|
||||
rand_vn(vec, vec_num);
|
||||
norm = normalize_vn(vec, vec_num);
|
||||
}
|
||||
|
||||
return Vector_CreatePyObject(vec, size, NULL);
|
||||
return Vector_CreatePyObject(vec, vec_num, NULL);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_Noise_random_vector_doc,
|
||||
@@ -337,22 +338,22 @@ static PyObject *M_Noise_random_vector(PyObject *UNUSED(self), PyObject *args, P
|
||||
{
|
||||
static const char *kwlist[] = {"size", NULL};
|
||||
float *vec = NULL;
|
||||
int size = 3;
|
||||
int vec_num = 3;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|$i:random_vector", (char **)kwlist, &size)) {
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|$i:random_vector", (char **)kwlist, &vec_num)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size < 2) {
|
||||
if (vec_num < 2) {
|
||||
PyErr_SetString(PyExc_ValueError, "Vector(): invalid size");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vec = PyMem_New(float, size);
|
||||
vec = PyMem_New(float, vec_num);
|
||||
|
||||
rand_vn(vec, size);
|
||||
rand_vn(vec, vec_num);
|
||||
|
||||
return Vector_CreatePyObject_alloc(vec, size, NULL);
|
||||
return Vector_CreatePyObject_alloc(vec, vec_num, NULL);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_Noise_seed_set_doc,
|
||||
|
||||
Reference in New Issue
Block a user