Merged changes in the trunk up to revision 44797.

Conflicts resolved:
doc/python_api/sphinx_doc_gen.py
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_mesh.c
This commit is contained in:
Tamito Kajiyama
2012-03-10 21:56:23 +00:00
828 changed files with 28231 additions and 25725 deletions

View File

@@ -40,13 +40,36 @@
#include "BLI_utildefines.h"
#include "BKE_tessmesh.h"
#include "BKE_depsgraph.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "../generic/py_capi_utils.h"
#include "bmesh_py_api.h" /* own include */
PyDoc_STRVAR(bpy_bm_new_doc,
".. method:: new()\n"
"\n"
" :return: Retyrn a new, empty mesh.\n"
" :rtype: :class:`BMesh`\n"
);
static PyObject *bpy_bm_new(PyObject *UNUSED(self))
{
BPy_BMesh *py_bmesh;
BMesh *bm;
bm = BM_mesh_create(NULL, &bm_mesh_allocsize_default);
py_bmesh = (BPy_BMesh *)BPy_BMesh_CreatePyObject(bm);
py_bmesh->py_owns = TRUE;
return (PyObject *)py_bmesh;
}
PyDoc_STRVAR(bpy_bm_from_mesh_doc,
".. method:: from_mesh(mesh)\n"
"\n"
@@ -58,25 +81,88 @@ PyDoc_STRVAR(bpy_bm_from_mesh_doc,
static PyObject *bpy_bm_from_mesh(PyObject *UNUSED(self), PyObject *value)
{
BPy_BMesh *py_bmesh;
BMesh *bm;
Mesh *me = PyC_RNA_AsPointer(value, "Mesh");
int py_owns;
/* temp! */
if (!me->edit_btmesh) {
PyErr_SetString(PyExc_ValueError,
"Mesh is not in editmode");
if (me == NULL) {
return NULL;
}
return BPy_BMesh_CreatePyObject(me->edit_btmesh->bm);
/* temp! */
if (!me->edit_btmesh) {
bm = BM_mesh_create(NULL, &bm_mesh_allocsize_default);
BM_mesh_to_bmesh(bm, me, 0, 0); /* BMESH_TODO add args */
py_owns = TRUE;
}
else {
bm = me->edit_btmesh->bm;
py_owns = FALSE;
}
py_bmesh = (BPy_BMesh *)BPy_BMesh_CreatePyObject(bm);
py_bmesh->py_owns = py_owns;
return (PyObject *)py_bmesh;
}
PyDoc_STRVAR(bpy_bm_to_mesh_doc,
".. method:: to_mesh(mesh, bmesh)\n"
"\n"
" Return a BMesh from this mesh, currently the mesh must already be in editmode.\n"
"\n"
" :return: the BMesh assosiated with this mesh.\n"
" :rtype: :class:`bmesh.types.BMesh`\n"
);
static PyObject *bpy_bm_to_mesh(PyObject *UNUSED(self), PyObject *args)
{
PyObject *py_mesh;
BPy_BMesh *py_bmesh;
Mesh *me;
BMesh *bm;
if (!PyArg_ParseTuple(args, "OO!:to_mesh", &py_mesh, &BPy_BMesh_Type, &py_bmesh) ||
!(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
{
return NULL;
}
BPY_BM_CHECK_OBJ(py_bmesh);
if (me->edit_btmesh) {
PyErr_Format(PyExc_ValueError,
"to_mesh(): Mesh '%s' is in editmode", me->id.name + 2);
return NULL;
}
bm = py_bmesh->bm;
BM_mesh_from_bmesh(bm, me, FALSE);
/* we could have the user do this but if they forget blender can easy crash
* since the references arrays for the objects derived meshes are now invalid */
DAG_id_tag_update(&me->id, OB_RECALC_DATA);
Py_RETURN_NONE;
}
static struct PyMethodDef BPy_BM_methods[] = {
{"from_mesh", (PyCFunction)bpy_bm_from_mesh, METH_O, bpy_bm_from_mesh_doc},
{NULL, NULL, 0, NULL}
/* THESE NAMES MAY CHANGE! */
{"new", (PyCFunction)bpy_bm_new, METH_NOARGS, bpy_bm_new_doc},
{"from_mesh", (PyCFunction)bpy_bm_from_mesh, METH_O, bpy_bm_from_mesh_doc},
{"to_mesh", (PyCFunction)bpy_bm_to_mesh, METH_VARARGS, bpy_bm_to_mesh_doc},
{NULL, NULL, 0, NULL}
};
PyDoc_STRVAR(BPy_BM_doc,
"This module provides access to blenders bmesh data structures."
"This module provides access to blenders bmesh data structures.\n"
"\n"
"\n"
"Submodules:\n"
"\n"
"* :mod:`bmesh.utils`\n"
"* :mod:`bmesh.types`\n"
);
static struct PyModuleDef BPy_BM_module_def = {
PyModuleDef_HEAD_INIT,

View File

@@ -23,10 +23,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/bmesh/bmesh_py_api.c
/** \file blender/python/bmesh/bmesh_py_select.c
* \ingroup pybmesh
*
* This file defines the 'bmesh' module.
* This file defines the types for 'BMesh.select_history'
* sequence and iterator.
*/
#include <Python.h>
@@ -47,9 +48,24 @@
#include "bmesh_py_api.h" /* own include */
static PyGetSetDef bpy_bmeditselseq_getseters[] = {
// {(char *)"verts", (getter)bpy_bmeditselseq_get, (setter)NULL, (char *)bpy_bmesh_verts_doc, (void *)BM_VERTS_OF_MESH},
PyDoc_STRVAR(bpy_bmeditselseq_active_doc,
"The last selected element or None (read-only).\n\n:type: :class:`BMVert`, :class:`BMEdge` or :class:`BMFace`"
);
static PyObject *bpy_bmeditselseq_active_get(BPy_BMEditSelSeq *self, void *UNUSED(closure))
{
BMEditSelection *ese;
BPY_BM_CHECK_OBJ(self);
if ((ese = self->bm->selected.last)) {
return BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head);
}
else {
Py_RETURN_NONE;
}
}
static PyGetSetDef bpy_bmeditselseq_getseters[] = {
{(char *)"active", (getter)bpy_bmeditselseq_active_get, (setter)NULL, (char *)bpy_bmeditselseq_active_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -71,19 +87,25 @@ static Py_ssize_t bpy_bmeditselseq_length(BPy_BMEditSelSeq *self)
static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, int keynum)
{
BMEditSelection *ese;
BPY_BM_CHECK_OBJ(self);
if (keynum < 0) keynum += bpy_bmeditselseq_length(self); /* only get length on negative value, may loop entire seq */
if (keynum >= 0) {
BMEditSelection *ese = BLI_findlink(&self->bm->selected, keynum);
if (ese) {
return BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head);
}
if (keynum < 0) {
ese = BLI_rfindlink(&self->bm->selected, -1 - keynum);
}
else {
ese = BLI_findlink(&self->bm->selected, keynum);
}
PyErr_Format(PyExc_IndexError,
"BMElemSeq[index]: index %d out of range", keynum);
return NULL;
if (ese) {
return BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head);
}
else {
PyErr_Format(PyExc_IndexError,
"BMElemSeq[index]: index %d out of range", keynum);
return NULL;
}
}
static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self, Py_ssize_t start, Py_ssize_t stop)
@@ -206,21 +228,21 @@ static int bpy_bmeditselseq_contains(BPy_BMEditSelSeq *self, PyObject *value)
}
static PySequenceMethods bpy_bmeditselseq_as_sequence = {
(lenfunc)bpy_bmeditselseq_length, /* sq_length */
(lenfunc)bpy_bmeditselseq_length, /* sq_length */
NULL, /* sq_concat */
NULL, /* sq_repeat */
(ssizeargfunc)bpy_bmeditselseq_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
(ssizeargfunc)bpy_bmeditselseq_subscript_int,/* sq_item */ /* Only set this so PySequence_Check() returns True */
NULL, /* sq_slice */
(ssizeobjargproc)NULL, /* sq_ass_item */
NULL, /* *was* sq_ass_slice */
(objobjproc)bpy_bmeditselseq_contains, /* sq_contains */
(objobjproc)bpy_bmeditselseq_contains, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods bpy_bmeditselseq_as_mapping = {
(lenfunc)bpy_bmeditselseq_length, /* mp_length */
(binaryfunc)bpy_bmeditselseq_subscript, /* mp_subscript */
(lenfunc)bpy_bmeditselseq_length, /* mp_length */
(binaryfunc)bpy_bmeditselseq_subscript, /* mp_subscript */
(objobjargproc)NULL, /* mp_ass_subscript */
};

View File

@@ -839,6 +839,10 @@ static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *ar
&vert_seq_len, &BPy_BMVert_Type,
TRUE, TRUE, "BMVert.copy_from_vert_interp(...)");
if (vert_array == NULL) {
return NULL;
}
BM_data_interp_from_verts(bm, vert_array[0], vert_array[1], self->v, CLAMPIS(fac, 0.0f, 1.0f));
PyMem_FREE(vert_array);
@@ -957,7 +961,7 @@ static PyObject *bpy_bmedge_other_vert(BPy_BMEdge *self, BPy_BMVert *value)
BPY_BM_CHECK_OBJ(value);
if (self->bm != value->bm) {
PyErr_SetString(PyExc_TypeError,
PyErr_SetString(PyExc_ValueError,
"BMEdge.other_vert(vert): vert is from another mesh");
return NULL;
}
@@ -1279,6 +1283,10 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
&vert_seq_len, &BPy_BMVert_Type,
TRUE, TRUE, "edges.new(...)");
if (vert_array == NULL) {
return NULL;
}
if (BM_edge_exists(vert_array[0], vert_array[1])) {
PyErr_SetString(PyExc_ValueError,
"edges.new(): this edge exists");
@@ -1342,6 +1350,10 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
&vert_seq_len, &BPy_BMVert_Type,
TRUE, TRUE, "faces.new(...)");
if (vert_array == NULL) {
return NULL;
}
/* check if the face exists */
if (BM_face_exists(bm, vert_array, vert_seq_len, NULL)) {
PyErr_SetString(PyExc_ValueError,
@@ -1564,7 +1576,7 @@ static PyObject *bpy_bmedgeseq_get(BPy_BMElemSeq *self, PyObject *args)
return NULL;
}
if ((e=BM_edge_exists(vert_array[0], vert_array[1]))) {
if ((e = BM_edge_exists(vert_array[0], vert_array[1]))) {
ret = BPy_BMEdge_CreatePyObject(bm, e);
}
else {
@@ -2050,6 +2062,10 @@ static void bpy_bmesh_dealloc(BPy_BMesh *self)
bm->py_handle = NULL;
}
if (self->py_owns) {
BM_mesh_free(bm);
}
PyObject_DEL(self);
}
@@ -2297,6 +2313,7 @@ void BPy_BM_init_types(void)
/* only 1 iteratir so far */
BPy_BMIter_Type.tp_iternext = (iternextfunc)bpy_bmiter_next;
BPy_BMIter_Type.tp_iter = PyObject_SelfIter;
BPy_BMesh_Type.tp_dealloc = (destructor)bpy_bmesh_dealloc;
BPy_BMVert_Type.tp_dealloc = (destructor)bpy_bmvert_dealloc;
@@ -2307,14 +2324,14 @@ void BPy_BM_init_types(void)
BPy_BMIter_Type.tp_dealloc = NULL;
/*
BPy_BMesh_Type.
BPy_BMVert_Type.
BPy_BMEdge_Type.
BPy_BMFace_Type.
BPy_BMLoop_Type.
BPy_BMElemSeq_Type.
BPy_BMIter_Type.
*/
* BPy_BMesh_Type.
* BPy_BMVert_Type.
* BPy_BMEdge_Type.
* BPy_BMFace_Type.
* BPy_BMLoop_Type.
* BPy_BMElemSeq_Type.
* BPy_BMIter_Type.
*/
BPy_BMesh_Type.tp_flags = Py_TPFLAGS_DEFAULT;
BPy_BMVert_Type.tp_flags = Py_TPFLAGS_DEFAULT;
@@ -2572,7 +2589,7 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
PyObject *seq_fast;
*r_size = 0;
if (!(seq_fast=PySequence_Fast(seq, error_prefix))) {
if (!(seq_fast = PySequence_Fast(seq, error_prefix))) {
return NULL;
}
else {
@@ -2600,7 +2617,7 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
if (Py_TYPE(item) != type) {
PyErr_Format(PyExc_TypeError,
"%s: expected '%.200', not '%.200s'",
"%s: expected '%.200s', not '%.200s'",
error_prefix, type->tp_name, Py_TYPE(item)->tp_name);
goto err_cleanup;
}
@@ -2613,7 +2630,7 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
/* trick so we can ensure all items have the same mesh,
* and allows us to pass the 'bm' as NULL. */
else if (do_bm_check && (bm && bm != item->bm)) {
PyErr_Format(PyExc_TypeError,
PyErr_Format(PyExc_ValueError,
"%s: %d %s is from another mesh",
error_prefix, i, type->tp_name);
goto err_cleanup;
@@ -2661,3 +2678,15 @@ err_cleanup:
return NULL;
}
}
PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len)
{
Py_ssize_t i;
PyObject *ret = PyTuple_New(elem_len);
for (i = 0; i < elem_len; i++) {
PyTuple_SET_ITEM(ret, i, BPy_BMElem_CreatePyObject(bm, elem[i]));
}
return ret;
}

View File

@@ -62,6 +62,7 @@ typedef struct BPy_BMElem {
typedef struct BPy_BMesh {
PyObject_VAR_HEAD
struct BMesh *bm; /* keep first */
char py_owns;
} BPy_BMesh;
/* element types */
@@ -101,7 +102,7 @@ typedef struct BPy_BMElemSeq {
* If this veriable is set, it will be used */
/* we hold a reference to this.
* check incase the owner becomes invalid on access */
* check in case the owner becomes invalid on access */
/* TODO - make this a GC'd object!, will function OK without this though */
BPy_BMElem *py_ele;
@@ -137,6 +138,9 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
const char do_unique_check, const char do_bm_check,
const char *error_prefix);
PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len);
#define BPY_BM_CHECK_OBJ(obj) if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return NULL; } (void)0
#define BPY_BM_CHECK_INT(obj) if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { return -1; } (void)0

View File

@@ -38,6 +38,8 @@
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "bmesh_py_utils.h" /* own include */
@@ -196,6 +198,67 @@ static PyObject *bpy_bm_utils_vert_dissolve(PyObject *UNUSED(self), PyObject *ar
return PyBool_FromLong((BM_vert_dissolve(bm, py_vert->v)));
}
PyDoc_STRVAR(bpy_bm_utils_vert_separate_doc,
".. method:: vert_separate(vert, edges)\n"
"\n"
" Separate this vertex at every edge.\n"
"\n"
" :arg vert: The vert to be separated.\n"
" :type vert: :class:`BMVert`\n"
" :arg edges: The edges to separated.\n"
" :type edges: :class:`BMEdge`\n"
" :return: The newly separated verts (including the vertex passed).\n"
" :rtype: tuple of :class:`BMVert`\n"
);
static PyObject *bpy_bm_utils_vert_separate(PyObject *UNUSED(self), PyObject *args)
{
BPy_BMVert *py_vert;
PyObject *edge_seq;
BMesh *bm;
BMVert **elem;
int elem_len;
/* edges to split */
BMEdge **edge_array;
Py_ssize_t edge_array_len;
PyObject *ret;
if (!PyArg_ParseTuple(args, "O!O:vert_separate",
&BPy_BMVert_Type, &py_vert,
&edge_seq))
{
return NULL;
}
BPY_BM_CHECK_OBJ(py_vert);
bm = py_vert->bm;
edge_array = BPy_BMElem_PySeq_As_Array(&bm, edge_seq, 0, PY_SSIZE_T_MAX,
&edge_array_len, &BPy_BMEdge_Type,
TRUE, TRUE, "vert_separate(...)");
if (edge_array == NULL) {
return NULL;
}
if (BM_vert_separate(bm, py_vert->v, &elem, &elem_len, edge_array, edge_array_len)) {
/* return collected verts */
ret = BPy_BMElem_Array_As_Tuple(bm, (BMHeader **)elem, elem_len);
MEM_freeN(elem);
}
else {
ret = PyTuple_New(0);
}
PyMem_FREE(edge_array);
return ret;
}
PyDoc_STRVAR(bpy_bm_utils_edge_split_doc,
".. method:: edge_split(edge, vert, fac)\n"
@@ -291,7 +354,7 @@ static PyObject *bpy_bm_utils_edge_rotate(PyObject *UNUSED(self), PyObject *args
bm = py_edge->bm;
e_new = BM_edge_rotate(bm, py_edge->e, do_ccw);
e_new = BM_edge_rotate(bm, py_edge->e, do_ccw, 0); /* BMESH_TODO - expose to API */
if (e_new) {
return BPy_BMEdge_CreatePyObject(bm, e_new);
@@ -363,7 +426,7 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args)
f_new = BM_face_split(bm, py_face->f,
py_vert_a->v, py_vert_b->v,
&l_new, py_edge_example ? py_edge_example->e : NULL);
&l_new, py_edge_example ? py_edge_example->e : NULL, FALSE); /* BMESH_TODO, make arg */
if (f_new && l_new) {
PyObject *ret = PyTuple_New(2);
@@ -408,6 +471,8 @@ static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *value)
* --------------------------- */
f_new = BM_faces_join(bm, face_array, (int)face_seq_len);
PyMem_FREE(face_array);
if (f_new) {
return BPy_BMFace_CreatePyObject(bm, f_new);
}
@@ -417,6 +482,68 @@ static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *value)
}
PyDoc_STRVAR(bpy_bm_utils_face_vert_separate_doc,
".. method:: face_vert_separate(face, vert)\n"
"\n"
" Rip a vertex in a face away and add a new vertex.\n"
"\n"
" :arg face: The face to separate.\n"
" :type face: :class:`BMFace`\n"
" :arg vert: A vertex in the face to separate.\n"
" :type vert: :class:`BMVert`\n"
" :return vert: The newly created vertex or None of failure.\n"
" :rtype vert: :class:`BMVert`\n"
"\n"
" .. note::\n"
"\n"
" This is the same as loop_separate, and has only been added for convenience.\n"
);
static PyObject *bpy_bm_utils_face_vert_separate(PyObject *UNUSED(self), PyObject *args)
{
BPy_BMFace *py_face;
BPy_BMVert *py_vert;
BMesh *bm;
BMLoop *l;
BMVert *v_new;
if (!PyArg_ParseTuple(args, "O!O!:face_vert_separate",
&BPy_BMFace_Type, &py_face,
&BPy_BMVert_Type, &py_vert))
{
return NULL;
}
BPY_BM_CHECK_OBJ(py_face);
BPY_BM_CHECK_OBJ(py_vert);
bm = py_face->bm;
if (bm != py_vert->bm) {
PyErr_SetString(PyExc_ValueError,
"mesh elements are from different meshes");
return NULL;
}
l = BM_face_vert_share_loop(py_face->f, py_vert->v);
if (l == NULL) {
PyErr_SetString(PyExc_ValueError,
"vertex not found in face");
return NULL;
}
v_new = BM_face_loop_separate(bm, l);
if (v_new != l->v) {
return BPy_BMVert_CreatePyObject(bm, v_new);
}
else {
Py_RETURN_NONE;
}
}
PyDoc_STRVAR(bpy_bm_utils_face_flip_doc,
".. method:: face_flip(faces)\n"
"\n"
@@ -442,15 +569,56 @@ static PyObject *bpy_bm_utils_face_flip(PyObject *UNUSED(self), BPy_BMFace *valu
}
PyDoc_STRVAR(bpy_bm_utils_loop_separate_doc,
".. method:: loop_separate(loop)\n"
"\n"
" Rip a vertex in a face away and add a new vertex.\n"
"\n"
" :arg loop: The to separate.\n"
" :type loop: :class:`BMFace`\n"
" :return vert: The newly created vertex or None of failure.\n"
" :rtype vert: :class:`BMVert`\n"
);
static PyObject *bpy_bm_utils_loop_separate(PyObject *UNUSED(self), BPy_BMLoop *value)
{
BMesh *bm;
BMVert *v_new;
if (!BPy_BMLoop_Check(value)) {
PyErr_Format(PyExc_TypeError,
"loop_separate(loop): BMLoop expected, not '%.200s'",
Py_TYPE(value)->tp_name);
return NULL;
}
BPY_BM_CHECK_OBJ(value);
bm = value->bm;
v_new = BM_face_loop_separate(bm, value->l);
if (v_new != value->l->v) {
return BPy_BMVert_CreatePyObject(bm, v_new);
}
else {
Py_RETURN_NONE;
}
}
static struct PyMethodDef BPy_BM_utils_methods[] = {
{"vert_collapse_edge", (PyCFunction)bpy_bm_utils_vert_collapse_edge, METH_VARARGS, bpy_bm_utils_vert_collapse_edge_doc},
{"vert_collapse_faces", (PyCFunction)bpy_bm_utils_vert_collapse_faces, METH_VARARGS, bpy_bm_utils_vert_collapse_faces_doc},
{"vert_dissolve", (PyCFunction)bpy_bm_utils_vert_dissolve, METH_VARARGS, bpy_bm_utils_vert_dissolve_doc},
{"vert_dissolve", (PyCFunction)bpy_bm_utils_vert_dissolve, METH_VARARGS, bpy_bm_utils_vert_dissolve_doc}, /* could use METH_O */
{"vert_separate", (PyCFunction)bpy_bm_utils_vert_separate, METH_VARARGS, bpy_bm_utils_vert_separate_doc},
{"edge_split", (PyCFunction)bpy_bm_utils_edge_split, METH_VARARGS, bpy_bm_utils_edge_split_doc},
{"edge_rotate", (PyCFunction)bpy_bm_utils_edge_rotate, METH_VARARGS, bpy_bm_utils_edge_rotate_doc},
{"face_split", (PyCFunction)bpy_bm_utils_face_split, METH_VARARGS, bpy_bm_utils_face_split_doc},
{"face_join", (PyCFunction)bpy_bm_utils_face_join, METH_O, bpy_bm_utils_face_join_doc},
{"face_vert_separate", (PyCFunction)bpy_bm_utils_face_vert_separate, METH_VARARGS, bpy_bm_utils_face_vert_separate_doc},
{"face_flip", (PyCFunction)bpy_bm_utils_face_flip, METH_O, bpy_bm_utils_face_flip_doc},
{"loop_separate", (PyCFunction)bpy_bm_utils_loop_separate, METH_O, bpy_bm_utils_loop_separate_doc},
{NULL, NULL, 0, NULL}
};

View File

@@ -75,7 +75,7 @@ extern PyTypeObject BGL_bufferType;
/*@ By golly George! It looks like fancy pants macro time!!! */
/*
#if 0 /* unused so far */
#define int_str "i"
#define int_var(number) bgl_int##number
#define int_ref(number) &bgl_int##number
@@ -85,7 +85,7 @@ extern PyTypeObject BGL_bufferType;
#define float_var(number) bgl_float##number
#define float_ref(number) &bgl_float##number
#define float_def(number) float float_var(number)
*/
#endif
/* TYPE_str is the string to pass to Py_ArgParse (for the format) */
/* TYPE_var is the name to pass to the GL function */

View File

@@ -244,7 +244,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
if (newmodule)
return newmodule;
PyErr_Fetch(&exception, &err, &tb); /* get the python error incase we cant import as blender text either */
PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */
/* importing from existing modules failed, see if we have this module as blender text */
newmodule = bpy_text_import_name(name, &found);

View File

@@ -399,9 +399,9 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
if ((val.array.type= idp_sequence_type(ob)) == -1)
return "only floats, ints and dicts are allowed in ID property arrays";
/*validate sequence and derive type.
we assume IDP_INT unless we hit a float
number; then we assume it's */
/* validate sequence and derive type.
* we assume IDP_INT unless we hit a float
* number; then we assume it's */
val.array.len = PySequence_Size(ob);
@@ -443,8 +443,8 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
keys = PyMapping_Keys(ob);
vals = PyMapping_Values(ob);
/*we allocate the group first; if we hit any invalid data,
we can delete it easily enough.*/
/* we allocate the group first; if we hit any invalid data,
* we can delete it easily enough.*/
prop = IDP_New(IDP_GROUP, &val, name);
len = PyMapping_Length(ob);
for (i=0; i<len; i++) {
@@ -666,9 +666,9 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
pyform = BPy_IDGroup_MapDataToPy(idprop);
if (!pyform) {
/*ok something bad happened with the pyobject,
so don't remove the prop from the group. if pyform is
NULL, then it already should have raised an exception.*/
/* ok something bad happened with the pyobject,
* so don't remove the prop from the group. if pyform is
* NULL, then it already should have raised an exception.*/
return NULL;
}
@@ -1324,12 +1324,6 @@ PyTypeObject BPy_IDArray_Type = {
/*********** ID Property Group iterator ********/
static PyObject *IDGroup_Iter_iterself(PyObject *self)
{
Py_XINCREF(self);
return self;
}
static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
{
return PyUnicode_FromFormat("(ID Property Group Iter \"%s\")", self->group->prop->name);
@@ -1412,7 +1406,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
/*** Added in release 2.2 ***/
/* Iterators */
IDGroup_Iter_iterself, /* getiterfunc tp_iter; */
PyObject_SelfIter, /* getiterfunc tp_iter; */
(iternextfunc) BPy_Group_Iter_Next, /* iternextfunc tp_iternext; */
};

View File

@@ -50,11 +50,11 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
Py_ssize_t value_len;
Py_ssize_t i;
if (!(value_fast=PySequence_Fast(value, error_prefix))) {
if (!(value_fast = PySequence_Fast(value, error_prefix))) {
return -1;
}
value_len= PySequence_Fast_GET_SIZE(value_fast);
value_len = PySequence_Fast_GET_SIZE(value_fast);
if (value_len != length) {
Py_DECREF(value);
@@ -69,13 +69,13 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
if (is_double) {
double *array_double= array;
for (i=0; i<length; i++) {
array_double[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
array_double[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else {
float *array_float= array;
for (i=0; i<length; i++) {
array_float[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
array_float[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
}
@@ -83,13 +83,13 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
/* could use is_double for 'long int' but no use now */
int *array_int= array;
for (i=0; i<length; i++) {
array_int[i]= PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else if (type == &PyBool_Type) {
int *array_bool= array;
for (i=0; i<length; i++) {
array_bool[i]= (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
}
}
else {
@@ -332,7 +332,7 @@ PyObject *PyC_ExceptionBuffer(void)
Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
Py_INCREF(stderr_backup);
PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
PySys_SetObject("stdout", string_io); // both of these are freed when restoring
PySys_SetObject("stderr", string_io);
PyErr_Restore(error_type, error_value, error_traceback);
@@ -419,17 +419,17 @@ PyObject *PyC_UnicodeFromByte(const char *str)
}
/*****************************************************************************
* Description: This function creates a new Python dictionary object.
* note: dict is owned by sys.modules["__main__"] module, reference is borrowed
* note: important we use the dict from __main__, this is what python expects
for 'pickle' to work as well as strings like this...
>> foo = 10
>> print(__import__("__main__").foo)
*
* note: this overwrites __main__ which gives problems with nested calles.
* be sure to run PyC_MainModule_Backup & PyC_MainModule_Restore if there is
* any chance that python is in the call stack.
*****************************************************************************/
* Description: This function creates a new Python dictionary object.
* note: dict is owned by sys.modules["__main__"] module, reference is borrowed
* note: important we use the dict from __main__, this is what python expects
* for 'pickle' to work as well as strings like this...
* >> foo = 10
* >> print(__import__("__main__").foo)
*
* note: this overwrites __main__ which gives problems with nested calles.
* be sure to run PyC_MainModule_Backup & PyC_MainModule_Restore if there is
* any chance that python is in the call stack.
****************************************************************************/
PyObject *PyC_DefaultNameSpace(const char *filename)
{
PyInterpreterState *interp= PyThreadState_GET()->interp;
@@ -475,7 +475,7 @@ void PyC_SetHomePath(const char *py_path_bundle)
#ifdef __APPLE__
/* OSX allow file/directory names to contain : character (represented as / in the Finder)
but current Python lib (release 3.1.1) doesn't handle these correctly */
* but current Python lib (release 3.1.1) doesn't handle these correctly */
if (strchr(py_path_bundle, ':'))
printf("Warning : Blender application is located in a path containing : or / chars\
\nThis may make python import function fail\n");
@@ -483,7 +483,7 @@ void PyC_SetHomePath(const char *py_path_bundle)
#ifdef _WIN32
/* cmake/MSVC debug build crashes without this, why only
in this case is unknown.. */
* in this case is unknown.. */
{
BLI_setenv("PYTHONPATH", py_path_bundle);
}

View File

@@ -229,9 +229,9 @@ static PyObject *bpy_import_test(const char *modname)
return mod;
}
/*****************************************************************************
* Description: Creates the bpy module and adds it to sys.modules for importing
*****************************************************************************/
/******************************************************************************
* Description: Creates the bpy module and adds it to sys.modules for importing
******************************************************************************/
void BPy_init_modules(void)
{
extern BPy_StructRNA *bpy_context_module;

View File

@@ -108,6 +108,8 @@ static PyObject *make_app_info(void)
PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
#define SetStrItem(str) \
PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
#define SetBytesItem(str) \
PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
#define SetObjItem(obj) \
PyStructSequence_SET_ITEM(app_info, pos++, obj)
@@ -121,27 +123,28 @@ static PyObject *make_app_info(void)
SetStrItem(BLI_program_path());
SetObjItem(PyBool_FromLong(G.background));
/* build info */
/* build info, use bytes since we can't assume _any_ encoding:
* see patch [#30154] for issue */
#ifdef BUILD_DATE
SetStrItem(build_date);
SetStrItem(build_time);
SetStrItem(build_rev);
SetStrItem(build_platform);
SetStrItem(build_type);
SetStrItem(build_cflags);
SetStrItem(build_cxxflags);
SetStrItem(build_linkflags);
SetStrItem(build_system);
SetBytesItem(build_date);
SetBytesItem(build_time);
SetBytesItem(build_rev);
SetBytesItem(build_platform);
SetBytesItem(build_type);
SetBytesItem(build_cflags);
SetBytesItem(build_cxxflags);
SetBytesItem(build_linkflags);
SetBytesItem(build_system);
#else
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
#endif
SetObjItem(BPY_app_ffmpeg_struct());
@@ -149,6 +152,7 @@ static PyObject *make_app_info(void)
#undef SetIntItem
#undef SetStrItem
#undef SetBytesItem
#undef SetObjItem
if (PyErr_Occurred()) {

View File

@@ -68,11 +68,11 @@ static PyStructSequence_Desc app_cb_info_desc = {
(sizeof(app_cb_info_fields) / sizeof(PyStructSequence_Field)) - 1
};
/*
#if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field))))
# error "Callbacks are out of sync"
#if 0
# if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field))))
# error "Callbacks are out of sync"
# endif
#endif
*/
/* --------------------------------------------------------------------------*/
/* permanent tagging code */

View File

@@ -77,7 +77,7 @@
/* for internal use, when starting and ending python scripts */
/* incase a python script triggers another python call, stop bpy_context_clear from invalidating */
/* in case a python script triggers another python call, stop bpy_context_clear from invalidating */
static int py_call_level = 0;
BPy_StructRNA *bpy_context_module = NULL; /* for fast access */
@@ -671,11 +671,11 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
PyObject *list_item = PySequence_Fast_GET_ITEM(seq_fast, i);
if (BPy_StructRNA_Check(list_item)) {
/*
#if 0
CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get");
link->ptr = ((BPy_StructRNA *)item)->ptr;
BLI_addtail(&result->list, link);
*/
#endif
ptr = &(((BPy_StructRNA *)list_item)->ptr);
CTX_data_list_add(result, ptr->id.data, ptr->type, ptr->data);
}

View File

@@ -92,5 +92,5 @@ void BPY_atexit_unregister(void)
BLI_assert(func_bpy_atregister != NULL);
atexit_func_call("unregister", func_bpy_atregister);
func_bpy_atregister = NULL; /* don't really need to set but just incase */
func_bpy_atregister = NULL; /* don't really need to set but just in case */
}

View File

@@ -257,8 +257,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
}
BKE_reports_clear(reports);
if ((reports->flag & RPT_FREE) == 0)
{
if ((reports->flag & RPT_FREE) == 0) {
MEM_freeN(reports);
}
}
@@ -434,7 +433,7 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value)
op = PyMem_MALLOC(sizeof(wmOperator));
memset(op, 0, sizeof(wmOperator));
#endif
BLI_strncpy(op->idname, op->idname, sizeof(op->idname)); /* incase its needed */
BLI_strncpy(op->idname, op->idname, sizeof(op->idname)); /* in case its needed */
op->type = ot;
RNA_pointer_create(NULL, &RNA_Operator, op, &ptr);

View File

@@ -59,13 +59,13 @@ extern BPy_StructRNA *bpy_context_module;
static EnumPropertyItem property_flag_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem property_flag_enum_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
{PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""},
{0, NULL, 0, NULL, NULL}};

View File

@@ -121,7 +121,7 @@ int pyrna_prop_validity_check(BPy_PropertyRNA *self)
static void pyrna_invalidate(BPy_DummyPointerRNA *self)
{
self->ptr.type = NULL; /* this is checked for validity */
self->ptr.id.data = NULL; /* should not be needed but prevent bad pointer access, just incase */
self->ptr.id.data = NULL; /* should not be needed but prevent bad pointer access, just in case */
}
#endif
@@ -1284,7 +1284,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
else {
const char *ptr_name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
/* prefer not fail silently incase of api errors, maybe disable it later */
/* prefer not fail silently in case of api errors, maybe disable it later */
printf("RNA Warning: Current value \"%d\" "
"matches no enum in '%s', '%s', '%s'\n",
val, RNA_struct_identifier(ptr->type),
@@ -1309,11 +1309,11 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
if (free)
MEM_freeN(enum_item);
/*
#if 0
PyErr_Format(PyExc_AttributeError,
"RNA Error: Current value \"%d\" matches no enum", val);
ret = NULL;
*/
#endif
}
}
@@ -2549,10 +2549,12 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
{
PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
/*if (PyUnicode_Check(key)) {
#if 0
if (PyUnicode_Check(key)) {
return pyrna_prop_array_subscript_str(self, _PyUnicode_AsString(key));
}
else */
else
#endif
if (PyIndex_Check(key)) {
Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
@@ -2619,7 +2621,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
if (PySequence_Fast_GET_SIZE(value) != stop-start) {
Py_DECREF(value);
PyErr_SetString(PyExc_TypeError,
"bpy_prop_array[slice] = value: resizing bpy_struct arrays isn't supported");
"bpy_prop_array[slice] = value: re-sizing bpy_struct arrays isn't supported");
return -1;
}
@@ -3359,7 +3361,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
PYRNA_STRUCT_CHECK_OBJ(self);
/* Include this incase this instance is a subtype of a python class
/* Include this in case this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
* */
ret = PyList_New(0);
@@ -3496,7 +3498,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
name);
ret = NULL;
#endif
/* Include this incase this instance is a subtype of a python class
/* Include this in case this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
*
* Also needed to return methods when its not a subtype
@@ -3576,14 +3578,14 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
if (srna == NULL) {
/* allow setting on unregistered classes which can be registered later on */
/*
#if 0
if (value && is_deferred_prop) {
PyErr_Format(PyExc_AttributeError,
"pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'",
((PyTypeObject *)cls)->tp_name);
return -1;
}
*/
#endif
/* srna_from_self may set an error */
PyErr_Clear();
return PyType_Type.tp_setattro(cls, attr, value);
@@ -3693,7 +3695,7 @@ static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)
PyObject *ret;
PointerRNA r_ptr;
/* Include this incase this instance is a subtype of a python class
/* Include this in case this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
* */
ret = PyList_New(0);
@@ -4571,14 +4573,14 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
else if (PyType_IsSubtype(Py_TYPE(base), &pyrna_struct_Type)) {
/* this almost never runs, only when using user defined subclasses of built-in object.
* this isn't common since its NOT related to registerable subclasses. eg:
>>> class MyObSubclass(bpy.types.Object):
... def test_func(self):
... print(100)
...
>>> myob = MyObSubclass(bpy.context.object)
>>> myob.test_func()
100
*
* >>> class MyObSubclass(bpy.types.Object):
* ... def test_func(self):
* ... print(100)
* ...
* >>> myob = MyObSubclass(bpy.context.object)
* >>> myob.test_func()
* 100
*
* Keep this since it could be useful.
*/
@@ -4866,7 +4868,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
}
/* for testing */
/*
#if 0
{
const char *fn;
int lineno;
@@ -4874,7 +4876,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
printf("pyrna_func_call > %.200s.%.200s : %.200s:%d\n",
RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), fn, lineno);
}
*/
#endif
/* include the ID pointer for pyrna_param_to_py() so we can include the
* ID pointer on return values, this only works when returned values have
@@ -5104,14 +5106,14 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
#ifdef DEBUG_STRING_FREE
/*
#if 0
if (PyList_GET_SIZE(string_free_ls)) {
printf("%.200s.%.200s(): has %d strings\n",
RNA_struct_identifier(self_ptr->type),
RNA_function_identifier(self_func),
(int)PyList_GET_SIZE(string_free_ls));
}
*/
#endif
Py_DECREF(string_free_ls);
#undef DEBUG_STRING_FREE
#endif
@@ -6018,10 +6020,10 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
* mainly for the purposing of matching the C/rna type hierarchy */
else {
/* subclass equivalents
- class myClass(myBase):
some = 'value' # or ...
- myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
*/
* - class myClass(myBase):
* some = 'value' # or ...
* - myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
*/
/* Assume RNA_struct_py_type_get(srna) was already checked */
PyObject *py_base = pyrna_srna_PyBase(srna);
@@ -6523,8 +6525,10 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
/* Since this is a class dict, ignore args that can't be passed */
/* for testing only */
/* PyC_ObSpit("Why doesn't this work??", item);
PyErr_Print(); */
#if 0
PyC_ObSpit("Why doesn't this work??", item);
PyErr_Print();
#endif
PyErr_Clear();
}
}
@@ -6886,9 +6890,12 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
rna_disallow_writes = TRUE;
/* 'almost' all the time calling the class isn't needed.
* We could just do...
* We could just do... */
#if 0
py_class_instance = py_srna;
Py_INCREF(py_class_instance);
#endif
/*
* This would work fine but means __init__ functions wouldnt run.
* none of blenders default scripts use __init__ but its nice to call it
* for general correctness. just to note why this is here when it could be safely removed.
@@ -7230,14 +7237,14 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
return NULL;
/* fails in cases, cant use this check but would like to :| */
/*
#if 0
if (RNA_struct_py_type_get(srna)) {
PyErr_Format(PyExc_ValueError,
"register_class(...): %.200s's parent class %.200s is already registered, this is not allowed",
((PyTypeObject *)py_class)->tp_name, RNA_struct_identifier(srna));
return NULL;
}
*/
#endif
/* check that we have a register callback for this type */
reg = RNA_struct_register(srna);
@@ -7271,7 +7278,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
pyrna_subtype_set_rna(py_class, srna_new); /* takes a ref to py_class */
/* old srna still references us, keep the check incase registering somehow can free it */
/* old srna still references us, keep the check in case registering somehow can free it */
if (RNA_struct_py_type_get(srna)) {
RNA_struct_py_type_set(srna, NULL);
// Py_DECREF(py_class); // should be able to do this XXX since the old rna adds a new ref.
@@ -7352,11 +7359,13 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
return NULL;
}
/*if (PyDict_GetItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna) == NULL) {
#if 0
if (PyDict_GetItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna) == NULL) {
PWM_cursor_wait(0);
PyErr_SetString(PyExc_ValueError, "unregister_class(): not a registered as a subclass");
return NULL;
}*/
}
#endif
if (!pyrna_write_check()) {
PyErr_Format(PyExc_RuntimeError,

View File

@@ -50,17 +50,17 @@ typedef void (*RNA_SetArrayFunc)(PointerRNA *, PropertyRNA *, const char *);
typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *);
/*
arr[3][4][5]
0 1 2 <- dimension index
*/
* arr[3][4][5]
* 0 1 2 <- dimension index
*/
/*
arr[2] = x
py_to_array_index(arraydim=0, arrayoffset=0, index=2)
validate_array(lvalue_dim=0)
... make real index ...
*/
* arr[2] = x
*
* py_to_array_index(arraydim=0, arrayoffset=0, index=2)
* validate_array(lvalue_dim=0)
* ... make real index ...
*/
/* arr[3] = x, self->arraydim is 0, lvalue_dim is 1 */
/* Ensures that a python sequence has expected number of items/sub-items and items are of desired type. */
@@ -101,8 +101,8 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
* dim = 0 */
else if (PySequence_Size(item) != dimsize[dim + 1]) {
/* BLI_snprintf(error_str, error_str_size,
"sequences of dimension %d should contain %d items",
(int)dim + 1, (int)dimsize[dim + 1]); */
* "sequences of dimension %d should contain %d items",
* (int)dim + 1, (int)dimsize[dim + 1]); */
PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items",
error_prefix, (int)dim + 1, (int)dimsize[dim + 1]);
ok = 0;
@@ -205,8 +205,8 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
/* length is flexible */
if (!RNA_property_dynamic_array_set_length(ptr, prop, tot)) {
/* BLI_snprintf(error_str, error_str_size,
"%s.%s: array length cannot be changed to %d",
RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */
* "%s.%s: array length cannot be changed to %d",
* RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */
PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d",
error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot);
return -1;
@@ -232,18 +232,18 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
len = 1;
/* arr[3][4][5]
arr[2] = x
dimsize = {4, 5}
dimsize[1] = 4
dimsize[2] = 5
lvalue_dim = 0, totdim = 3
arr[2][3] = x
lvalue_dim = 1
arr[2][3][4] = x
lvalue_dim = 2 */
*
* arr[2] = x
* dimsize = {4, 5}
* dimsize[1] = 4
* dimsize[2] = 5
* lvalue_dim = 0, totdim = 3
*
* arr[2][3] = x
* lvalue_dim = 1
*
* arr[2][3][4] = x
* lvalue_dim = 2 */
for (i = lvalue_dim; i < totdim; i++)
len *= dimsize[i];
}
@@ -462,12 +462,12 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop,
/* convert index */
/* arr[3][4][5]
arr[2] = x
lvalue_dim = 0, index = 0 + 2 * 4 * 5
arr[2][3] = x
lvalue_dim = 1, index = 40 + 3 * 5 */
*
* arr[2] = x
* lvalue_dim = 0, index = 0 + 2 * 4 * 5
*
* arr[2][3] = x
* lvalue_dim = 1, index = 40 + 3 * 5 */
lvalue_dim++;
@@ -677,12 +677,12 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
ret->arraydim = arraydim + 1;
/* arr[3][4][5]
x = arr[2]
index = 0 + 2 * 4 * 5
x = arr[2][3]
index = offset + 3 * 5 */
*
* x = arr[2]
* index = 0 + 2 * 4 * 5
*
* x = arr[2][3]
* index = offset + 3 * 5 */
for (i = arraydim + 1; i < totdim; i++)
index *= dimsize[i];

View File

@@ -29,6 +29,9 @@
#include <Python.h>
#include <frameobject.h>
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "bpy_traceback.h"
static const char *traceback_filepath(PyTracebackObject *tb, PyObject **coerce)
@@ -127,8 +130,8 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
if (parse_syntax_error(value, &message, &filename, lineno, offset, &text)) {
/* python adds a '/', prefix, so check for both */
if ((strcmp(filename, filepath) == 0) ||
((filename[0] == '\\' || filename[0] == '/') && strcmp(filename + 1, filepath) == 0)
if ((BLI_path_cmp(filename, filepath) == 0) ||
((filename[0] == '\\' || filename[0] == '/') && BLI_path_cmp(filename + 1, filepath) == 0)
) {
/* good */
}
@@ -152,7 +155,7 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
{
PyObject *coerce;
const char *tb_filepath = traceback_filepath(tb, &coerce);
const int match = strcmp(tb_filepath, filepath) != 0;
const int match = BLI_path_cmp(tb_filepath, filepath) != 0;
Py_DECREF(coerce);
if (match) {

View File

@@ -70,7 +70,7 @@ static struct PyModuleDef gpumodule = {
"gpu", /* name of module */
M_gpu_doc, /* module documentation */
-1, /* size of per-interpreter state of the module,
or -1 if the module keeps state in global variables. */
* or -1 if the module keeps state in global variables. */
NULL, NULL, NULL, NULL, NULL
};

View File

@@ -163,7 +163,7 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
#endif
{
PyObject *value_fast = NULL;
//*array = NULL;
// *array = NULL;
/* non list/tuple cases */
if (!(value_fast = PySequence_Fast(value, error_prefix))) {
@@ -257,7 +257,7 @@ int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
}
/*---------------------- EXPP_VectorsAreEqual -------------------------
Builds on EXPP_FloatsAreEqual to test vectors */
* Builds on EXPP_FloatsAreEqual to test vectors */
int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps)
{
int x;

View File

@@ -619,7 +619,7 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2)
}
/* -obj
returns the negative of this object */
* returns the negative of this object */
static PyObject *Color_neg(ColorObject *self)
{
float tcol[COLOR_SIZE];
@@ -848,10 +848,10 @@ PyTypeObject color_Type = {
};
//------------------------Color_CreatePyObject (internal)-------------
//creates a new color object
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
(i.e. it was allocated elsewhere by MEM_mallocN())
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
(i.e. it must be created here with PyMEM_malloc())*/
/* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
* (i.e. it was allocated elsewhere by MEM_mallocN())
* pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
* (i.e. it must be created here with PyMEM_malloc())*/
PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
{
ColorObject *self;

View File

@@ -42,10 +42,10 @@ typedef struct {
BASE_MATH_MEMBERS(col);
} ColorObject;
/*struct data contains a pointer to the actual data that the
object uses. It can use either PyMem allocated data (which will
be stored in py_data) or be a wrapper for data allocated through
blender (stored in blend_data). This is an either/or struct not both*/
/* struct data contains a pointer to the actual data that the
* object uses. It can use either PyMem allocated data (which will
* be stored in py_data) or be a wrapper for data allocated through
* blender (stored in blend_data). This is an either/or struct not both*/
//prototypes
PyObject *Color_CreatePyObject( float *col, int type, PyTypeObject *base_type);

View File

@@ -691,10 +691,10 @@ PyTypeObject euler_Type = {
};
//------------------------Euler_CreatePyObject (internal)-------------
//creates a new euler object
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
(i.e. it was allocated elsewhere by MEM_mallocN())
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
(i.e. it must be created here with PyMEM_malloc())*/
/* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
* (i.e. it was allocated elsewhere by MEM_mallocN())
* pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
* (i.e. it must be created here with PyMEM_malloc())*/
PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type)
{
EulerObject *self;

View File

@@ -44,10 +44,10 @@ typedef struct {
} EulerObject;
/*struct data contains a pointer to the actual data that the
object uses. It can use either PyMem allocated data (which will
be stored in py_data) or be a wrapper for data allocated through
blender (stored in blend_data). This is an either/or struct not both */
/* struct data contains a pointer to the actual data that the
* object uses. It can use either PyMem allocated data (which will
* be stored in py_data) or be a wrapper for data allocated through
* blender (stored in blend_data). This is an either/or struct not both */
//prototypes
PyObject *Euler_CreatePyObject( float *eul, short order, int type, PyTypeObject *base_type);

View File

@@ -1218,8 +1218,6 @@ static PyObject *Matrix_invert(MatrixObject *self)
z++;
}
}
/*transpose
Matrix_transpose(self);*/
}
else {
PyErr_SetString(PyExc_ValueError,
@@ -1631,15 +1629,15 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
}
/*---------------------SEQUENCE PROTOCOLS------------------------
----------------------------len(object)------------------------
sequence length */
* ----------------------------len(object)------------------------
* sequence length */
static int Matrix_len(MatrixObject *self)
{
return (self->num_row);
}
/*----------------------------object[]---------------------------
sequence accessor (get)
the wrapped vector gives direct access to the matrix data */
* sequence accessor (get)
* the wrapped vector gives direct access to the matrix data */
static PyObject *Matrix_item_row(MatrixObject *self, int row)
{
if (BaseMath_ReadCallback(self) == -1)
@@ -1669,7 +1667,7 @@ static PyObject *Matrix_item_col(MatrixObject *self, int col)
}
/*----------------------------object[]-------------------------
sequence accessor (set) */
* sequence accessor (set) */
static int Matrix_ass_item_row(MatrixObject *self, int row, PyObject *value)
{
@@ -1724,7 +1722,7 @@ static int Matrix_ass_item_col(MatrixObject *self, int col, PyObject *value)
/*----------------------------object[z:y]------------------------
sequence slice (get)*/
* sequence slice (get)*/
static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
{
@@ -1748,7 +1746,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
return tuple;
}
/*----------------------------object[z:y]------------------------
sequence slice (set)*/
* sequence slice (set)*/
static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value)
{
PyObject *value_fast = NULL;
@@ -1807,7 +1805,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
}
}
/*------------------------NUMERIC PROTOCOLS----------------------
------------------------obj + obj------------------------------*/
*------------------------obj + obj------------------------------*/
static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
{
float mat[16];
@@ -1839,7 +1837,7 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
return Matrix_CreatePyObject(mat, mat1->num_col, mat1->num_row, Py_NEW, Py_TYPE(mat1));
}
/*------------------------obj - obj------------------------------
subtraction*/
* subtraction */
static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
{
float mat[16];
@@ -1872,7 +1870,7 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
return Matrix_CreatePyObject(mat, mat1->num_col, mat1->num_row, Py_NEW, Py_TYPE(mat1));
}
/*------------------------obj * obj------------------------------
mulplication*/
* mulplication */
static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar)
{
float tmat[16];

View File

@@ -854,7 +854,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
}
/* -obj
returns the negative of this object*/
* returns the negative of this object*/
static PyObject *Quaternion_neg(QuaternionObject *self)
{
float tquat[QUAT_SIZE];
@@ -1232,9 +1232,9 @@ PyTypeObject quaternion_Type = {
//------------------------Quaternion_CreatePyObject (internal)-------------
//creates a new quaternion object
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
(i.e. it was allocated elsewhere by MEM_mallocN())
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
(i.e. it must be created here with PyMEM_malloc())*/
* (i.e. it was allocated elsewhere by MEM_mallocN())
* pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
* (i.e. it must be created here with PyMEM_malloc())*/
PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type)
{
QuaternionObject *self;

View File

@@ -42,10 +42,10 @@ typedef struct {
BASE_MATH_MEMBERS(quat);
} QuaternionObject;
/*struct data contains a pointer to the actual data that the
object uses. It can use either PyMem allocated data (which will
be stored in py_data) or be a wrapper for data allocated through
blender (stored in blend_data). This is an either/or struct not both*/
/* struct data contains a pointer to the actual data that the
* object uses. It can use either PyMem allocated data (which will
* be stored in py_data) or be a wrapper for data allocated through
* blender (stored in blend_data). This is an either/or struct not both */
//prototypes
PyObject *Quaternion_CreatePyObject( float *quat, int type, PyTypeObject *base_type);

View File

@@ -40,8 +40,8 @@
#define MAX_DIMENSIONS 4
/* Swizzle axes get packed into a single value that is used as a closure. Each
axis uses SWIZZLE_BITS_PER_AXIS bits. The first bit (SWIZZLE_VALID_AXIS) is
used as a sentinel: if it is unset, the axis is not valid. */
* axis uses SWIZZLE_BITS_PER_AXIS bits. The first bit (SWIZZLE_VALID_AXIS) is
* used as a sentinel: if it is unset, the axis is not valid. */
#define SWIZZLE_BITS_PER_AXIS 3
#define SWIZZLE_VALID_AXIS 0x4
#define SWIZZLE_AXIS 0x3
@@ -439,8 +439,6 @@ static PyObject *Vector_resized(VectorObject *self, PyObject *value)
int size;
float *vec;
/*if (!PyArg_ParseTuple(args, "i:resize", &size))
return NULL;*/
if ((size = PyLong_AsLong(value)) == -1) {
return NULL;
}
@@ -788,9 +786,9 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
}
/*
flip vector around, since vectoquat expect a vector from target to tracking object
and the python function expects the inverse (a vector to the target).
*/
* flip vector around, since vectoquat expect a vector from target to tracking object
* and the python function expects the inverse (a vector to the target).
*/
negate_v3_v3(vec, self->vec);
vec_to_quat(quat, vec, track, up);
@@ -1476,7 +1474,7 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2)
}
/*------------------------obj * obj------------------------------
mulplication*/
* mulplication*/
/* COLUMN VECTOR Multiplication (Matrix X Vector)
@@ -1643,7 +1641,7 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
return NULL;
/* only support vec*=float and vec*=mat
vec*=vec result is a float so that wont work */
* vec*=vec result is a float so that wont work */
if (MatrixObject_Check(v2)) {
/* ------ to be removed ------*/
#if 1
@@ -1785,7 +1783,7 @@ static PyObject *Vector_idiv(PyObject *v1, PyObject *v2)
}
/* -obj
returns the negative of this object*/
* returns the negative of this object*/
static PyObject *Vector_neg(VectorObject *self)
{
float *tvec;
@@ -1801,16 +1799,16 @@ static PyObject *Vector_neg(VectorObject *self)
/*------------------------vec_magnitude_nosqrt (internal) - for comparing only */
static double vec_magnitude_nosqrt(float *data, int size)
{
/*return (double)sqrt(dot);*/
/* return (double)sqrt(dot);*/
/* warning, line above removed because we are not using the length,
rather the comparing the sizes and for this we do not need the sqrt
for the actual length, the dot must be sqrt'd */
* rather the comparing the sizes and for this we do not need the sqrt
* for the actual length, the dot must be sqrt'd */
return dot_vn_vn(data, data, size);
}
/*------------------------tp_richcmpr
returns -1 execption, 0 false, 1 true */
* returns -1 execption, 0 false, 1 true */
static PyObject *Vector_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
{
VectorObject *vecA = NULL, *vecB = NULL;
@@ -2147,7 +2145,7 @@ static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
* - 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. */
static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure)
@@ -2719,10 +2717,10 @@ static struct PyMethodDef Vector_methods[] = {
/* Note
Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing
but this means for eg that
vec*mat and mat*vec both get sent to Vector_mul and it neesd to sort out the order
*/
* Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing
* but this means for eg that
* (vec * mat) and (mat * vec) both get sent to Vector_mul and it neesd to sort out the order
*/
PyDoc_STRVAR(vector_doc,
"This object gives access to Vectors in Blender."
@@ -2809,11 +2807,11 @@ PyTypeObject vector_Type = {
};
/*------------------------Vector_CreatePyObject (internal)-------------
creates a new vector object
pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
(i.e. it was allocated elsewhere by MEM_mallocN())
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
(i.e. it must be created here with PyMEM_malloc())*/
* creates a new vector object
* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
* (i.e. it was allocated elsewhere by MEM_mallocN())
* pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
* (i.e. it must be created here with PyMEM_malloc())*/
PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type)
{
VectorObject *self;

View File

@@ -1120,7 +1120,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
filldisplist(&dispbase, &dispbase, 0);
/* The faces are stored in a new DisplayList
thats added to the head of the listbase */
* thats added to the head of the listbase */
dl = dispbase.first;
tri_list = PyList_New(dl->parts);

View File

@@ -64,50 +64,50 @@
/*-----------------------------------------*/
/* 'mersenne twister' random number generator */
/*
A C-program for MT19937, with initialization improved 2002/2/10.
Coded by Takuji Nishimura and Makoto Matsumoto.
This is a faster version by taking Shawn Cokus's optimization,
Matthe Bellew's simplification, Isaku Wada's real version.
Before using, initialize the state by using init_genrand(seed)
or init_by_array(init_key, key_length).
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Any feedback is very welcome.
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
*/
/*
* A C-program for MT19937, with initialization improved 2002/2/10.
* Coded by Takuji Nishimura and Makoto Matsumoto.
* This is a faster version by taking Shawn Cokus's optimization,
* Matthe Bellew's simplification, Isaku Wada's real version.
*
* Before using, initialize the state by using init_genrand(seed)
* or init_by_array(init_key, key_length).
*
* Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The names of its contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Any feedback is very welcome.
* http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
* email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
*/
/* Period parameters */
#define N 624
@@ -237,7 +237,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
}
/* Fills an array of length 3 with the turbulence vector for a given
position (x, y, z) */
* position (x, y, z) */
static void vTurb(float x, float y, float z, int oct, int hard, int nb,
float ampscale, float freqscale, float v[3])
{
@@ -321,7 +321,7 @@ static PyObject *M_Noise_random_unit_vector(PyObject *UNUSED(self), PyObject *ar
return Vector_CreatePyObject(vec, size, Py_NEW, NULL);
}
/* This is dumb, most people will want a unit vector anyway, since this doesn't have uniform distribution over a sphere*/
/*
#if 0
PyDoc_STRVAR(M_Noise_random_vector_doc,
".. function:: random_vector(size=3)\n"
"\n"
@@ -349,7 +349,7 @@ static PyObject *M_Noise_random_vector(PyObject *UNUSED(self), PyObject *args)
return Vector_CreatePyObject(vec, size, Py_NEW, NULL);
}
*/
#endif
PyDoc_STRVAR(M_Noise_seed_set_doc,
".. function:: seed_set(seed)\n"