with bpy.data.libraries.load(filepath) as (data_from, data_to):
data_to.meshes = data_from.meshes
# now operate directly on the loaded data
-for mesh in mdata_to.meshes:
+for mesh in data_to.meshes:
if mesh is not None:
print(mesh.name)
#include "BLI_utildefines.h"
-static char Method_Buffer_doc[] =
+PyDoc_STRVAR(Method_Buffer_doc,
"(type, dimensions, [template]) - Create a new Buffer object\n\n\
(type) - The format to store data in\n\
(dimensions) - An int or sequence specifying the dimensions of the buffer\n\
is determined by the value in the sequence at that index.\n\n\
For example, passing [100, 100] will create a 2 dimensional\n\
square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
-buffer which is twice as deep as it is wide or high.";
+buffer which is twice as deep as it is wide or high."
+);
static PyObject *Method_Buffer( PyObject * self, PyObject *args );
-static char py_blf_position_doc[] =
+PyDoc_STRVAR(py_blf_position_doc,
".. function:: position(fontid, x, y, z)\n"
"\n"
" Set the position for drawing text.\n"
" :arg y: Y axis position to draw the text.\n"
" :type y: float\n"
" :arg z: Z axis position to draw the text.\n"
-" :type z: float\n";
+" :type z: float\n"
+);
static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args)
{
}
-static char py_blf_size_doc[] =
+PyDoc_STRVAR(py_blf_size_doc,
".. function:: size(fontid, size, dpi)\n"
"\n"
" Set the size and dpi for drawing text.\n"
" :arg size: Point size of the font.\n"
" :type size: int\n"
" :arg dpi: dots per inch value to use for drawing.\n"
-" :type dpi: int\n";
-
+" :type dpi: int\n"
+);
static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args)
{
int fontid, size, dpi;
}
-static char py_blf_aspect_doc[] =
+PyDoc_STRVAR(py_blf_aspect_doc,
".. function:: aspect(fontid, aspect)\n"
"\n"
" Set the aspect for drawing text.\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg aspect: The aspect ratio for text drawing to use.\n"
-" :type aspect: float\n";
-
+" :type aspect: float\n"
+);
static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
{
float aspect;
}
-static char py_blf_blur_doc[] =
+PyDoc_STRVAR(py_blf_blur_doc,
".. function:: blur(fontid, radius)\n"
"\n"
" Set the blur radius for drawing text.\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg radius: The radius for blurring text (in pixels).\n"
-" :type radius: int\n";
-
+" :type radius: int\n"
+);
static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args)
{
int blur, fontid;
}
-static char py_blf_draw_doc[] =
+PyDoc_STRVAR(py_blf_draw_doc,
".. function:: draw(fontid, text)\n"
"\n"
" Draw text in the current context.\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg text: the text to draw.\n"
-" :type text: string\n";
-
+" :type text: string\n"
+);
static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
{
char *text;
Py_RETURN_NONE;
}
-static char py_blf_dimensions_doc[] =
+PyDoc_STRVAR(py_blf_dimensions_doc,
".. function:: dimensions(fontid, text)\n"
"\n"
" Return the width and height of the text.\n"
" :arg text: the text to draw.\n"
" :type text: string\n"
" :return: the width and height of the text.\n"
-" :rtype: tuple of 2 floats\n";
-
+" :rtype: tuple of 2 floats\n"
+);
static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
{
char *text;
return ret;
}
-static char py_blf_clipping_doc[] =
+PyDoc_STRVAR(py_blf_clipping_doc,
".. function:: clipping(fontid, xmin, ymin, xmax, ymax)\n"
"\n"
" Set the clipping, enable/disable using CLIPPING.\n"
" :arg xmax: Clip the drawing area by these bounds.\n"
" :type xmax: float\n"
" :arg ymax: Clip the drawing area by these bounds.\n"
-" :type ymax: float\n";
-
+" :type ymax: float\n"
+);
static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args)
{
float xmin, ymin, xmax, ymax;
Py_RETURN_NONE;
}
-static char py_blf_disable_doc[] =
+PyDoc_STRVAR(py_blf_disable_doc,
".. function:: disable(fontid, option)\n"
"\n"
" Disable option.\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
-" :type option: int\n";
-
+" :type option: int\n"
+);
static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args)
{
int option, fontid;
Py_RETURN_NONE;
}
-static char py_blf_enable_doc[] =
+PyDoc_STRVAR(py_blf_enable_doc,
".. function:: enable(fontid, option)\n"
"\n"
" Enable option.\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
-" :type option: int\n";
-
+" :type option: int\n"
+);
static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args)
{
int option, fontid;
Py_RETURN_NONE;
}
-static char py_blf_rotation_doc[] =
+PyDoc_STRVAR(py_blf_rotation_doc,
".. function:: rotation(fontid, angle)\n"
"\n"
" Set the text rotation angle, enable/disable using ROTATION.\n"
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg angle: The angle for text drawing to use.\n"
-" :type angle: float\n";
-
+" :type angle: float\n"
+);
static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
{
float angle;
Py_RETURN_NONE;
}
-static char py_blf_shadow_doc[] =
+PyDoc_STRVAR(py_blf_shadow_doc,
".. function:: shadow(fontid, level, r, g, b, a)\n"
"\n"
" Shadow options, enable/disable using SHADOW .\n"
" :arg b: Shadow color (blue channel 0.0 - 1.0).\n"
" :type b: float\n"
" :arg a: Shadow color (alpha channel 0.0 - 1.0).\n"
-" :type a: float\n";
-
+" :type a: float\n"
+);
static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
{
int level, fontid;
Py_RETURN_NONE;
}
-static char py_blf_shadow_offset_doc[] =
+PyDoc_STRVAR(py_blf_shadow_offset_doc,
".. function:: shadow_offset(fontid, x, y)\n"
"\n"
" Set the offset for shadow text.\n"
" :arg x: Vertical shadow offset value in pixels.\n"
" :type x: float\n"
" :arg y: Horizontal shadow offset value in pixels.\n"
-" :type y: float\n";
-
+" :type y: float\n"
+);
static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args)
{
int x, y, fontid;
Py_RETURN_NONE;
}
-static char py_blf_load_doc[] =
+PyDoc_STRVAR(py_blf_load_doc,
".. function:: load(filename)\n"
"\n"
" Load a new font.\n"
" :arg filename: the filename of the font.\n"
" :type filename: string\n"
" :return: the new font's fontid or -1 if there was an error.\n"
-" :rtype: integer\n";
-
+" :rtype: integer\n"
+);
static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
{
char* filename;
{NULL, NULL, 0, NULL}
};
-static char BLF_doc[] =
-"This module provides access to blenders text drawing functions.\n";
-
+PyDoc_STRVAR(BLF_doc,
+"This module provides access to blenders text drawing functions."
+);
static struct PyModuleDef BLF_module_def = {
PyModuleDef_HEAD_INIT,
"blf", /* m_name */
#include "BLI_math.h"
#include "BLI_utildefines.h"
-static char M_Mathutils_doc[] =
+PyDoc_STRVAR(M_Mathutils_doc,
"This module provides access to matrices, eulers, quaternions and vectors."
-;
+);
static int mathutils_array_parse_fast(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
{
PyObject *value_fast= NULL;
return ret;
}
-static char Color_copy_doc[] =
+PyDoc_STRVAR(Color_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this color.\n"
" :rtype: :class:`Color`\n"
"\n"
" .. note:: use this to get a copy of a wrapped color with no reference to the original data.\n"
-;
+);
static PyObject *Color_copy(ColorObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
};
//------------------PY_OBECT DEFINITION--------------------------
-static char color_doc[] =
+PyDoc_STRVAR(color_doc,
"This object gives access to Colors in Blender."
-;
+);
PyTypeObject color_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"mathutils.Color", //tp_name
//-----------------------------METHODS----------------------------
//return a quaternion representation of the euler
-static char Euler_to_quaternion_doc[] =
+PyDoc_STRVAR(Euler_to_quaternion_doc,
".. method:: to_quaternion()\n"
"\n"
" Return a quaternion representation of the euler.\n"
"\n"
" :return: Quaternion representation of the euler.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Euler_to_quaternion(EulerObject * self)
{
float quat[4];
}
//return a matrix representation of the euler
-static char Euler_to_matrix_doc[] =
+PyDoc_STRVAR(Euler_to_matrix_doc,
".. method:: to_matrix()\n"
"\n"
" Return a matrix representation of the euler.\n"
"\n"
" :return: A 3x3 roation matrix representation of the euler.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Euler_to_matrix(EulerObject * self)
{
float mat[9];
return newMatrixObject(mat, 3, 3 , Py_NEW, NULL);
}
-//sets the euler to 0,0,0
-static char Euler_zero_doc[] =
+PyDoc_STRVAR(Euler_zero_doc,
".. method:: zero()\n"
"\n"
" Set all values to zero.\n"
-;
+);
static PyObject *Euler_zero(EulerObject * self)
{
zero_v3(self->eul);
Py_RETURN_NONE;
}
-static char Euler_rotate_axis_doc[] =
+PyDoc_STRVAR(Euler_rotate_axis_doc,
".. method:: rotate_axis(axis, angle)\n"
"\n"
" Rotates the euler a certain amount and returning a unique euler rotation (no 720 degree pitches).\n"
" :type axis: string\n"
" :arg angle: angle in radians.\n"
" :type angle: float\n"
-;
+);
static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
{
float angle = 0.0f;
Py_RETURN_NONE;
}
-static char Euler_rotate_doc[] =
+PyDoc_STRVAR(Euler_rotate_doc,
".. method:: rotate(other)\n"
"\n"
" Rotates the euler a by another mathutils value.\n"
"\n"
" :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)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
Py_RETURN_NONE;
}
-static char Euler_make_compatible_doc[] =
+PyDoc_STRVAR(Euler_make_compatible_doc,
".. method:: make_compatible(other)\n"
"\n"
" Make this euler compatible with another, so interpolating between them works as intended.\n"
"\n"
" .. note:: the rotation order is not taken into account for this function.\n"
-;
+);
static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value)
{
float teul[EULER_SIZE];
//----------------------------Euler.rotate()-----------------------
// return a copy of the euler
-static char Euler_copy_doc[] =
+PyDoc_STRVAR(Euler_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this euler.\n"
" :rtype: :class:`Euler`\n"
"\n"
" .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n"
-;
+);
static PyObject *Euler_copy(EulerObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
};
//------------------PY_OBECT DEFINITION--------------------------
-static char euler_doc[] =
+PyDoc_STRVAR(euler_doc,
"This object gives access to Eulers in Blender."
-;
+);
PyTypeObject euler_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"mathutils.Euler", //tp_name
/*-----------------------CLASS-METHODS----------------------------*/
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
-static char C_Matrix_Rotation_doc[] =
+PyDoc_STRVAR(C_Matrix_Rotation_doc,
".. classmethod:: Rotation(angle, size, axis)\n"
"\n"
" Create a matrix representing a rotation.\n"
" :type axis: string or :class:`Vector`\n"
" :return: A new rotation matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
{
PyObject *vec= NULL;
}
-static char C_Matrix_Translation_doc[] =
+PyDoc_STRVAR(C_Matrix_Translation_doc,
".. classmethod:: Translation(vector)\n"
"\n"
" Create a matrix representing a translation.\n"
" :type vector: :class:`Vector`\n"
" :return: An identity matrix with a translation.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
{
float mat[16], tvec[3];
}
//----------------------------------mathutils.Matrix.Scale() -------------
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
-static char C_Matrix_Scale_doc[] =
+PyDoc_STRVAR(C_Matrix_Scale_doc,
".. classmethod:: Scale(factor, size, axis)\n"
"\n"
" Create a matrix representing a scaling.\n"
" :type axis: :class:`Vector`\n"
" :return: A new scale matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
{
PyObject *vec= NULL;
}
//----------------------------------mathutils.Matrix.OrthoProjection() ---
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
-static char C_Matrix_OrthoProjection_doc[] =
+PyDoc_STRVAR(C_Matrix_OrthoProjection_doc,
".. classmethod:: OrthoProjection(axis, size)\n"
"\n"
" Create a matrix to represent an orthographic projection.\n"
" :type size: int\n"
" :return: A new projection matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
{
PyObject *axis;
return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
}
-static char C_Matrix_Shear_doc[] =
+PyDoc_STRVAR(C_Matrix_Shear_doc,
".. classmethod:: Shear(plane, size, factor)\n"
"\n"
" Create a matrix to represent an shear transformation.\n"
" :type factor: float or float pair\n"
" :return: A new shear matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
{
int matSize;
/*-----------------------------METHODS----------------------------*/
-static char Matrix_to_quaternion_doc[] =
+PyDoc_STRVAR(Matrix_to_quaternion_doc,
".. method:: to_quaternion()\n"
"\n"
" Return a quaternion representation of the rotation matrix.\n"
"\n"
" :return: Quaternion representation of the rotation matrix.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Matrix_to_quaternion(MatrixObject *self)
{
float quat[4];
}
/*---------------------------Matrix.toEuler() --------------------*/
-static char Matrix_to_euler_doc[] =
+PyDoc_STRVAR(Matrix_to_euler_doc,
".. method:: to_euler(order, euler_compat)\n"
"\n"
" Return an Euler representation of the rotation matrix (3x3 or 4x4 matrix only).\n"
" :type euler_compat: :class:`Euler`\n"
" :return: Euler representation of the matrix.\n"
" :rtype: :class:`Euler`\n"
-;
+);
static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
{
const char *order_str= NULL;
return newEulerObject(eul, order, Py_NEW, NULL);
}
-static char Matrix_resize_4x4_doc[] =
+PyDoc_STRVAR(Matrix_resize_4x4_doc,
".. method:: resize_4x4()\n"
"\n"
" Resize the matrix to 4x4.\n"
-;
+);
static PyObject *Matrix_resize_4x4(MatrixObject *self)
{
int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index;
Py_RETURN_NONE;
}
-static char Matrix_to_4x4_doc[] =
+PyDoc_STRVAR(Matrix_to_4x4_doc,
".. method:: to_4x4()\n"
"\n"
" Return a 4x4 copy of this matrix.\n"
"\n"
" :return: a new matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_to_4x4(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
return NULL;
}
-static char Matrix_to_3x3_doc[] =
+PyDoc_STRVAR(Matrix_to_3x3_doc,
".. method:: to_3x3()\n"
"\n"
" Return a 3x3 copy of this matrix.\n"
"\n"
" :return: a new matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_to_3x3(MatrixObject *self)
{
float mat[3][3];
return newMatrixObject((float *)mat, 3, 3, Py_NEW, Py_TYPE(self));
}
-static char Matrix_to_translation_doc[] =
+PyDoc_STRVAR(Matrix_to_translation_doc,
".. method:: to_translation()\n"
"\n"
" Return a the translation part of a 4 row matrix.\n"
"\n"
" :return: Return a the translation of a matrix.\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Matrix_to_translation(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
return newVectorObject(self->matrix[3], 3, Py_NEW, NULL);
}
-static char Matrix_to_scale_doc[] =
+PyDoc_STRVAR(Matrix_to_scale_doc,
".. method:: to_scale()\n"
"\n"
" Return a the scale part of a 3x3 or 4x4 matrix.\n"
" :rtype: :class:`Vector`\n"
"\n"
" .. note:: This method does not return negative a scale on any axis because it is not possible to obtain this data from the matrix alone.\n"
-;
+);
static PyObject *Matrix_to_scale(MatrixObject *self)
{
float rot[3][3];
}
/*---------------------------Matrix.invert() ---------------------*/
-static char Matrix_invert_doc[] =
+PyDoc_STRVAR(Matrix_invert_doc,
".. method:: invert()\n"
"\n"
" Set the matrix to its inverse.\n"
" .. note:: :exc:`ValueError` exception is raised.\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Inverse_matrix>\n"
-;
+);
static PyObject *Matrix_invert(MatrixObject *self)
{
Py_RETURN_NONE;
}
-static char Matrix_inverted_doc[] =
+PyDoc_STRVAR(Matrix_inverted_doc,
".. method:: inverted()\n"
"\n"
" Return an inverted copy of the matrix.\n"
" :rtype: :class:`Matrix`\n"
"\n"
" .. note:: :exc:`ValueError` exception is raised.\n"
-;
+);
static PyObject *Matrix_inverted(MatrixObject *self)
{
return matrix__apply_to_copy((PyNoArgsFunction)Matrix_invert, self);
}
-static char Matrix_rotate_doc[] =
+PyDoc_STRVAR(Matrix_rotate_doc,
".. method:: rotate(other)\n"
"\n"
" Rotates the matrix a by another mathutils value.\n"
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
"\n"
" .. note:: If any of the columns are not unit length this may not have desired results.\n"
-;
+);
static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
}
/*---------------------------Matrix.decompose() ---------------------*/
-static char Matrix_decompose_doc[] =
+PyDoc_STRVAR(Matrix_decompose_doc,
".. method:: decompose()\n"
"\n"
" Return the location, rotaion and scale components of this matrix.\n"
"\n"
" :return: loc, rot, scale triple.\n"
" :rtype: (:class:`Vector`, :class:`Quaternion`, :class:`Vector`)"
-;
+);
static PyObject *Matrix_decompose(MatrixObject *self)
{
PyObject *ret;
-static char Matrix_lerp_doc[] =
+PyDoc_STRVAR(Matrix_lerp_doc,
".. function:: lerp(other, factor)\n"
"\n"
" Returns the interpolation of two matricies.\n"
" :type factor: float\n"
" :return: The interpolated rotation.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
{
MatrixObject *mat2 = NULL;
}
/*---------------------------Matrix.determinant() ----------------*/
-static char Matrix_determinant_doc[] =
+PyDoc_STRVAR(Matrix_determinant_doc,
".. method:: determinant()\n"
"\n"
" Return the determinant of a matrix.\n"
" :rtype: float\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Determinant>\n"
-;
+);
static PyObject *Matrix_determinant(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
return PyFloat_FromDouble((double)matrix_determinant_internal(self));
}
/*---------------------------Matrix.transpose() ------------------*/
-static char Matrix_transpose_doc[] =
+PyDoc_STRVAR(Matrix_transpose_doc,
".. method:: transpose()\n"
"\n"
" Set the matrix to its transpose.\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Transpose>\n"
-;
+);
static PyObject *Matrix_transpose(MatrixObject *self)
{
float t = 0.0f;
Py_RETURN_NONE;
}
-static char Matrix_transposed_doc[] =
+PyDoc_STRVAR(Matrix_transposed_doc,
".. method:: transposed()\n"
"\n"
" Return a new, transposed matrix.\n"
"\n"
" :return: a transposed matrix\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_transposed(MatrixObject *self)
{
return matrix__apply_to_copy((PyNoArgsFunction)Matrix_transpose, self);
}
/*---------------------------Matrix.zero() -----------------------*/
-static char Matrix_zero_doc[] =
+PyDoc_STRVAR(Matrix_zero_doc,
".. method:: zero()\n"
"\n"
" Set all the matrix values to zero.\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_zero(MatrixObject *self)
{
fill_vn(self->contigPtr, self->row_size * self->col_size, 0.0f);
Py_RETURN_NONE;
}
/*---------------------------Matrix.identity(() ------------------*/
-static char Matrix_identity_doc[] =
+PyDoc_STRVAR(Matrix_identity_doc,
".. method:: identity()\n"
"\n"
" Set the matrix to the identity matrix.\n"
" .. note:: An object with zero location and rotation, a scale of one, will have an identity matrix.\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Identity_matrix>\n"
-;
+);
static PyObject *Matrix_identity(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
}
/*---------------------------Matrix.copy() ------------------*/
-static char Matrix_copy_doc[] =
+PyDoc_STRVAR(Matrix_copy_doc,
".. method:: copy()\n"
"\n"
" Returns a copy of this matrix.\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_copy(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
};
/*------------------PY_OBECT DEFINITION--------------------------*/
-static char matrix_doc[] =
+PyDoc_STRVAR(matrix_doc,
"This object gives access to Matrices in Blender."
-;
+);
PyTypeObject matrix_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"mathutils.Matrix", /*tp_name*/
return ret;
}
-static char Quaternion_to_euler_doc[] =
+PyDoc_STRVAR(Quaternion_to_euler_doc,
".. method:: to_euler(order, euler_compat)\n"
"\n"
" Return Euler representation of the quaternion.\n"
" :type euler_compat: :class:`Euler`\n"
" :return: Euler representation of the quaternion.\n"
" :rtype: :class:`Euler`\n"
-;
+);
static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
{
float tquat[4];
return newEulerObject(eul, order, Py_NEW, NULL);
}
//----------------------------Quaternion.toMatrix()------------------
-static char Quaternion_to_matrix_doc[] =
+PyDoc_STRVAR(Quaternion_to_matrix_doc,
".. method:: to_matrix()\n"
"\n"
" Return a matrix representation of the quaternion.\n"
"\n"
" :return: A 3x3 rotation matrix representation of the quaternion.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Quaternion_to_matrix(QuaternionObject *self)
{
float mat[9]; /* all values are set */
}
//----------------------------Quaternion.cross(other)------------------
-static char Quaternion_cross_doc[] =
+PyDoc_STRVAR(Quaternion_cross_doc,
".. method:: cross(other)\n"
"\n"
" Return the cross product of this quaternion and another.\n"
" :type other: :class:`Quaternion`\n"
" :return: The cross product.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
{
float quat[QUAT_SIZE], tquat[QUAT_SIZE];
}
//----------------------------Quaternion.dot(other)------------------
-static char Quaternion_dot_doc[] =
+PyDoc_STRVAR(Quaternion_dot_doc,
".. method:: dot(other)\n"
"\n"
" Return the dot product of this quaternion and another.\n"
" :type other: :class:`Quaternion`\n"
" :return: The dot product.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value)
{
float tquat[QUAT_SIZE];
return PyFloat_FromDouble(dot_qtqt(self->quat, tquat));
}
-static char Quaternion_rotation_difference_doc[] =
+PyDoc_STRVAR(Quaternion_rotation_difference_doc,
".. function:: difference(other)\n"
"\n"
" Returns a quaternion representing the rotational difference.\n"
" :type other: :class:`Quaternion`\n"
" :return: the rotational difference between the two quat rotations.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject *value)
{
float tquat[QUAT_SIZE], quat[QUAT_SIZE];
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
}
-static char Quaternion_slerp_doc[] =
+PyDoc_STRVAR(Quaternion_slerp_doc,
".. function:: slerp(other, factor)\n"
"\n"
" Returns the interpolation of two quaternions.\n"
" :type factor: float\n"
" :return: The interpolated rotation.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
{
PyObject *value;
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
}
-static char Quaternion_rotate_doc[] =
+PyDoc_STRVAR(Quaternion_rotate_doc,
".. method:: rotate(other)\n"
"\n"
" Rotates the quaternion a by another mathutils value.\n"
"\n"
" :arg other: rotation component of mathutils value\n"
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
-;
+);
static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
//----------------------------Quaternion.normalize()----------------
//normalize the axis of rotation of [theta, vector]
-static char Quaternion_normalize_doc[] =
+PyDoc_STRVAR(Quaternion_normalize_doc,
".. function:: normalize()\n"
"\n"
" Normalize the quaternion.\n"
-;
+);
static PyObject *Quaternion_normalize(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
-static char Quaternion_normalized_doc[] =
+PyDoc_STRVAR(Quaternion_normalized_doc,
".. function:: normalized()\n"
"\n"
" Return a new normalized quaternion.\n"
"\n"
" :return: a normalized copy.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_normalized(QuaternionObject *self)
{
return quat__apply_to_copy((PyNoArgsFunction)Quaternion_normalize, self);
}
//----------------------------Quaternion.invert()------------------
-static char Quaternion_invert_doc[] =
+PyDoc_STRVAR(Quaternion_invert_doc,
".. function:: invert()\n"
"\n"
" Set the quaternion to its inverse.\n"
-;
+);
static PyObject *Quaternion_invert(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
-static char Quaternion_inverted_doc[] =
+PyDoc_STRVAR(Quaternion_inverted_doc,
".. function:: inverted()\n"
"\n"
" Return a new, inverted quaternion.\n"
"\n"
" :return: the inverted value.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_inverted(QuaternionObject *self)
{
return quat__apply_to_copy((PyNoArgsFunction)Quaternion_invert, self);
}
//----------------------------Quaternion.identity()-----------------
-static char Quaternion_identity_doc[] =
+PyDoc_STRVAR(Quaternion_identity_doc,
".. function:: identity()\n"
"\n"
" Set the quaternion to an identity quaternion.\n"
"\n"
" :return: an instance of itself.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_identity(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
Py_RETURN_NONE;
}
//----------------------------Quaternion.negate()-------------------
-static char Quaternion_negate_doc[] =
+PyDoc_STRVAR(Quaternion_negate_doc,
".. function:: negate()\n"
"\n"
" Set the quaternion to its negative.\n"
"\n"
" :return: an instance of itself.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_negate(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
Py_RETURN_NONE;
}
//----------------------------Quaternion.conjugate()----------------
-static char Quaternion_conjugate_doc[] =
+PyDoc_STRVAR(Quaternion_conjugate_doc,
".. function:: conjugate()\n"
"\n"
" Set the quaternion to its conjugate (negate x, y, z).\n"
-;
+);
static PyObject *Quaternion_conjugate(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
-static char Quaternion_conjugated_doc[] =
+PyDoc_STRVAR(Quaternion_conjugated_doc,
".. function:: conjugated()\n"
"\n"
" Return a new conjugated quaternion.\n"
"\n"
" :return: a new quaternion.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_conjugated(QuaternionObject *self)
{
return quat__apply_to_copy((PyNoArgsFunction)Quaternion_conjugate, self);
}
//----------------------------Quaternion.copy()----------------
-static char Quaternion_copy_doc[] =
+PyDoc_STRVAR(Quaternion_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this quaternion.\n"
" :rtype: :class:`Quaternion`\n"
"\n"
" .. note:: use this to get a copy of a wrapped quaternion with no reference to the original data.\n"
-;
+);
static PyObject *Quaternion_copy(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
};
//------------------PY_OBECT DEFINITION--------------------------
-static char quaternion_doc[] =
+PyDoc_STRVAR(quaternion_doc,
"This object gives access to Quaternions in Blender."
-;
+);
PyTypeObject quaternion_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"mathutils.Quaternion", //tp_name
}
/*-----------------------------METHODS---------------------------- */
-static char Vector_zero_doc[] =
+PyDoc_STRVAR(Vector_zero_doc,
".. method:: zero()\n"
"\n"
" Set all values to zero.\n"
-;
+);
static PyObject *Vector_zero(VectorObject *self)
{
fill_vn(self->vec, self->size, 0.0f);
Py_RETURN_NONE;
}
-static char Vector_normalize_doc[] =
+PyDoc_STRVAR(Vector_normalize_doc,
".. method:: normalize()\n"
"\n"
" Normalize the vector, making the length of the vector always 1.0.\n"
" .. warning:: Normalizing a vector where all values are zero results in all axis having a nan value (not a number).\n"
"\n"
" .. note:: Normalize works for vectors of all sizes, however 4D Vectors w axis is left untouched.\n"
-;
+);
static PyObject *Vector_normalize(VectorObject *self)
{
int i;
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
-static char Vector_normalized_doc[] =
+PyDoc_STRVAR(Vector_normalized_doc,
".. method:: normalized()\n"
"\n"
" Return a new, normalized vector.\n"
"\n"
" :return: a normalized copy of the vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_normalized(VectorObject *self)
{
return vec__apply_to_copy((PyNoArgsFunction)Vector_normalize, self);
}
-static char Vector_resize_2d_doc[] =
+PyDoc_STRVAR(Vector_resize_2d_doc,
".. method:: resize_2d()\n"
"\n"
" Resize the vector to 2D (x, y).\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_resize_2d(VectorObject *self)
{
if(self->wrapped==Py_WRAP) {
Py_RETURN_NONE;
}
-static char Vector_resize_3d_doc[] =
+PyDoc_STRVAR(Vector_resize_3d_doc,
".. method:: resize_3d()\n"
"\n"
" Resize the vector to 3D (x, y, z).\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_resize_3d(VectorObject *self)
{
if (self->wrapped==Py_WRAP) {
Py_RETURN_NONE;
}
-static char Vector_resize_4d_doc[] =
+PyDoc_STRVAR(Vector_resize_4d_doc,
".. method:: resize_4d()\n"
"\n"
" Resize the vector to 4D (x, y, z, w).\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_resize_4d(VectorObject *self)
{
if(self->wrapped==Py_WRAP) {
self->size = 4;
Py_RETURN_NONE;
}
-static char Vector_to_2d_doc[] =
+PyDoc_STRVAR(Vector_to_2d_doc,
".. method:: to_2d()\n"
"\n"
" Return a 2d copy of the vector.\n"
"\n"
" :return: a new vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_to_2d(VectorObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
return newVectorObject(self->vec, 2, Py_NEW, Py_TYPE(self));
}
-static char Vector_to_3d_doc[] =
+PyDoc_STRVAR(Vector_to_3d_doc,
".. method:: to_3d()\n"
"\n"
" Return a 3d copy of the vector.\n"
"\n"
" :return: a new vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_to_3d(VectorObject *self)
{
float tvec[3]= {0.0f};
memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 3));
return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(self));
}
-static char Vector_to_4d_doc[] =
+PyDoc_STRVAR(Vector_to_4d_doc,
".. method:: to_4d()\n"
"\n"
" Return a 4d copy of the vector.\n"
"\n"
" :return: a new vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_to_4d(VectorObject *self)
{
float tvec[4]= {0.0f, 0.0f, 0.0f, 1.0f};
return newVectorObject(tvec, 4, Py_NEW, Py_TYPE(self));
}
-static char Vector_to_tuple_doc[] =
+PyDoc_STRVAR(Vector_to_tuple_doc,
".. method:: to_tuple(precision=-1)\n"
"\n"
" Return this vector as a tuple with.\n"
" :type precision: int\n"
" :return: the values of the vector rounded by *precision*\n"
" :rtype: tuple\n"
-;
+);
/* note: BaseMath_ReadCallback must be called beforehand */
static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits)
{
return Vector_to_tuple_ext(self, ndigits);
}
-static char Vector_to_track_quat_doc[] =
+PyDoc_STRVAR(Vector_to_track_quat_doc,
".. method:: to_track_quat(track, up)\n"
"\n"
" Return a quaternion rotation from the vector and the track and up axis.\n"
" :type up: string\n"
" :return: rotation from the vector and the track and up axis.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
{
float vec[3], quat[4];
* Vector.reflect(mirror): return a reflected vector on the mirror normal
* vec - ((2 * DotVecs(vec, mirror)) * mirror)
*/
-static char Vector_reflect_doc[] =
+PyDoc_STRVAR(Vector_reflect_doc,
".. method:: reflect(mirror)\n"
"\n"
" Return the reflection vector from the *mirror* argument.\n"
" :type mirror: :class:`Vector`\n"
" :return: The reflected vector matching the size of this vector.\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
{
int value_size;
return newVectorObject(reflect, self->size, Py_NEW, Py_TYPE(self));
}
-static char Vector_cross_doc[] =
+PyDoc_STRVAR(Vector_cross_doc,
".. method:: cross(other)\n"
"\n"
" Return the cross product of this vector and another.\n"
" :rtype: :class:`Vector`\n"
"\n"
" .. note:: both vectors must be 3D\n"
-;
+);
static PyObject *Vector_cross(VectorObject *self, PyObject *value)
{
VectorObject *ret;
return (PyObject *)ret;
}
-static char Vector_dot_doc[] =
+PyDoc_STRVAR(Vector_dot_doc,
".. method:: dot(other)\n"
"\n"
" Return the dot product of this vector and another.\n"
" :type other: :class:`Vector`\n"
" :return: The dot product.\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_dot(VectorObject *self, PyObject *value)
{
float tvec[MAX_DIMENSIONS];
return PyFloat_FromDouble(dot);
}
-static char Vector_angle_doc[] =
+PyDoc_STRVAR(Vector_angle_doc,
".. function:: angle(other, fallback)\n"
"\n"
" Return the angle between two vectors.\n"
" :rtype: float\n"
"\n"
" .. note:: Zero length vectors raise an :exc:`AttributeError`.\n"
-;
+);
static PyObject *Vector_angle(VectorObject *self, PyObject *args)
{
const int size= self->size;
return PyFloat_FromDouble(saacos(dot));
}
-static char Vector_rotation_difference_doc[] =
+PyDoc_STRVAR(Vector_rotation_difference_doc,
".. function:: difference(other)\n"
"\n"
" Returns a quaternion representing the rotational difference between this vector and another.\n"
" :rtype: :class:`Quaternion`\n"
"\n"
" .. note:: 2D vectors raise an :exc:`AttributeError`.\n"
-;
+);
static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value)
{
float quat[4], vec_a[3], vec_b[3];
return newQuaternionObject(quat, Py_NEW, NULL);
}
-static char Vector_project_doc[] =
+PyDoc_STRVAR(Vector_project_doc,
".. function:: project(other)\n"
"\n"
" Return the projection of this vector onto the *other*.\n"
" :type other: :class:`Vector`\n"
" :return: the parallel projection vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_project(VectorObject *self, PyObject *value)
{
const int size= self->size;
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
}
-static char Vector_lerp_doc[] =
+PyDoc_STRVAR(Vector_lerp_doc,
".. function:: lerp(other, factor)\n"
"\n"
" Returns the interpolation of two vectors.\n"
" :type factor: float\n"
" :return: The interpolated rotation.\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
{
const int size= self->size;
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
}
-static char Vector_rotate_doc[] =
+PyDoc_STRVAR(Vector_rotate_doc,
".. function:: rotate(other)\n"
"\n"
" Return vector by a rotation value.\n"
"\n"
" :arg other: rotation component of mathutils value\n"
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
-;
+);
static PyObject *Vector_rotate(VectorObject *self, PyObject *value)
{
float other_rmat[3][3];
Py_RETURN_NONE;
}
-static char Vector_copy_doc[] =
+PyDoc_STRVAR(Vector_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this vector.\n"
" :rtype: :class:`Vector`\n"
"\n"
" .. note:: use this to get a copy of a wrapped vector with no reference to the original data.\n"
-;
+);
static PyObject *Vector_copy(VectorObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
#endif
/*----------------------------Vector.negate() -------------------- */
-static char Vector_negate_doc[] =
+PyDoc_STRVAR(Vector_negate_doc,
".. method:: negate()\n"
"\n"
" Set all values to their negative.\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_negate(VectorObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
vec*mat and mat*vec both get sent to Vector_mul and it neesd to sort out the order
*/
-static char vector_doc[] =
+PyDoc_STRVAR(vector_doc,
"This object gives access to Vectors in Blender."
-;
+);
PyTypeObject vector_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
/* For printing, in format "<module>.<name>" */
/*-------------------------DOC STRINGS ---------------------------*/
-static char M_Geometry_doc[]= "The Blender geometry module\n\n";
+PyDoc_STRVAR(M_Geometry_doc,
+"The Blender geometry module"
+);
//---------------------------------INTERSECTION FUNCTIONS--------------------
-static char M_Geometry_intersect_ray_tri_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_ray_tri_doc,
".. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True)\n"
"\n"
" Returns the intersection between a ray and a triangle, if possible, returns None otherwise.\n"
" :type clip: boolean\n"
" :return: The point of intersection or None if no intersection is found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
-;
+);
static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *ray, *ray_off, *vec1, *vec2, *vec3;
/* Line-Line intersection using algorithm from mathworld.wolfram.com */
-static char M_Geometry_intersect_line_line_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_line_line_doc,
".. function:: intersect_line_line(v1, v2, v3, v4)\n"
"\n"
" Returns a tuple with the points on each line respectively closest to the other.\n"
" :arg v4: Second point of the second line\n"
" :type v4: :class:`mathutils.Vector`\n"
" :rtype: tuple of :class:`mathutils.Vector`'s\n"
-;
+);
static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject *args)
{
PyObject * tuple;
//----------------------------geometry.normal() -------------------
-static char M_Geometry_normal_doc[] =
+PyDoc_STRVAR(M_Geometry_normal_doc,
".. function:: normal(v1, v2, v3, v4=None)\n"
"\n"
" Returns the normal of the 3D tri or quad.\n"
" :arg v4: Point4 (optional)\n"
" :type v4: :class:`mathutils.Vector`\n"
" :rtype: :class:`mathutils.Vector`\n"
-;
+);
static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3, *vec4;
//--------------------------------- AREA FUNCTIONS--------------------
-static char M_Geometry_area_tri_doc[] =
+PyDoc_STRVAR(M_Geometry_area_tri_doc,
".. function:: area_tri(v1, v2, v3)\n"
"\n"
" Returns the area size of the 2D or 3D triangle defined.\n"
" :arg v3: Point3\n"
" :type v3: :class:`mathutils.Vector`\n"
" :rtype: float\n"
-;
+);
static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3;
}
/*----------------------------------geometry.PolyFill() -------------------*/
-static char M_Geometry_tesselate_polygon_doc[] =
+PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc,
".. function:: tesselate_polygon(veclist_list)\n"
"\n"
" Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n"
"\n"
" :arg veclist_list: list of polylines\n"
" :rtype: list\n"
-;
+);
/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
{
return tri_list;
}
-static char M_Geometry_intersect_line_line_2d_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_line_line_2d_doc,
".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n"
"\n"
" Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\n"
" :type lineB_p2: :class:`mathutils.Vector`\n"
" :return: The point of intersection or None when not found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
-;
+);
static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *line_a1, *line_a2, *line_b1, *line_b2;
}
-static char M_Geometry_intersect_line_plane_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_line_plane_doc,
".. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False)\n"
"\n"
" Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\n"
" :type no_flip: :boolean\n"
" :return: The point of intersection or None when not found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
-;
+);
static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *line_a, *line_b, *plane_co, *plane_no;
}
}
-static char M_Geometry_intersect_point_line_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_point_line_doc,
".. function:: intersect_point_line(pt, line_p1, line_p2)\n"
"\n"
" Takes a point and a line and returns a tuple with the closest point on the line and its distance from the first point of the line as a percentage of the length of the line.\n"
" :arg line_p1: Second point of the line\n"
" :type line_p1: :class:`mathutils.Vector`\n"
" :rtype: (:class:`mathutils.Vector`, float)\n"
-;
+);
static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt, *line_1, *line_2;
return ret;
}
-static char M_Geometry_intersect_point_tri_2d_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_point_tri_2d_doc,
".. function:: intersect_point_tri_2d(pt, tri_p1, tri_p2, tri_p3)\n"
"\n"
" Takes 4 vectors (using only the x and y coordinates): one is the point and the next 3 define the triangle. Returns 1 if the point is within the triangle, otherwise 0.\n"
" :arg tri_p3: Third point of the triangle\n"
" :type tri_p3: :class:`mathutils.Vector`\n"
" :rtype: int\n"
-;
+);
static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec));
}
-static char M_Geometry_intersect_point_quad_2d_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc,
".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n"
"\n"
" Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n"
" :arg quad_p4: Forth point of the quad\n"
" :type quad_p4: :class:`mathutils.Vector`\n"
" :rtype: int\n"
-;
+);
static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4;
MEM_freeN(*boxarray);
}
-static char M_Geometry_box_pack_2d_doc[] =
+PyDoc_STRVAR(M_Geometry_box_pack_2d_doc,
".. function:: box_pack_2d(boxes)\n"
"\n"
" Returns the normal of the 3D tri or quad.\n"
" :type boxes: list\n"
" :return: the width and height of the packed bounding box\n"
" :rtype: tuple, pair of floats\n"
-;
+);
static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlist)
{
float tot_width= 0.0f, tot_height= 0.0f;
return ret;
}
-static char M_Geometry_interpolate_bezier_doc[] =
+PyDoc_STRVAR(M_Geometry_interpolate_bezier_doc,
".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n"
"\n"
" Interpolate a bezier spline segment.\n"
" :type resolution: int\n"
" :return: The interpolated points\n"
" :rtype: list of :class:`mathutils.Vector`'s\n"
-;
+);
static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2;
return list;
}
-static char M_Geometry_barycentric_transform_doc[] =
+PyDoc_STRVAR(M_Geometry_barycentric_transform_doc,
".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n"
"\n"
" Return a transformed point, the transformation is defined by 2 triangles.\n"
" :type tri_a3: :class:`mathutils.Vector`\n"
" :return: The transformed point\n"
" :rtype: :class:`mathutils.Vector`'s\n"
-;
+);
static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *vec_pt;
In the original module I actually kept the docs stings with the functions themselves,
but I grouped them here so that it can easily be moved to a header if anyone thinks that is necessary. */
-static char random__doc__[] = "() No arguments.\n\n\
-Returns a random floating point number in the range [0, 1)";
+PyDoc_STRVAR(random__doc__,
+"() No arguments.\n\n\
+Returns a random floating point number in the range [0, 1)"
+);
-static char random_unit_vector__doc__[] =
- "() No arguments.\n\nReturns a random unit vector (3-float list).";
+PyDoc_STRVAR(random_unit_vector__doc__,
+"() No arguments.\n\nReturns a random unit vector (3-float list)."
+);
-static char seed_set__doc__[] = "(seed value)\n\n\
+PyDoc_STRVAR(seed_set__doc__,
+"(seed value)\n\n\
Initializes random number generator.\n\
-if seed is zero, the current time will be used instead.";
+if seed is zero, the current time will be used instead."
+);
-static char noise__doc__[] = "((x,y,z) tuple, [noisetype])\n\n\
+PyDoc_STRVAR(noise__doc__,
+"((x,y,z) tuple, [noisetype])\n\n\
Returns general noise of the optional specified type.\n\
-Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes."
+);
-static char noise_vector__doc__[] = "((x,y,z) tuple, [noisetype])\n\n\
+PyDoc_STRVAR(noise_vector__doc__,
+"((x,y,z) tuple, [noisetype])\n\n\
Returns noise vector (3-float list) of the optional specified type.\
-Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes."
+);
-static char turbulence__doc__[] =
- "((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
+PyDoc_STRVAR(turbulence__doc__,
+"((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
Returns general turbulence value using the optional specified noisebasis function.\n\
octaves (integer) is the number of noise values added.\n\
hard (bool), when false (0) returns 'soft' noise, when true (1) returns 'hard' noise (returned value always positive).\n\
Optional arguments:\n\
noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.\n\
ampscale sets the amplitude scale value of the noise frequencies added, 0.5 by default.\n\
-freqscale sets the frequency scale factor, 2.0 by default.";
+freqscale sets the frequency scale factor, 2.0 by default."
+);
-static char turbulence_vector__doc__[] =
- "((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
+PyDoc_STRVAR(turbulence_vector__doc__,
+"((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
Returns general turbulence vector (3-float list) using the optional specified noisebasis function.\n\
octaves (integer) is the number of noise values added.\n\
hard (bool), when false (0) returns 'soft' noise, when true (1) returns 'hard' noise (returned vector always positive).\n\
Optional arguments:\n\
noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.\n\
ampscale sets the amplitude scale value of the noise frequencies added, 0.5 by default.\n\
-freqscale sets the frequency scale factor, 2.0 by default.";
+freqscale sets the frequency scale factor, 2.0 by default."
+);
-static char fractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
+PyDoc_STRVAR(fractal__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
Returns Fractal Brownian Motion noise value(fBm).\n\
H is the fractal increment parameter.\n\
lacunarity is the gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char multi_fractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
+PyDoc_STRVAR(multi_fractal__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
Returns Multifractal noise value.\n\
H determines the highest fractal dimension.\n\
lacunarity is gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char vl_vector__doc__[] =
- "((x,y,z) tuple, distortion, [noisetype1], [noisetype2])\n\n\
+PyDoc_STRVAR(vl_vector__doc__,
+"((x,y,z) tuple, distortion, [noisetype1], [noisetype2])\n\n\
Returns Variable Lacunarity Noise value, a distorted variety of noise.\n\
distortion sets the amount of distortion.\n\
Optional arguments noisetype1 and noisetype2 set the noisetype to distort and the noisetype used for the distortion respectively.\n\
-See NoiseTypes, both are STDPERLIN by default.";
+See NoiseTypes, both are STDPERLIN by default."
+);
-static char hetero_terrain__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, [noisebasis])\n\n\
+PyDoc_STRVAR(hetero_terrain__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, offset, [noisebasis])\n\n\
returns Heterogeneous Terrain value\n\
H determines the fractal dimension of the roughest areas.\n\
lacunarity is the gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
offset raises the terrain from 'sea level'.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char hybrid_multi_fractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, gain, [noisebasis])\n\n\
+PyDoc_STRVAR(hybrid_multi_fractal__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, offset, gain, [noisebasis])\n\n\
returns Hybrid Multifractal value.\n\
H determines the fractal dimension of the roughest areas.\n\
lacunarity is the gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
offset raises the terrain from 'sea level'.\n\
gain scales the values.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char ridged_multi_fractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, gain [noisebasis])\n\n\
+PyDoc_STRVAR(ridged_multi_fractal__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, offset, gain [noisebasis])\n\n\
returns Ridged Multifractal value.\n\
H determines the fractal dimension of the roughest areas.\n\
lacunarity is the gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
offset raises the terrain from 'sea level'.\n\
gain scales the values.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char voronoi__doc__[] =
- "((x,y,z) tuple, distance_metric, [exponent])\n\n\
+PyDoc_STRVAR(voronoi__doc__,
+"((x,y,z) tuple, distance_metric, [exponent])\n\n\
returns a list, containing a list of distances in order of closest feature,\n\
and a list containing the positions of the four closest features\n\
Optional arguments:\n\
distance_metric: see DistanceMetrics, default is DISTANCE\n\
-exponent is only used with MINKOVSKY, default is 2.5.";
+exponent is only used with MINKOVSKY, default is 2.5."
+);
-static char cell__doc__[] = "((x,y,z) tuple)\n\n\
-returns cellnoise float value.";
+PyDoc_STRVAR(cell__doc__,
+"((x,y,z) tuple)\n\n\
+returns cellnoise float value."
+);
-static char cell_vector__doc__[] = "((x,y,z) tuple)\n\n\
-returns cellnoise vector/point/color (3-float list).";
+PyDoc_STRVAR(cell_vector__doc__,
+"((x,y,z) tuple)\n\n\
+returns cellnoise vector/point/color (3-float list)."
+);
-static char Noise__doc__[] = "Blender Noise and Turbulence Module\n\n\
+PyDoc_STRVAR(Noise__doc__,
+"Blender Noise and Turbulence Module\n\n\
This module can be used to generate noise of various types.\n\
This can be used for terrain generation, to create textures,\n\
make animations more 'animated', object deformation, etc.\n\
\trv = Noise.turbulence_vector(ps, 3, 0, Noise.NoiseTypes.NEWPERLIN)\n\
\tob.dloc = (sp*rv[0], sp*rv[1], sp*rv[2])\n\
\tob.drot = (sr*rv[0], sr*rv[1], sr*rv[2])\n\
-\n";
+\n"
+);
/* Just in case, declarations for a header file */
/*
PyObject *bpy_package_py= NULL;
-static char bpy_script_paths_doc[] =
+PyDoc_STRVAR(bpy_script_paths_doc,
".. function:: script_paths()\n"
"\n"
" Return 2 paths to blender scripts directories.\n"
"\n"
" :return: (system, user) strings will be empty when not found.\n"
" :rtype: tuple of strings\n"
-;
+);
static PyObject *bpy_script_paths(PyObject *UNUSED(self))
{
PyObject *ret= PyTuple_New(2);
return ret;
}
-static char bpy_blend_paths_doc[] =
+PyDoc_STRVAR(bpy_blend_paths_doc,
".. function:: blend_paths(absolute=False)\n"
"\n"
" Returns a list of paths to external files referenced by the loaded .blend file.\n"
" :type absolute: boolean\n"
" :return: path list.\n"
" :rtype: list of strings\n"
-;
+);
static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
struct BPathIterator *bpi;
}
-// static char bpy_user_resource_doc[]= // now in bpy/utils.py
+// PyDoc_STRVAR(bpy_user_resource_doc[]= // now in bpy/utils.py
static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
return PyUnicode_DecodeFSDefault(path ? path : "");
}
-static char bpy_resource_path_doc[] =
+PyDoc_STRVAR(bpy_resource_path_doc,
".. function:: resource_path(type, major=2, minor=57)\n"
"\n"
" Return the base path for storing system files.\n"
" :type minor: string\n"
" :return: the resource path (not necessarily existing).\n"
" :rtype: string\n"
-;
+);
static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
NULL
};
-static char bpy_lib_load_doc[] =
+PyDoc_STRVAR(bpy_lib_load_doc,
".. method:: load(filepath, link=False, relative=False)\n"
"\n"
" Returns a context manager which exposes 2 library objects on entering.\n"
" :type link: bool\n"
" :arg relative: When True the path is stored relative to the open blend file.\n"
" :type relative: bool\n"
-;
+);
static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
{
static const char *kwlist[]= {"filepath", "link", "relative", NULL};
/* Function that sets RNA, NOTE - self is NULL when called from python, but being abused from C so we can pass the srna allong
* This isnt incorrect since its a python object - but be careful */
-static char BPy_BoolProperty_doc[] =
+PyDoc_STRVAR(BPy_BoolProperty_doc,
".. function:: BoolProperty(name=\"\", description=\"\", default=False, options={'ANIMATABLE'}, subtype='NONE')\n"
"\n"
" Returns a new boolean property definition.\n"
" :type options: set\n"
" :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n"
" :type subtype: string\n"
-;
+);
static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
Py_RETURN_NONE;
}
-static char BPy_BoolVectorProperty_doc[] =
+PyDoc_STRVAR(BPy_BoolVectorProperty_doc,
".. function:: BoolVectorProperty(name=\"\", description=\"\", default=(False, False, False), options={'ANIMATABLE'}, subtype='NONE', size=3)\n"
"\n"
" Returns a new vector boolean property definition.\n"
" :type subtype: string\n"
" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
-;
+);
static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
Py_RETURN_NONE;
}
-static char BPy_IntProperty_doc[] =
+PyDoc_STRVAR(BPy_IntProperty_doc,
".. function:: IntProperty(name=\"\", description=\"\", default=0, min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, step=1, options={'ANIMATABLE'}, subtype='NONE')\n"
"\n"
" Returns a new int property definition.\n"
" :type options: set\n"
" :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n"
" :type subtype: string\n"
-;
+);
static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
Py_RETURN_NONE;
}
-static char BPy_IntVectorProperty_doc[] =
+PyDoc_STRVAR(BPy_IntVectorProperty_doc,
".. function:: IntVectorProperty(name=\"\", description=\"\", default=(0, 0, 0), min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, options={'ANIMATABLE'}, subtype='NONE', size=3)\n"
"\n"
" Returns a new vector int property definition.\n"
" :type subtype: string\n"
" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
-;
+);
static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
}
-static char BPy_FloatProperty_doc[] =
+PyDoc_STRVAR(BPy_FloatProperty_doc,
".. function:: FloatProperty(name=\"\", description=\"\", default=0.0, min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, subtype='NONE', unit='NONE')\n"
"\n"
" Returns a new float property definition.\n"
" :type subtype: string\n"
" :arg unit: Enumerator in ['NONE', 'LENGTH', 'AREA', 'VOLUME', 'ROTATION', 'TIME', 'VELOCITY', 'ACCELERATION'].\n"
" :type unit: string\n"
-;
+);
static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
Py_RETURN_NONE;
}
-static char BPy_FloatVectorProperty_doc[] =
+PyDoc_STRVAR(BPy_FloatVectorProperty_doc,
".. function:: FloatVectorProperty(name=\"\", description=\"\", default=(0.0, 0.0, 0.0), min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, subtype='NONE', size=3)\n"
"\n"
" Returns a new vector float property definition.\n"
" :type subtype: string\n"
" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
-;
+);
static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
Py_RETURN_NONE;
}
-static char BPy_StringProperty_doc[] =
+PyDoc_STRVAR(BPy_StringProperty_doc,
".. function:: StringProperty(name=\"\", description=\"\", default=\"\", maxlen=0, options={'ANIMATABLE'}, subtype='NONE')\n"
"\n"
" Returns a new string property definition.\n"
" :type options: set\n"
" :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILENAME', 'NONE'].\n"
" :type subtype: string\n"
-;
+);
static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
return items;
}
-static char BPy_EnumProperty_doc[] =
+PyDoc_STRVAR(BPy_EnumProperty_doc,
".. function:: EnumProperty(items, name=\"\", description=\"\", default=\"\", options={'ANIMATABLE'})\n"
"\n"
" Returns a new enumerator property definition.\n"
" :type options: set\n"
" :arg items: sequence of enum items formatted: [(identifier, name, description), ...] where the identifier is used for python access and other values are used for the interface.\n"
" :type items: sequence of string triplets\n"
-;
+);
static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
return srna;
}
-static char BPy_PointerProperty_doc[] =
+PyDoc_STRVAR(BPy_PointerProperty_doc,
".. function:: PointerProperty(type=\"\", description=\"\", options={'ANIMATABLE'})\n"
"\n"
" Returns a new pointer property definition.\n"
BPY_PROPDEF_DESC_DOC
" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n"
" :type options: set\n"
-;
+);
static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
Py_RETURN_NONE;
}
-static char BPy_CollectionProperty_doc[] =
+PyDoc_STRVAR(BPy_CollectionProperty_doc,
".. function:: CollectionProperty(items, type=\"\", description=\"\", default=\"\", options={'ANIMATABLE'})\n"
"\n"
" Returns a new collection property definition.\n"
BPY_PROPDEF_DESC_DOC
" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n"
" :type options: set\n"
-;
+);
static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
Py_RETURN_NONE;
}
-static char BPy_RemoveProperty_doc[] =
+PyDoc_STRVAR(BPy_RemoveProperty_doc,
".. function:: RemoveProperty(attr)\n"
"\n"
" Removes a dynamically defined property.\n"
"\n"
" :arg attr: Property name.\n"
" :type attr: string\n"
-;
+);
static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
(objobjargproc) pyrna_struct_ass_subscript, /* mp_ass_subscript */
};
-static char pyrna_struct_keys_doc[] =
+PyDoc_STRVAR(pyrna_struct_keys_doc,
".. method:: keys()\n"
"\n"
" Returns the keys of this objects custom properties (matches pythons dictionary function of the same name).\n"
" :return: custom property keys.\n"
" :rtype: list of strings\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n";
-
+" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n"
+);
static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self)
{
IDProperty *group;
return BPy_Wrap_GetKeys(group);
}
-static char pyrna_struct_items_doc[] =
+PyDoc_STRVAR(pyrna_struct_items_doc,
".. method:: items()\n"
"\n"
" Returns the items of this objects custom properties (matches pythons dictionary function of the same name).\n"
" :return: custom property key, value pairs.\n"
" :rtype: list of key, value tuples\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n";
-
+" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n"
+);
static PyObject *pyrna_struct_items(BPy_PropertyRNA *self)
{
IDProperty *group;
return BPy_Wrap_GetItems(self->ptr.id.data, group);
}
-static char pyrna_struct_values_doc[] =
+PyDoc_STRVAR(pyrna_struct_values_doc,
".. method:: values()\n"
"\n"
" Returns the values of this objects custom properties (matches pythons dictionary function of the same name).\n"
" :return: custom property values.\n"
" :rtype: list\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n";
-
+" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n"
+);
static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
{
IDProperty *group;
}
-static char pyrna_struct_is_property_set_doc[] =
+PyDoc_STRVAR(pyrna_struct_is_property_set_doc,
".. method:: is_property_set(property)\n"
"\n"
" Check if a property is set, use for testing operator properties.\n"
"\n"
" :return: True when the property has been set.\n"
" :rtype: boolean\n"
-;
+);
static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *args)
{
PropertyRNA *prop;
return PyBool_FromLong(ret);
}
-static char pyrna_struct_is_property_hidden_doc[] =
+PyDoc_STRVAR(pyrna_struct_is_property_hidden_doc,
".. method:: is_property_hidden(property)\n"
"\n"
" Check if a property is hidden.\n"
"\n"
" :return: True when the property is hidden.\n"
" :rtype: boolean\n"
-;
+);
static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *args)
{
PropertyRNA *prop;
return PyBool_FromLong(RNA_property_flag(prop) & PROP_HIDDEN);
}
-static char pyrna_struct_path_resolve_doc[] =
+PyDoc_STRVAR(pyrna_struct_path_resolve_doc,
".. method:: path_resolve(path, coerce=True)\n"
"\n"
" Returns the property from the path, raise an exception when not found.\n"
" :type path: string\n"
" :arg coerce: optional argument, when True, the property will be converted into its python representation.\n"
" :type coerce: boolean\n"
-;
+);
static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
{
const char *path;
}
}
-static char pyrna_struct_path_from_id_doc[] =
+PyDoc_STRVAR(pyrna_struct_path_from_id_doc,
".. method:: path_from_id(property=\"\")\n"
"\n"
" Returns the data path from the ID to this object (string).\n"
" :type property: string\n"
" :return: The path from :class:`bpy_struct.id_data` to this struct and property (when given).\n"
" :rtype: str\n"
-;
+);
static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
{
const char *name= NULL;
return ret;
}
-static char pyrna_prop_path_from_id_doc[] =
+PyDoc_STRVAR(pyrna_prop_path_from_id_doc,
".. method:: path_from_id()\n"
"\n"
" Returns the data path from the ID to this property (string).\n"
"\n"
" :return: The path from :class:`bpy_struct.id_data` to this property.\n"
" :rtype: str\n"
-;
+);
static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
{
const char *path;
return ret;
}
-static char pyrna_struct_type_recast_doc[] =
+PyDoc_STRVAR(pyrna_struct_type_recast_doc,
".. method:: type_recast()\n"
"\n"
" Return a new instance, this is needed because types such as textures can be changed at runtime.\n"
"\n"
" :return: a new instance of this object with the type initialized again.\n"
" :rtype: subclass of :class:`bpy_struct`\n"
-;
+);
static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
{
PointerRNA r_ptr;
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
-static char pyrna_prop_collection_keys_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_keys_doc,
".. method:: keys()\n"
"\n"
" Return the identifiers of collection members (matching pythons dict.keys() functionality).\n"
"\n"
" :return: the identifiers for each member of this collection.\n"
" :rtype: list of stings\n"
-;
+);
static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
{
PyObject *ret= PyList_New(0);
return ret;
}
-static char pyrna_prop_collection_items_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_items_doc,
".. method:: items()\n"
"\n"
" Return the identifiers of collection members (matching pythons dict.items() functionality).\n"
"\n"
" :return: (key, value) pairs for each member of this collection.\n"
" :rtype: list of tuples\n"
-;
+);
static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
{
PyObject *ret= PyList_New(0);
return ret;
}
-static char pyrna_prop_collection_values_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_values_doc,
".. method:: values()\n"
"\n"
" Return the values of collection (matching pythons dict.values() functionality).\n"
"\n"
" :return: the members of this collection.\n"
" :rtype: list\n"
-;
+);
static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self)
{
/* re-use slice*/
return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
}
-static char pyrna_struct_get_doc[] =
+PyDoc_STRVAR(pyrna_struct_get_doc,
".. method:: get(key, default=None)\n"
"\n"
" Returns the value of the custom property assigned to key or default when not found (matches pythons dictionary function of the same name).\n"
" :type default: Undefined\n"
"\n"
" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n"
-;
+);
static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
{
IDProperty *group, *idprop;
return Py_INCREF(def), def;
}
-static char pyrna_struct_as_pointer_doc[] =
+PyDoc_STRVAR(pyrna_struct_as_pointer_doc,
".. method:: as_pointer()\n"
"\n"
" Returns the memory address which holds a pointer to blenders internal data\n"
" :rtype: int\n"
"\n"
" .. note:: This is intended only for advanced script writers who need to pass blender data to their own C/Python modules.\n"
-;
+);
static PyObject *pyrna_struct_as_pointer(BPy_StructRNA *self)
{
return PyLong_FromVoidPtr(self->ptr.data);
}
-static char pyrna_prop_collection_get_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_get_doc,
".. method:: get(key, default=None)\n"
"\n"
" Returns the value of the item assigned to key or default when not found (matches pythons dictionary function of the same name).\n"
" :type key: string\n"
" :arg default: Optional argument for the value to return if *key* is not found.\n"
" :type default: Undefined\n"
-;
+);
static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args)
{
PointerRNA newptr;
Py_RETURN_NONE;
}
-static char pyrna_prop_collection_foreach_get_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_foreach_get_doc,
".. method:: foreach_get(attr, seq)\n"
"\n"
" This is a function to give fast access to attributes within a collection.\n"
" # Python equivalent\n"
" for i in range(len(seq)): someseq[i]= getattr(collection, attr)\n"
"\n"
-;
+);
static PyObject *pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args)
{
PYRNA_PROP_CHECK_OBJ(self)
return foreach_getset(self, args, 0);
}
-static char pyrna_prop_collection_foreach_set_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_foreach_set_doc,
".. method:: foreach_set(attr, seq)\n"
"\n"
" This is a function to give fast access to attributes within a collection.\n"
" # Python equivalent\n"
" for i in range(len(seq)): setattr(collection[i], attr, seq[i])\n"
"\n"
-;
+);
static PyObject *pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObject *args)
{
PYRNA_PROP_CHECK_OBJ(self)
* the decref. This is not so bad because the leak only happens when re-registering (hold F8)
* - Should still be fixed - Campbell
* */
-static char pyrna_register_class_doc[] =
+PyDoc_STRVAR(pyrna_register_class_doc,
".. method:: register_class(cls)\n"
"\n"
" Register a subclass of a blender type in (:class:`Panel`, :class:`Menu`, :class:`Header`, :class:`Operator`, :class:`KeyingSetInfo`, :class:`RenderEngine`).\n"
"\n"
" .. note:: :exc:`ValueError` exception is raised if the class is not a subclass of a registerable blender class.\n"
"\n"
-;
+);
PyMethodDef meth_bpy_register_class= {"register_class", pyrna_register_class, METH_O, pyrna_register_class_doc};
static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class)
{
return 0;
}
-static char pyrna_unregister_class_doc[] =
+PyDoc_STRVAR(pyrna_unregister_class_doc,
".. method:: unregister_class(cls)\n"
"\n"
" Unload the python class from blender.\n"
"\n"
" If the class has an *unregister* class method it will be called before unregistering.\n"
-;
+);
PyMethodDef meth_bpy_unregister_class= {"unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc};
static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_class)
{