use docstrings for mathutils getset's, also some formatting edits, no functional changes.
This commit is contained in:
@@ -43,7 +43,7 @@ PyDoc_STRVAR(M_Mathutils_doc,
|
||||
static int mathutils_array_parse_fast(float *array,
|
||||
int size,
|
||||
PyObject *value_fast,
|
||||
const char *error_prefix)
|
||||
const char *error_prefix)
|
||||
{
|
||||
PyObject *item;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ static PyObject *Color_copy(ColorObject *self)
|
||||
//----------------------------print object (internal)--------------
|
||||
//print the object to screen
|
||||
|
||||
static PyObject *Color_repr(ColorObject * self)
|
||||
static PyObject *Color_repr(ColorObject *self)
|
||||
{
|
||||
PyObject *ret, *tuple;
|
||||
|
||||
@@ -126,7 +126,7 @@ static PyObject *Color_repr(ColorObject * self)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static PyObject *Color_str(ColorObject * self)
|
||||
static PyObject *Color_str(ColorObject *self)
|
||||
{
|
||||
DynStr *ds;
|
||||
|
||||
@@ -188,7 +188,7 @@ static int Color_len(ColorObject *UNUSED(self))
|
||||
}
|
||||
//----------------------------object[]---------------------------
|
||||
//sequence accessor (get)
|
||||
static PyObject *Color_item(ColorObject * self, int i)
|
||||
static PyObject *Color_item(ColorObject *self, int i)
|
||||
{
|
||||
if (i < 0) i = COLOR_SIZE - i;
|
||||
|
||||
@@ -207,7 +207,7 @@ static PyObject *Color_item(ColorObject * self, int i)
|
||||
}
|
||||
//----------------------------object[]-------------------------
|
||||
//sequence accessor (set)
|
||||
static int Color_ass_item(ColorObject * self, int i, PyObject *value)
|
||||
static int Color_ass_item(ColorObject *self, int i, PyObject *value)
|
||||
{
|
||||
float f = PyFloat_AsDouble(value);
|
||||
|
||||
@@ -235,7 +235,7 @@ static int Color_ass_item(ColorObject * self, int i, PyObject *value)
|
||||
}
|
||||
//----------------------------object[z:y]------------------------
|
||||
//sequence slice (get)
|
||||
static PyObject *Color_slice(ColorObject * self, int begin, int end)
|
||||
static PyObject *Color_slice(ColorObject *self, int begin, int end)
|
||||
{
|
||||
PyObject *tuple;
|
||||
int count;
|
||||
@@ -670,18 +670,26 @@ static PyNumberMethods Color_NumMethods = {
|
||||
};
|
||||
|
||||
/* color channel, vector.r/g/b */
|
||||
static PyObject *Color_channel_get(ColorObject * self, void *type)
|
||||
PyDoc_STRVAR(Color_channel_r_doc, "Red color channel.\n\n:type: float");
|
||||
PyDoc_STRVAR(Color_channel_g_doc, "Green color channel.\n\n:type: float");
|
||||
PyDoc_STRVAR(Color_channel_b_doc, "Blue color channel.\n\n:type: float");
|
||||
|
||||
static PyObject *Color_channel_get(ColorObject *self, void *type)
|
||||
{
|
||||
return Color_item(self, GET_INT_FROM_POINTER(type));
|
||||
}
|
||||
|
||||
static int Color_channel_set(ColorObject * self, PyObject *value, void * type)
|
||||
static int Color_channel_set(ColorObject *self, PyObject *value, void * type)
|
||||
{
|
||||
return Color_ass_item(self, GET_INT_FROM_POINTER(type), value);
|
||||
}
|
||||
|
||||
/* color channel (HSV), color.h/s/v */
|
||||
static PyObject *Color_channel_hsv_get(ColorObject * self, void *type)
|
||||
PyDoc_STRVAR(Color_channel_hsv_h_doc, "HSV Hue component in [0, 1].\n\n:type: float");
|
||||
PyDoc_STRVAR(Color_channel_hsv_s_doc, "HSV Saturation component in [0, 1].\n\n:type: float");
|
||||
PyDoc_STRVAR(Color_channel_hsv_v_doc, "HSV Value component in [0, 1].\n\n:type: float");
|
||||
|
||||
static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
|
||||
{
|
||||
float hsv[3];
|
||||
int i = GET_INT_FROM_POINTER(type);
|
||||
@@ -694,7 +702,7 @@ static PyObject *Color_channel_hsv_get(ColorObject * self, void *type)
|
||||
return PyFloat_FromDouble(hsv[i]);
|
||||
}
|
||||
|
||||
static int Color_channel_hsv_set(ColorObject * self, PyObject *value, void * type)
|
||||
static int Color_channel_hsv_set(ColorObject *self, PyObject *value, void * type)
|
||||
{
|
||||
float hsv[3];
|
||||
int i = GET_INT_FROM_POINTER(type);
|
||||
@@ -722,7 +730,8 @@ static int Color_channel_hsv_set(ColorObject * self, PyObject *value, void * typ
|
||||
}
|
||||
|
||||
/* color channel (HSV), color.h/s/v */
|
||||
static PyObject *Color_hsv_get(ColorObject * self, void *UNUSED(closure))
|
||||
PyDoc_STRVAR(Color_hsv_doc, "HSV Values in [0, 1].\n\n:type: float triplet");
|
||||
static PyObject *Color_hsv_get(ColorObject *self, void *UNUSED(closure))
|
||||
{
|
||||
float hsv[3];
|
||||
PyObject *ret;
|
||||
@@ -739,7 +748,7 @@ static PyObject *Color_hsv_get(ColorObject * self, void *UNUSED(closure))
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int Color_hsv_set(ColorObject * self, PyObject *value, void *UNUSED(closure))
|
||||
static int Color_hsv_set(ColorObject *self, PyObject *value, void *UNUSED(closure))
|
||||
{
|
||||
float hsv[3];
|
||||
|
||||
@@ -762,15 +771,15 @@ static int Color_hsv_set(ColorObject * self, PyObject *value, void *UNUSED(closu
|
||||
/* Python attributes get/set structure: */
|
||||
/*****************************************************************************/
|
||||
static PyGetSetDef Color_getseters[] = {
|
||||
{(char *)"r", (getter)Color_channel_get, (setter)Color_channel_set, (char *)"Red color channel.\n\n:type: float", (void *)0},
|
||||
{(char *)"g", (getter)Color_channel_get, (setter)Color_channel_set, (char *)"Green color channel.\n\n:type: float", (void *)1},
|
||||
{(char *)"b", (getter)Color_channel_get, (setter)Color_channel_set, (char *)"Blue color channel.\n\n:type: float", (void *)2},
|
||||
{(char *)"r", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_r_doc, (void *)0},
|
||||
{(char *)"g", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_g_doc, (void *)1},
|
||||
{(char *)"b", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_b_doc, (void *)2},
|
||||
|
||||
{(char *)"h", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)"HSV Hue component in [0, 1].\n\n:type: float", (void *)0},
|
||||
{(char *)"s", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)"HSV Saturation component in [0, 1].\n\n:type: float", (void *)1},
|
||||
{(char *)"v", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)"HSV Value component in [0, 1].\n\n:type: float", (void *)2},
|
||||
{(char *)"h", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_h_doc, (void *)0},
|
||||
{(char *)"s", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_s_doc, (void *)1},
|
||||
{(char *)"v", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_v_doc, (void *)2},
|
||||
|
||||
{(char *)"hsv", (getter)Color_hsv_get, (setter)Color_hsv_set, (char *)"HSV Values in [0, 1].\n\n:type: float triplet", (void *)0},
|
||||
{(char *)"hsv", (getter)Color_hsv_get, (setter)Color_hsv_set, (char *)Color_hsv_doc, (void *)0},
|
||||
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
|
||||
|
||||
@@ -134,7 +134,7 @@ PyDoc_STRVAR(Euler_to_quaternion_doc,
|
||||
" :return: Quaternion representation of the euler.\n"
|
||||
" :rtype: :class:`Quaternion`\n"
|
||||
);
|
||||
static PyObject *Euler_to_quaternion(EulerObject * self)
|
||||
static PyObject *Euler_to_quaternion(EulerObject *self)
|
||||
{
|
||||
float quat[4];
|
||||
|
||||
@@ -155,7 +155,7 @@ PyDoc_STRVAR(Euler_to_matrix_doc,
|
||||
" :return: A 3x3 roation matrix representation of the euler.\n"
|
||||
" :rtype: :class:`Matrix`\n"
|
||||
);
|
||||
static PyObject *Euler_to_matrix(EulerObject * self)
|
||||
static PyObject *Euler_to_matrix(EulerObject *self)
|
||||
{
|
||||
float mat[9];
|
||||
|
||||
@@ -172,7 +172,7 @@ PyDoc_STRVAR(Euler_zero_doc,
|
||||
"\n"
|
||||
" Set all values to zero.\n"
|
||||
);
|
||||
static PyObject *Euler_zero(EulerObject * self)
|
||||
static PyObject *Euler_zero(EulerObject *self)
|
||||
{
|
||||
zero_v3(self->eul);
|
||||
|
||||
@@ -193,7 +193,7 @@ PyDoc_STRVAR(Euler_rotate_axis_doc,
|
||||
" :arg angle: angle in radians.\n"
|
||||
" :type angle: float\n"
|
||||
);
|
||||
static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
|
||||
static PyObject *Euler_rotate_axis(EulerObject *self, PyObject *args)
|
||||
{
|
||||
float angle = 0.0f;
|
||||
int axis; /* actually a character */
|
||||
@@ -231,7 +231,7 @@ PyDoc_STRVAR(Euler_rotate_doc,
|
||||
" :arg other: rotation component of mathutils value\n"
|
||||
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
|
||||
);
|
||||
static PyObject *Euler_rotate(EulerObject * self, PyObject *value)
|
||||
static PyObject *Euler_rotate(EulerObject *self, PyObject *value)
|
||||
{
|
||||
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
|
||||
|
||||
@@ -258,7 +258,7 @@ PyDoc_STRVAR(Euler_make_compatible_doc,
|
||||
"\n"
|
||||
" .. note:: the rotation order is not taken into account for this function.\n"
|
||||
);
|
||||
static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value)
|
||||
static PyObject *Euler_make_compatible(EulerObject *self, PyObject *value)
|
||||
{
|
||||
float teul[EULER_SIZE];
|
||||
|
||||
@@ -303,7 +303,7 @@ static PyObject *Euler_copy(EulerObject *self)
|
||||
//----------------------------print object (internal)--------------
|
||||
//print the object to screen
|
||||
|
||||
static PyObject *Euler_repr(EulerObject * self)
|
||||
static PyObject *Euler_repr(EulerObject *self)
|
||||
{
|
||||
PyObject *ret, *tuple;
|
||||
|
||||
@@ -318,7 +318,7 @@ static PyObject *Euler_repr(EulerObject * self)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static PyObject *Euler_str(EulerObject * self)
|
||||
static PyObject *Euler_str(EulerObject *self)
|
||||
{
|
||||
DynStr *ds;
|
||||
|
||||
@@ -378,7 +378,7 @@ static int Euler_len(EulerObject *UNUSED(self))
|
||||
}
|
||||
//----------------------------object[]---------------------------
|
||||
//sequence accessor (get)
|
||||
static PyObject *Euler_item(EulerObject * self, int i)
|
||||
static PyObject *Euler_item(EulerObject *self, int i)
|
||||
{
|
||||
if (i < 0) i = EULER_SIZE - i;
|
||||
|
||||
@@ -397,7 +397,7 @@ static PyObject *Euler_item(EulerObject * self, int i)
|
||||
}
|
||||
//----------------------------object[]-------------------------
|
||||
//sequence accessor (set)
|
||||
static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
|
||||
static int Euler_ass_item(EulerObject *self, int i, PyObject *value)
|
||||
{
|
||||
float f = PyFloat_AsDouble(value);
|
||||
|
||||
@@ -426,7 +426,7 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
|
||||
}
|
||||
//----------------------------object[z:y]------------------------
|
||||
//sequence slice (get)
|
||||
static PyObject *Euler_slice(EulerObject * self, int begin, int end)
|
||||
static PyObject *Euler_slice(EulerObject *self, int begin, int end)
|
||||
{
|
||||
PyObject *tuple;
|
||||
int count;
|
||||
@@ -568,9 +568,11 @@ static PyMappingMethods Euler_AsMapping = {
|
||||
(objobjargproc)Euler_ass_subscript
|
||||
};
|
||||
|
||||
/*
|
||||
* euler axis, euler.x/y/z
|
||||
*/
|
||||
/* euler axis, euler.x/y/z */
|
||||
|
||||
PyDoc_STRVAR(Euler_axis_doc,
|
||||
"Euler axis angle in radians.\n\n:type: float"
|
||||
);
|
||||
static PyObject *Euler_axis_get(EulerObject *self, void *type)
|
||||
{
|
||||
return Euler_item(self, GET_INT_FROM_POINTER(type));
|
||||
@@ -582,6 +584,10 @@ static int Euler_axis_set(EulerObject *self, PyObject *value, void *type)
|
||||
}
|
||||
|
||||
/* rotation order */
|
||||
|
||||
PyDoc_STRVAR(Euler_order_doc,
|
||||
"Euler rotation order.\n\n:type: string in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']"
|
||||
);
|
||||
static PyObject *Euler_order_get(EulerObject *self, void *UNUSED(closure))
|
||||
{
|
||||
if (BaseMath_ReadCallback(self) == -1) /* can read order too */
|
||||
@@ -607,13 +613,13 @@ static int Euler_order_set(EulerObject *self, PyObject *value, void *UNUSED(clos
|
||||
/* Python attributes get/set structure: */
|
||||
/*****************************************************************************/
|
||||
static PyGetSetDef Euler_getseters[] = {
|
||||
{(char *)"x", (getter)Euler_axis_get, (setter)Euler_axis_set, (char *)"Euler X axis in radians.\n\n:type: float", (void *)0},
|
||||
{(char *)"y", (getter)Euler_axis_get, (setter)Euler_axis_set, (char *)"Euler Y axis in radians.\n\n:type: float", (void *)1},
|
||||
{(char *)"z", (getter)Euler_axis_get, (setter)Euler_axis_set, (char *)"Euler Z axis in radians.\n\n:type: float", (void *)2},
|
||||
{(char *)"order", (getter)Euler_order_get, (setter)Euler_order_set, (char *)"Euler rotation order.\n\n:type: string in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']", (void *)NULL},
|
||||
{(char *)"x", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)0},
|
||||
{(char *)"y", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)1},
|
||||
{(char *)"z", (getter)Euler_axis_get, (setter)Euler_axis_set, Euler_axis_doc, (void *)2},
|
||||
{(char *)"order", (getter)Euler_order_get, (setter)Euler_order_set, Euler_order_doc, (void *)NULL},
|
||||
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, (char *)BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, (char *)BaseMathObject_owner_doc, NULL},
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
@@ -1938,16 +1938,25 @@ static PyNumberMethods Matrix_NumMethods = {
|
||||
NULL, /* nb_index */
|
||||
};
|
||||
|
||||
PyDoc_STRVAR(Matrix_row_size_doc,
|
||||
"The row size of the matrix (readonly).\n\n:type: int"
|
||||
);
|
||||
static PyObject *Matrix_row_size_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
return PyLong_FromLong((long) self->num_col);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_col_size_doc,
|
||||
"The column size of the matrix (readonly).\n\n:type: int"
|
||||
);
|
||||
static PyObject *Matrix_col_size_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
return PyLong_FromLong((long) self->num_row);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_translation_doc,
|
||||
"The translation component of the matrix.\n\n:type: Vector"
|
||||
);
|
||||
static PyObject *Matrix_translation_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
PyObject *ret;
|
||||
@@ -1968,15 +1977,6 @@ static PyObject *Matrix_translation_get(MatrixObject *self, void *UNUSED(closure
|
||||
return ret;
|
||||
}
|
||||
|
||||
static PyObject *Matrix_row_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
return MatrixAccess_CreatePyObject(self, MAT_ACCESS_ROW);
|
||||
}
|
||||
static PyObject *Matrix_col_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
return MatrixAccess_CreatePyObject(self, MAT_ACCESS_COL);
|
||||
}
|
||||
|
||||
static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNUSED(closure))
|
||||
{
|
||||
float tvec[3];
|
||||
@@ -2002,6 +2002,25 @@ static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNU
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_row_doc,
|
||||
"Access the matix by rows (default), (readonly).\n\n:type: Matrix Access"
|
||||
);
|
||||
static PyObject *Matrix_row_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
return MatrixAccess_CreatePyObject(self, MAT_ACCESS_ROW);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_col_doc,
|
||||
"Access the matix by colums, 3x3 and 4x4 only, (readonly).\n\n:type: Matrix Access"
|
||||
);
|
||||
static PyObject *Matrix_col_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
return MatrixAccess_CreatePyObject(self, MAT_ACCESS_COL);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_median_scale_doc,
|
||||
"The average scale applied to each axis (readonly).\n\n:type: float"
|
||||
);
|
||||
static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
float mat[3][3];
|
||||
@@ -2022,6 +2041,9 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur
|
||||
return PyFloat_FromDouble(mat3_to_scale(mat));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_is_negative_doc,
|
||||
"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool"
|
||||
);
|
||||
static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
@@ -2040,6 +2062,9 @@ static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure
|
||||
}
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Matrix_is_orthogonal_doc,
|
||||
"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool"
|
||||
);
|
||||
static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closure))
|
||||
{
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
@@ -2062,17 +2087,16 @@ static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closu
|
||||
/* Python attributes get/set structure: */
|
||||
/*****************************************************************************/
|
||||
static PyGetSetDef Matrix_getseters[] = {
|
||||
{(char *)"row_size", (getter)Matrix_row_size_get, (setter)NULL, (char *)"The row size of the matrix (readonly).\n\n:type: int", NULL},
|
||||
{(char *)"col_size", (getter)Matrix_col_size_get, (setter)NULL, (char *)"The column size of the matrix (readonly).\n\n:type: int", NULL},
|
||||
{(char *)"median_scale", (getter)Matrix_median_scale_get, (setter)NULL, (char *)"The average scale applied to each axis (readonly).\n\n:type: float", NULL},
|
||||
{(char *)"translation", (getter)Matrix_translation_get, (setter)Matrix_translation_set, (char *)"The translation component of the matrix.\n\n:type: Vector", NULL},
|
||||
/* MatrixAccess_CreatePyObject*/
|
||||
{(char *)"row", (getter)Matrix_row_get, (setter)NULL, (char *)"Access the matix by rows (default), (readonly).\n\n:type: Matrix Access", NULL},
|
||||
{(char *)"col", (getter)Matrix_col_get, (setter)NULL, (char *)"Access the matix by colums, 3x3 and 4x4 only, (readonly).\n\n:type: Matrix Access", NULL},
|
||||
{(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
|
||||
{(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, (char *)"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, (char *)BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner",(getter)BaseMathObject_owner_get, (setter)NULL, (char *)BaseMathObject_owner_doc, NULL},
|
||||
{(char *)"row_size", (getter)Matrix_row_size_get, (setter)NULL, Matrix_row_size_doc, NULL},
|
||||
{(char *)"col_size", (getter)Matrix_col_size_get, (setter)NULL, Matrix_col_size_doc, NULL},
|
||||
{(char *)"median_scale", (getter)Matrix_median_scale_get, (setter)NULL, Matrix_median_scale_doc, NULL},
|
||||
{(char *)"translation", (getter)Matrix_translation_get, (setter)Matrix_translation_set, Matrix_translation_doc, NULL},
|
||||
{(char *)"row", (getter)Matrix_row_get, (setter)NULL, Matrix_row_doc, NULL},
|
||||
{(char *)"col", (getter)Matrix_col_get, (setter)NULL, Matrix_col_doc, NULL},
|
||||
{(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, Matrix_is_negative_doc, NULL},
|
||||
{(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, Matrix_is_orthogonal_doc, NULL},
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner",(getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
@@ -922,6 +922,9 @@ static PyNumberMethods Quaternion_NumMethods = {
|
||||
NULL, /* nb_index */
|
||||
};
|
||||
|
||||
PyDoc_STRVAR(Quaternion_axis_doc,
|
||||
"Quaternion axis value.\n\n:type: float"
|
||||
);
|
||||
static PyObject *Quaternion_axis_get(QuaternionObject *self, void *type)
|
||||
{
|
||||
return Quaternion_item(self, GET_INT_FROM_POINTER(type));
|
||||
@@ -932,6 +935,9 @@ static int Quaternion_axis_set(QuaternionObject *self, PyObject *value, void *ty
|
||||
return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Quaternion_magnitude_doc,
|
||||
"Size of the quaternion (readonly).\n\n:type: float"
|
||||
);
|
||||
static PyObject *Quaternion_magnitude_get(QuaternionObject *self, void *UNUSED(closure))
|
||||
{
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
@@ -940,6 +946,9 @@ static PyObject *Quaternion_magnitude_get(QuaternionObject *self, void *UNUSED(c
|
||||
return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat)));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Quaternion_angle_doc,
|
||||
"Angle of the quaternion.\n\n:type: float"
|
||||
);
|
||||
static PyObject *Quaternion_angle_get(QuaternionObject *self, void *UNUSED(closure))
|
||||
{
|
||||
float tquat[4];
|
||||
@@ -992,6 +1001,9 @@ static int Quaternion_angle_set(QuaternionObject *self, PyObject *value, void *U
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Quaternion_axis_vector_doc,
|
||||
"Quaternion axis as a vector.\n\n:type: :class:`Vector`"
|
||||
);
|
||||
static PyObject *Quaternion_axis_vector_get(QuaternionObject *self, void *UNUSED(closure))
|
||||
{
|
||||
float tquat[4];
|
||||
@@ -1151,15 +1163,15 @@ static struct PyMethodDef Quaternion_methods[] = {
|
||||
/* Python attributes get/set structure: */
|
||||
/*****************************************************************************/
|
||||
static PyGetSetDef Quaternion_getseters[] = {
|
||||
{(char *)"w", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, (char *)"Quaternion W value.\n\n:type: float", (void *)0},
|
||||
{(char *)"x", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, (char *)"Quaternion X axis.\n\n:type: float", (void *)1},
|
||||
{(char *)"y", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, (char *)"Quaternion Y axis.\n\n:type: float", (void *)2},
|
||||
{(char *)"z", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, (char *)"Quaternion Z axis.\n\n:type: float", (void *)3},
|
||||
{(char *)"magnitude", (getter)Quaternion_magnitude_get, (setter)NULL, (char *)"Size of the quaternion (readonly).\n\n:type: float", NULL},
|
||||
{(char *)"angle", (getter)Quaternion_angle_get, (setter)Quaternion_angle_set, (char *)"angle of the quaternion.\n\n:type: float", NULL},
|
||||
{(char *)"axis",(getter)Quaternion_axis_vector_get, (setter)Quaternion_axis_vector_set, (char *)"quaternion axis as a vector.\n\n:type: :class:`Vector`", NULL},
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, (char *)BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, (char *)BaseMathObject_owner_doc, NULL},
|
||||
{(char *)"w", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)0},
|
||||
{(char *)"x", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)1},
|
||||
{(char *)"y", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)2},
|
||||
{(char *)"z", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)3},
|
||||
{(char *)"magnitude", (getter)Quaternion_magnitude_get, (setter)NULL, Quaternion_magnitude_doc, NULL},
|
||||
{(char *)"angle", (getter)Quaternion_angle_get, (setter)Quaternion_angle_set, Quaternion_angle_doc, NULL},
|
||||
{(char *)"axis",(getter)Quaternion_axis_vector_get, (setter)Quaternion_axis_vector_set, Quaternion_axis_vector_doc, NULL},
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
@@ -174,8 +174,8 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
|
||||
case 2:
|
||||
if (start >= stop) {
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"Start value is larger"
|
||||
"than the stop value");
|
||||
"Start value is larger"
|
||||
"than the stop value");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,8 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
|
||||
default:
|
||||
if (start >= stop) {
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"Start value is larger"
|
||||
"than the stop value");
|
||||
"Start value is larger"
|
||||
"than the stop value");
|
||||
return NULL;
|
||||
}
|
||||
size = (stop - start)/step;
|
||||
@@ -198,7 +198,7 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
|
||||
|
||||
if (vec == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError,
|
||||
"Vector.Range(): "
|
||||
"Vector.Range(): "
|
||||
"problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ static PyObject *C_Vector_Linspace(PyObject *cls, PyObject *args)
|
||||
|
||||
if (vec == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError,
|
||||
"Vector.Linspace(): "
|
||||
"Vector.Linspace(): "
|
||||
"problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ static PyObject *C_Vector_Repeat(PyObject *cls, PyObject *args)
|
||||
|
||||
if (iter_vec == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError,
|
||||
"Vector.Repeat(): "
|
||||
"Vector.Repeat(): "
|
||||
"problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ static PyObject *C_Vector_Repeat(PyObject *cls, PyObject *args)
|
||||
|
||||
if (vec == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError,
|
||||
"Vector.Repeat(): "
|
||||
"Vector.Repeat(): "
|
||||
"problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
@@ -445,7 +445,7 @@ static PyObject *Vector_resized(VectorObject *self, PyObject *value)
|
||||
|
||||
if (vec == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError,
|
||||
"Vector.resized(): "
|
||||
"Vector.resized(): "
|
||||
"problem allocating pointer space");
|
||||
return NULL;
|
||||
}
|
||||
@@ -2023,9 +2023,12 @@ static PyNumberMethods Vector_NumMethods = {
|
||||
|
||||
/*------------------PY_OBECT DEFINITION--------------------------*/
|
||||
|
||||
/*
|
||||
* vector axis, vector.x/y/z/w
|
||||
*/
|
||||
/* vector axis, vector.x/y/z/w */
|
||||
|
||||
PyDoc_STRVAR(Vector_axis_x_doc, "Vector X axis.\n\n:type: float");
|
||||
PyDoc_STRVAR(Vector_axis_y_doc, "Vector Y axis.\n\n:type: float");
|
||||
PyDoc_STRVAR(Vector_axis_z_doc, "Vector Z axis (3D Vectors only).\n\n:type: float");
|
||||
PyDoc_STRVAR(Vector_axis_w_doc, "Vector W axis (4D Vectors only).\n\n:type: float");
|
||||
|
||||
static PyObject *Vector_axis_get(VectorObject *self, void *type)
|
||||
{
|
||||
@@ -2038,6 +2041,10 @@ static int Vector_axis_set(VectorObject *self, PyObject *value, void *type)
|
||||
}
|
||||
|
||||
/* vector.length */
|
||||
|
||||
PyDoc_STRVAR(Vector_length_doc,
|
||||
"Vector Length.\n\n:type: float"
|
||||
);
|
||||
static PyObject *Vector_length_get(VectorObject *self, void *UNUSED(closure))
|
||||
{
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
@@ -2089,6 +2096,9 @@ static int Vector_length_set(VectorObject *self, PyObject *value)
|
||||
}
|
||||
|
||||
/* vector.length_squared */
|
||||
PyDoc_STRVAR(Vector_length_squared_doc,
|
||||
"Vector length squared (v.dot(v)).\n\n:type: float"
|
||||
);
|
||||
static PyObject *Vector_length_squared_get(VectorObject *self, void *UNUSED(closure))
|
||||
{
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
@@ -2098,8 +2108,8 @@ static PyObject *Vector_length_squared_get(VectorObject *self, void *UNUSED(clos
|
||||
}
|
||||
|
||||
/* Get a new Vector according to the provided swizzle. This function has little
|
||||
error checking, as we are in control of the inputs: the closure is set by us
|
||||
in Vector_createSwizzleGetSeter. */
|
||||
* error checking, as we are in control of the inputs: the closure is set by us
|
||||
* in Vector_createSwizzleGetSeter. */
|
||||
static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
|
||||
{
|
||||
size_t axis_to;
|
||||
@@ -2113,8 +2123,7 @@ static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
|
||||
/* Unpack the axes from the closure into an array. */
|
||||
axis_to = 0;
|
||||
swizzleClosure = GET_INT_FROM_POINTER(closure);
|
||||
while (swizzleClosure & SWIZZLE_VALID_AXIS)
|
||||
{
|
||||
while (swizzleClosure & SWIZZLE_VALID_AXIS) {
|
||||
axis_from = swizzleClosure & SWIZZLE_AXIS;
|
||||
if (axis_from >= self->size) {
|
||||
PyErr_SetString(PyExc_AttributeError,
|
||||
@@ -2132,15 +2141,15 @@ static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
|
||||
}
|
||||
|
||||
/* Set the items of this vector using a swizzle.
|
||||
- If value is a vector or list this operates like an array copy, except that
|
||||
the destination is effectively re-ordered as defined by the swizzle. At
|
||||
most min(len(source), len(dest)) values will be copied.
|
||||
- If the value is scalar, it is copied to all axes listed in the swizzle.
|
||||
- If an axis appears more than once in the swizzle, the final occurrence is
|
||||
the one that determines its value.
|
||||
* - If value is a vector or list this operates like an array copy, except that
|
||||
* the destination is effectively re-ordered as defined by the swizzle. At
|
||||
* most min(len(source), len(dest)) values will be copied.
|
||||
* - If the value is scalar, it is copied to all axes listed in the swizzle.
|
||||
* - If an axis appears more than once in the swizzle, the final occurrence is
|
||||
* the one that determines its value.
|
||||
|
||||
Returns 0 on success and -1 on failure. On failure, the vector will be
|
||||
unchanged. */
|
||||
* Returns 0 on success and -1 on failure. On failure, the vector will be
|
||||
* unchanged. */
|
||||
static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure)
|
||||
{
|
||||
size_t size_from;
|
||||
@@ -2158,13 +2167,13 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
return -1;
|
||||
|
||||
/* Check that the closure can be used with this vector: even 2D vectors have
|
||||
swizzles defined for axes z and w, but they would be invalid. */
|
||||
* swizzles defined for axes z and w, but they would be invalid. */
|
||||
swizzleClosure = GET_INT_FROM_POINTER(closure);
|
||||
axis_from = 0;
|
||||
|
||||
while (swizzleClosure & SWIZZLE_VALID_AXIS) {
|
||||
axis_to = swizzleClosure & SWIZZLE_AXIS;
|
||||
if (axis_to >= self->size)
|
||||
{
|
||||
if (axis_to >= self->size) {
|
||||
PyErr_SetString(PyExc_AttributeError,
|
||||
"Vector swizzle: "
|
||||
"specified axis not present");
|
||||
@@ -2176,8 +2185,10 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
|
||||
if (((scalarVal = PyFloat_AsDouble(value)) == -1 && PyErr_Occurred()) == 0) {
|
||||
int i;
|
||||
for (i = 0; i < MAX_DIMENSIONS; i++)
|
||||
|
||||
for (i = 0; i < MAX_DIMENSIONS; i++) {
|
||||
vec_assign[i] = scalarVal;
|
||||
}
|
||||
|
||||
size_from = axis_from;
|
||||
}
|
||||
@@ -2197,8 +2208,8 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
/* Copy vector contents onto swizzled axes. */
|
||||
axis_from = 0;
|
||||
swizzleClosure = GET_INT_FROM_POINTER(closure);
|
||||
while (swizzleClosure & SWIZZLE_VALID_AXIS)
|
||||
{
|
||||
|
||||
while (swizzleClosure & SWIZZLE_VALID_AXIS) {
|
||||
axis_to = swizzleClosure & SWIZZLE_AXIS;
|
||||
tvec[axis_to] = vec_assign[axis_from];
|
||||
swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS;
|
||||
@@ -2218,15 +2229,15 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
/* Python attributes get/set structure: */
|
||||
/*****************************************************************************/
|
||||
static PyGetSetDef Vector_getseters[] = {
|
||||
{(char *)"x", (getter)Vector_axis_get, (setter)Vector_axis_set, (char *)"Vector X axis.\n\n:type: float", (void *)0},
|
||||
{(char *)"y", (getter)Vector_axis_get, (setter)Vector_axis_set, (char *)"Vector Y axis.\n\n:type: float", (void *)1},
|
||||
{(char *)"z", (getter)Vector_axis_get, (setter)Vector_axis_set, (char *)"Vector Z axis (3D Vectors only).\n\n:type: float", (void *)2},
|
||||
{(char *)"w", (getter)Vector_axis_get, (setter)Vector_axis_set, (char *)"Vector W axis (4D Vectors only).\n\n:type: float", (void *)3},
|
||||
{(char *)"length", (getter)Vector_length_get, (setter)Vector_length_set, (char *)"Vector Length.\n\n:type: float", NULL},
|
||||
{(char *)"length_squared", (getter)Vector_length_squared_get, (setter)NULL, (char *)"Vector length squared (v.dot(v)).\n\n:type: float", NULL},
|
||||
{(char *)"magnitude", (getter)Vector_length_get, (setter)Vector_length_set, (char *)"Vector Length.\n\n:type: float", NULL},
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, (char *)BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, (char *)BaseMathObject_owner_doc, NULL},
|
||||
{(char *)"x", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_x_doc, (void *)0},
|
||||
{(char *)"y", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_y_doc, (void *)1},
|
||||
{(char *)"z", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_z_doc, (void *)2},
|
||||
{(char *)"w", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_w_doc, (void *)3},
|
||||
{(char *)"length", (getter)Vector_length_get, (setter)Vector_length_set, Vector_length_doc, NULL},
|
||||
{(char *)"length_squared", (getter)Vector_length_squared_get, (setter)NULL, Vector_length_squared_doc, NULL},
|
||||
{(char *)"magnitude", (getter)Vector_length_get, (setter)Vector_length_set, Vector_length_doc, NULL},
|
||||
{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
|
||||
{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
|
||||
|
||||
/* autogenerated swizzle attrs, see python script below */
|
||||
{(char *)"xx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 36
|
||||
@@ -2582,15 +2593,15 @@ while len(axises) >= 2:
|
||||
axis_0_pos = axis_pos[axis_0]
|
||||
for axis_1 in axises:
|
||||
axis_1_pos = axis_pos[axis_1]
|
||||
axis_dict[axis_0+axis_1] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS))' % (axis_0_pos, axis_1_pos)
|
||||
axis_dict[axis_0 + axis_1] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS))' % (axis_0_pos, axis_1_pos)
|
||||
if len(axises)>2:
|
||||
for axis_2 in axises:
|
||||
axis_2_pos = axis_pos[axis_2]
|
||||
axis_dict[axis_0+axis_1+axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
|
||||
axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
|
||||
if len(axises)>3:
|
||||
for axis_3 in axises:
|
||||
axis_3_pos = axis_pos[axis_3]
|
||||
axis_dict[axis_0+axis_1+axis_2+axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
|
||||
axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3))) ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
|
||||
|
||||
axises = axises[:-1]
|
||||
|
||||
@@ -2617,7 +2628,6 @@ if len(unique) != len(items):
|
||||
static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat)
|
||||
{
|
||||
float vec_cpy[MAX_DIMENSIONS];
|
||||
double dot = 0.0f;
|
||||
int row, col, z = 0, vec_size = vec->size;
|
||||
|
||||
if (mat->num_row != vec_size) {
|
||||
@@ -2640,11 +2650,11 @@ static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *v
|
||||
rvec[3] = 1.0f;
|
||||
//muliplication
|
||||
for (col = 0; col < mat->num_col; col++) {
|
||||
double dot = 0.0;
|
||||
for (row = 0; row < mat->num_row; row++) {
|
||||
dot += MATRIX_ITEM(mat, row, col) * vec_cpy[row];
|
||||
}
|
||||
rvec[z++] = (float)dot;
|
||||
dot = 0.0f;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1052,7 +1052,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
|
||||
|
||||
len_polylines = PySequence_Size(polyLineSeq);
|
||||
|
||||
for (i = 0; i < len_polylines; ++i) {
|
||||
for (i = 0; i < len_polylines; i++) {
|
||||
polyLine = PySequence_GetItem(polyLineSeq, i);
|
||||
if (!PySequence_Check(polyLine)) {
|
||||
freedisplist(&dispbase);
|
||||
@@ -1083,7 +1083,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
|
||||
dl->verts = fp = MEM_callocN(sizeof(float) * 3 * len_polypoints, "dl verts");
|
||||
dl->index = MEM_callocN(sizeof(int) * 3 * len_polypoints, "dl index");
|
||||
|
||||
for (index = 0; index < len_polypoints; ++index, fp += 3) {
|
||||
for (index = 0; index < len_polypoints; index++, fp += 3) {
|
||||
polyVec = PySequence_GetItem(polyLine, index);
|
||||
if (VectorObject_Check(polyVec)) {
|
||||
|
||||
@@ -1210,7 +1210,7 @@ static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray)
|
||||
len = PyList_GET_SIZE(value);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
box = (*boxarray)+i;
|
||||
box = (*boxarray) + i;
|
||||
list_item = PyList_GET_ITEM(value, box->index);
|
||||
PyList_SET_ITEM(list_item, 0, PyFloat_FromDouble(box->x));
|
||||
PyList_SET_ITEM(list_item, 1, PyFloat_FromDouble(box->y));
|
||||
|
||||
Reference in New Issue
Block a user