Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface1D')
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp476
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h4
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp301
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h4
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp658
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h6
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp451
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h4
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp262
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h4
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp572
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h4
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp334
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h7
14 files changed, 1621 insertions, 1466 deletions
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
index 3bef47efd17..7ca783d9aa4 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
@@ -35,336 +35,364 @@ extern "C" {
/*----------------------FEdge methods ----------------------------*/
PyDoc_STRVAR(FEdge_doc,
-"Class hierarchy: :class:`Interface1D` > :class:`FEdge`\n"
-"\n"
-"Base Class for feature edges. This FEdge can represent a silhouette,\n"
-"a crease, a ridge/valley, a border or a suggestive contour. For\n"
-"silhouettes, the FEdge is oriented so that the visible face lies on\n"
-"the left of the edge. For borders, the FEdge is oriented so that the\n"
-"face lies on the left of the edge. An FEdge can represent an initial\n"
-"edge of the mesh or runs across a face of the initial mesh depending\n"
-"on the smoothness or sharpness of the mesh. This class is specialized\n"
-"into a smooth and a sharp version since their properties slightly vary\n"
-"from one to the other.\n"
-"\n"
-".. method:: FEdge()\n"
-"\n"
-" Default constructor.\n"
-"\n"
-".. method:: FEdge(brother)\n"
-"\n"
-" Copy constructor.\n"
-"\n"
-" :arg brother: An FEdge object.\n"
-" :type brother: :class:`FEdge`\n"
-"\n"
-".. method:: FEdge(first_vertex, second_vertex)\n"
-"\n"
-" Builds an FEdge going from the first vertex to the second.\n"
-"\n"
-" :arg first_vertex: The first SVertex.\n"
-" :type first_vertex: :class:`SVertex`\n"
-" :arg second_vertex: The second SVertex.\n"
-" :type second_vertex: :class:`SVertex`");
+ "Class hierarchy: :class:`Interface1D` > :class:`FEdge`\n"
+ "\n"
+ "Base Class for feature edges. This FEdge can represent a silhouette,\n"
+ "a crease, a ridge/valley, a border or a suggestive contour. For\n"
+ "silhouettes, the FEdge is oriented so that the visible face lies on\n"
+ "the left of the edge. For borders, the FEdge is oriented so that the\n"
+ "face lies on the left of the edge. An FEdge can represent an initial\n"
+ "edge of the mesh or runs across a face of the initial mesh depending\n"
+ "on the smoothness or sharpness of the mesh. This class is specialized\n"
+ "into a smooth and a sharp version since their properties slightly vary\n"
+ "from one to the other.\n"
+ "\n"
+ ".. method:: FEdge()\n"
+ "\n"
+ " Default constructor.\n"
+ "\n"
+ ".. method:: FEdge(brother)\n"
+ "\n"
+ " Copy constructor.\n"
+ "\n"
+ " :arg brother: An FEdge object.\n"
+ " :type brother: :class:`FEdge`\n"
+ "\n"
+ ".. method:: FEdge(first_vertex, second_vertex)\n"
+ "\n"
+ " Builds an FEdge going from the first vertex to the second.\n"
+ "\n"
+ " :arg first_vertex: The first SVertex.\n"
+ " :type first_vertex: :class:`SVertex`\n"
+ " :arg second_vertex: The second SVertex.\n"
+ " :type second_vertex: :class:`SVertex`");
static int FEdge_init(BPy_FEdge *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist_1[] = {"brother", NULL};
- static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL};
- PyObject *obj1 = 0, *obj2 = 0;
-
- if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdge_Type, &obj1)) {
- if (!obj1)
- self->fe = new FEdge();
- else
- self->fe = new FEdge(*(((BPy_FEdge *)obj1)->fe));
- }
- else if (PyErr_Clear(),
- PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist_2,
- &SVertex_Type, &obj1, &SVertex_Type, &obj2))
- {
- self->fe = new FEdge(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
- return -1;
- }
- self->py_if1D.if1D = self->fe;
- self->py_if1D.borrowed = false;
- return 0;
+ static const char *kwlist_1[] = {"brother", NULL};
+ static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL};
+ PyObject *obj1 = 0, *obj2 = 0;
+
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdge_Type, &obj1)) {
+ if (!obj1)
+ self->fe = new FEdge();
+ else
+ self->fe = new FEdge(*(((BPy_FEdge *)obj1)->fe));
+ }
+ else if (PyErr_Clear(),
+ PyArg_ParseTupleAndKeywords(args,
+ kwds,
+ "O!O!",
+ (char **)kwlist_2,
+ &SVertex_Type,
+ &obj1,
+ &SVertex_Type,
+ &obj2)) {
+ self->fe = new FEdge(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return -1;
+ }
+ self->py_if1D.if1D = self->fe;
+ self->py_if1D.borrowed = false;
+ return 0;
}
/*----------------------FEdge sequence protocol ----------------------------*/
static Py_ssize_t FEdge_sq_length(BPy_FEdge * /*self*/)
{
- return 2;
+ return 2;
}
static PyObject *FEdge_sq_item(BPy_FEdge *self, int keynum)
{
- if (keynum < 0)
- keynum += FEdge_sq_length(self);
- if (keynum == 0 || keynum == 1) {
- SVertex *v = self->fe->operator[](keynum);
- if (v)
- return BPy_SVertex_from_SVertex(*v);
- Py_RETURN_NONE;
- }
- PyErr_Format(PyExc_IndexError, "FEdge[index]: index %d out of range", keynum);
- return NULL;
+ if (keynum < 0)
+ keynum += FEdge_sq_length(self);
+ if (keynum == 0 || keynum == 1) {
+ SVertex *v = self->fe->operator[](keynum);
+ if (v)
+ return BPy_SVertex_from_SVertex(*v);
+ Py_RETURN_NONE;
+ }
+ PyErr_Format(PyExc_IndexError, "FEdge[index]: index %d out of range", keynum);
+ return NULL;
}
static PySequenceMethods BPy_FEdge_as_sequence = {
- (lenfunc)FEdge_sq_length, /* sq_length */
- NULL, /* sq_concat */
- NULL, /* sq_repeat */
- (ssizeargfunc)FEdge_sq_item, /* sq_item */
- NULL, /* sq_slice */
- NULL, /* sq_ass_item */
- NULL, /* *was* sq_ass_slice */
- NULL, /* sq_contains */
- NULL, /* sq_inplace_concat */
- NULL, /* sq_inplace_repeat */
+ (lenfunc)FEdge_sq_length, /* sq_length */
+ NULL, /* sq_concat */
+ NULL, /* sq_repeat */
+ (ssizeargfunc)FEdge_sq_item, /* sq_item */
+ NULL, /* sq_slice */
+ NULL, /* sq_ass_item */
+ NULL, /* *was* sq_ass_slice */
+ NULL, /* sq_contains */
+ NULL, /* sq_inplace_concat */
+ NULL, /* sq_inplace_repeat */
};
/*----------------------FEdge get/setters ----------------------------*/
PyDoc_STRVAR(FEdge_first_svertex_doc,
-"The first SVertex constituting this FEdge.\n"
-"\n"
-":type: :class:`SVertex`");
+ "The first SVertex constituting this FEdge.\n"
+ "\n"
+ ":type: :class:`SVertex`");
static PyObject *FEdge_first_svertex_get(BPy_FEdge *self, void *UNUSED(closure))
{
- SVertex *A = self->fe->vertexA();
- if (A)
- return BPy_SVertex_from_SVertex(*A);
- Py_RETURN_NONE;
+ SVertex *A = self->fe->vertexA();
+ if (A)
+ return BPy_SVertex_from_SVertex(*A);
+ Py_RETURN_NONE;
}
static int FEdge_first_svertex_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_SVertex_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
- return -1;
- }
- self->fe->setVertexA(((BPy_SVertex *)value)->sv);
- return 0;
+ if (!BPy_SVertex_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
+ return -1;
+ }
+ self->fe->setVertexA(((BPy_SVertex *)value)->sv);
+ return 0;
}
PyDoc_STRVAR(FEdge_second_svertex_doc,
-"The second SVertex constituting this FEdge.\n"
-"\n"
-":type: :class:`SVertex`");
+ "The second SVertex constituting this FEdge.\n"
+ "\n"
+ ":type: :class:`SVertex`");
static PyObject *FEdge_second_svertex_get(BPy_FEdge *self, void *UNUSED(closure))
{
- SVertex *B = self->fe->vertexB();
- if (B)
- return BPy_SVertex_from_SVertex(*B);
- Py_RETURN_NONE;
+ SVertex *B = self->fe->vertexB();
+ if (B)
+ return BPy_SVertex_from_SVertex(*B);
+ Py_RETURN_NONE;
}
static int FEdge_second_svertex_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_SVertex_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
- return -1;
- }
- self->fe->setVertexB(((BPy_SVertex *)value)->sv);
- return 0;
+ if (!BPy_SVertex_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
+ return -1;
+ }
+ self->fe->setVertexB(((BPy_SVertex *)value)->sv);
+ return 0;
}
PyDoc_STRVAR(FEdge_next_fedge_doc,
-"The FEdge following this one in the ViewEdge. The value is None if\n"
-"this FEdge is the last of the ViewEdge.\n"
-"\n"
-":type: :class:`FEdge`");
+ "The FEdge following this one in the ViewEdge. The value is None if\n"
+ "this FEdge is the last of the ViewEdge.\n"
+ "\n"
+ ":type: :class:`FEdge`");
static PyObject *FEdge_next_fedge_get(BPy_FEdge *self, void *UNUSED(closure))
{
- FEdge *fe = self->fe->nextEdge();
- if (fe)
- return Any_BPy_FEdge_from_FEdge(*fe);
- Py_RETURN_NONE;
+ FEdge *fe = self->fe->nextEdge();
+ if (fe)
+ return Any_BPy_FEdge_from_FEdge(*fe);
+ Py_RETURN_NONE;
}
static int FEdge_next_fedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_FEdge_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be an FEdge");
- return -1;
- }
- self->fe->setNextEdge(((BPy_FEdge *)value)->fe);
- return 0;
+ if (!BPy_FEdge_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be an FEdge");
+ return -1;
+ }
+ self->fe->setNextEdge(((BPy_FEdge *)value)->fe);
+ return 0;
}
PyDoc_STRVAR(FEdge_previous_fedge_doc,
-"The FEdge preceding this one in the ViewEdge. The value is None if\n"
-"this FEdge is the first one of the ViewEdge.\n"
-"\n"
-":type: :class:`FEdge`");
+ "The FEdge preceding this one in the ViewEdge. The value is None if\n"
+ "this FEdge is the first one of the ViewEdge.\n"
+ "\n"
+ ":type: :class:`FEdge`");
static PyObject *FEdge_previous_fedge_get(BPy_FEdge *self, void *UNUSED(closure))
{
- FEdge *fe = self->fe->previousEdge();
- if (fe)
- return Any_BPy_FEdge_from_FEdge(*fe);
- Py_RETURN_NONE;
+ FEdge *fe = self->fe->previousEdge();
+ if (fe)
+ return Any_BPy_FEdge_from_FEdge(*fe);
+ Py_RETURN_NONE;
}
static int FEdge_previous_fedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_FEdge_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be an FEdge");
- return -1;
- }
- self->fe->setPreviousEdge(((BPy_FEdge *)value)->fe);
- return 0;
+ if (!BPy_FEdge_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be an FEdge");
+ return -1;
+ }
+ self->fe->setPreviousEdge(((BPy_FEdge *)value)->fe);
+ return 0;
}
PyDoc_STRVAR(FEdge_viewedge_doc,
-"The ViewEdge to which this FEdge belongs to.\n"
-"\n"
-":type: :class:`ViewEdge`");
+ "The ViewEdge to which this FEdge belongs to.\n"
+ "\n"
+ ":type: :class:`ViewEdge`");
static PyObject *FEdge_viewedge_get(BPy_FEdge *self, void *UNUSED(closure))
{
- ViewEdge *ve = self->fe->viewedge();
- if (ve)
- return BPy_ViewEdge_from_ViewEdge(*ve);
- Py_RETURN_NONE;
+ ViewEdge *ve = self->fe->viewedge();
+ if (ve)
+ return BPy_ViewEdge_from_ViewEdge(*ve);
+ Py_RETURN_NONE;
}
static int FEdge_viewedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_ViewEdge_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be an ViewEdge");
- return -1;
- }
- self->fe->setViewEdge(((BPy_ViewEdge *)value)->ve);
- return 0;
+ if (!BPy_ViewEdge_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be an ViewEdge");
+ return -1;
+ }
+ self->fe->setViewEdge(((BPy_ViewEdge *)value)->ve);
+ return 0;
}
PyDoc_STRVAR(FEdge_is_smooth_doc,
-"True if this FEdge is a smooth FEdge.\n"
-"\n"
-":type: bool");
+ "True if this FEdge is a smooth FEdge.\n"
+ "\n"
+ ":type: bool");
static PyObject *FEdge_is_smooth_get(BPy_FEdge *self, void *UNUSED(closure))
{
- return PyBool_from_bool(self->fe->isSmooth());
+ return PyBool_from_bool(self->fe->isSmooth());
}
static int FEdge_is_smooth_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!PyBool_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be boolean");
- return -1;
- }
- self->fe->setSmooth(bool_from_PyBool(value));
- return 0;
+ if (!PyBool_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be boolean");
+ return -1;
+ }
+ self->fe->setSmooth(bool_from_PyBool(value));
+ return 0;
}
PyDoc_STRVAR(FEdge_id_doc,
-"The Id of this FEdge.\n"
-"\n"
-":type: :class:`Id`");
+ "The Id of this FEdge.\n"
+ "\n"
+ ":type: :class:`Id`");
static PyObject *FEdge_id_get(BPy_FEdge *self, void *UNUSED(closure))
{
- Id id(self->fe->getId());
- return BPy_Id_from_Id(id); // return a copy
+ Id id(self->fe->getId());
+ return BPy_Id_from_Id(id); // return a copy
}
static int FEdge_id_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_Id_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be an Id");
- return -1;
- }
- self->fe->setId(*(((BPy_Id *)value)->id));
- return 0;
+ if (!BPy_Id_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be an Id");
+ return -1;
+ }
+ self->fe->setId(*(((BPy_Id *)value)->id));
+ return 0;
}
PyDoc_STRVAR(FEdge_nature_doc,
-"The nature of this FEdge.\n"
-"\n"
-":type: :class:`Nature`");
+ "The nature of this FEdge.\n"
+ "\n"
+ ":type: :class:`Nature`");
static PyObject *FEdge_nature_get(BPy_FEdge *self, void *UNUSED(closure))
{
- return BPy_Nature_from_Nature(self->fe->getNature());
+ return BPy_Nature_from_Nature(self->fe->getNature());
}
static int FEdge_nature_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_Nature_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be a Nature");
- return -1;
- }
- self->fe->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i));
- return 0;
+ if (!BPy_Nature_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be a Nature");
+ return -1;
+ }
+ self->fe->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i));
+ return 0;
}
static PyGetSetDef BPy_FEdge_getseters[] = {
- {(char *)"first_svertex", (getter)FEdge_first_svertex_get, (setter)FEdge_first_svertex_set,
- (char *)FEdge_first_svertex_doc, NULL},
- {(char *)"second_svertex", (getter)FEdge_second_svertex_get, (setter)FEdge_second_svertex_set,
- (char *)FEdge_second_svertex_doc, NULL},
- {(char *)"next_fedge", (getter)FEdge_next_fedge_get, (setter)FEdge_next_fedge_set,
- (char *)FEdge_next_fedge_doc, NULL},
- {(char *)"previous_fedge", (getter)FEdge_previous_fedge_get, (setter)FEdge_previous_fedge_set,
- (char *)FEdge_previous_fedge_doc, NULL},
- {(char *)"viewedge", (getter)FEdge_viewedge_get, (setter)FEdge_viewedge_set, (char *)FEdge_viewedge_doc, NULL},
- {(char *)"is_smooth", (getter)FEdge_is_smooth_get, (setter)FEdge_is_smooth_set, (char *)FEdge_is_smooth_doc, NULL},
- {(char *)"id", (getter)FEdge_id_get, (setter)FEdge_id_set, (char *)FEdge_id_doc, NULL},
- {(char *)"nature", (getter)FEdge_nature_get, (setter)FEdge_nature_set, (char *)FEdge_nature_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"first_svertex",
+ (getter)FEdge_first_svertex_get,
+ (setter)FEdge_first_svertex_set,
+ (char *)FEdge_first_svertex_doc,
+ NULL},
+ {(char *)"second_svertex",
+ (getter)FEdge_second_svertex_get,
+ (setter)FEdge_second_svertex_set,
+ (char *)FEdge_second_svertex_doc,
+ NULL},
+ {(char *)"next_fedge",
+ (getter)FEdge_next_fedge_get,
+ (setter)FEdge_next_fedge_set,
+ (char *)FEdge_next_fedge_doc,
+ NULL},
+ {(char *)"previous_fedge",
+ (getter)FEdge_previous_fedge_get,
+ (setter)FEdge_previous_fedge_set,
+ (char *)FEdge_previous_fedge_doc,
+ NULL},
+ {(char *)"viewedge",
+ (getter)FEdge_viewedge_get,
+ (setter)FEdge_viewedge_set,
+ (char *)FEdge_viewedge_doc,
+ NULL},
+ {(char *)"is_smooth",
+ (getter)FEdge_is_smooth_get,
+ (setter)FEdge_is_smooth_set,
+ (char *)FEdge_is_smooth_doc,
+ NULL},
+ {(char *)"id", (getter)FEdge_id_get, (setter)FEdge_id_set, (char *)FEdge_id_doc, NULL},
+ {(char *)"nature",
+ (getter)FEdge_nature_get,
+ (setter)FEdge_nature_set,
+ (char *)FEdge_nature_doc,
+ NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------BPy_FEdge type definition ------------------------------*/
PyTypeObject FEdge_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "FEdge", /* tp_name */
- sizeof(BPy_FEdge), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- &BPy_FEdge_as_sequence, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- FEdge_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- BPy_FEdge_getseters, /* tp_getset */
- &Interface1D_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)FEdge_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(NULL, 0) "FEdge", /* tp_name */
+ sizeof(BPy_FEdge), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ &BPy_FEdge_as_sequence, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ FEdge_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ BPy_FEdge_getseters, /* tp_getset */
+ &Interface1D_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)FEdge_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h
index 094f59f0908..3ab8c5f8273 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h
@@ -37,8 +37,8 @@ extern PyTypeObject FEdge_Type;
/*---------------------------Python BPy_FEdge structure definition----------*/
typedef struct {
- BPy_Interface1D py_if1D;
- FEdge *fe;
+ BPy_Interface1D py_if1D;
+ FEdge *fe;
} BPy_FEdge;
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
index 1932a2fd7ae..1d2d4f51028 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
@@ -34,192 +34,201 @@ extern "C" {
/*----------------------CurvePoint methods ----------------------------*/
PyDoc_STRVAR(FrsCurve_doc,
-"Class hierarchy: :class:`Interface1D` > :class:`Curve`\n"
-"\n"
-"Base class for curves made of CurvePoints. :class:`SVertex` is the\n"
-"type of the initial curve vertices. A :class:`Chain` is a\n"
-"specialization of a Curve.\n"
-"\n"
-".. method:: __init__()\n"
-"\n"
-" Default Constructor.\n"
-"\n"
-".. method:: __init__(brother)\n"
-"\n"
-" Copy Constructor.\n"
-"\n"
-" :arg brother: A Curve object.\n"
-" :type brother: :class:`Curve`\n"
-"\n"
-".. method:: __init__(id)\n"
-"\n"
-" Builds a Curve from its Id.\n"
-"\n"
-" :arg id: An Id object.\n"
-" :type id: :class:`Id`");
+ "Class hierarchy: :class:`Interface1D` > :class:`Curve`\n"
+ "\n"
+ "Base class for curves made of CurvePoints. :class:`SVertex` is the\n"
+ "type of the initial curve vertices. A :class:`Chain` is a\n"
+ "specialization of a Curve.\n"
+ "\n"
+ ".. method:: __init__()\n"
+ "\n"
+ " Default Constructor.\n"
+ "\n"
+ ".. method:: __init__(brother)\n"
+ "\n"
+ " Copy Constructor.\n"
+ "\n"
+ " :arg brother: A Curve object.\n"
+ " :type brother: :class:`Curve`\n"
+ "\n"
+ ".. method:: __init__(id)\n"
+ "\n"
+ " Builds a Curve from its Id.\n"
+ "\n"
+ " :arg id: An Id object.\n"
+ " :type id: :class:`Id`");
static int FrsCurve_init(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist_1[] = {"brother", NULL};
- static const char *kwlist_2[] = {"id", NULL};
- PyObject *obj = 0;
-
- if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FrsCurve_Type, &obj)) {
- if (!obj)
- self->c = new Curve();
- else
- self->c = new Curve(*(((BPy_FrsCurve *)obj)->c));
- }
- else if (PyErr_Clear(),
- PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj))
- {
- self->c = new Curve(*(((BPy_Id *)obj)->id));
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
- return -1;
- }
- self->py_if1D.if1D = self->c;
- self->py_if1D.borrowed = false;
- return 0;
+ static const char *kwlist_1[] = {"brother", NULL};
+ static const char *kwlist_2[] = {"id", NULL};
+ PyObject *obj = 0;
+
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FrsCurve_Type, &obj)) {
+ if (!obj)
+ self->c = new Curve();
+ else
+ self->c = new Curve(*(((BPy_FrsCurve *)obj)->c));
+ }
+ else if (PyErr_Clear(),
+ PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) {
+ self->c = new Curve(*(((BPy_Id *)obj)->id));
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return -1;
+ }
+ self->py_if1D.if1D = self->c;
+ self->py_if1D.borrowed = false;
+ return 0;
}
PyDoc_STRVAR(FrsCurve_push_vertex_back_doc,
-".. method:: push_vertex_back(vertex)\n"
-"\n"
-" Adds a single vertex at the end of the Curve.\n"
-"\n"
-" :arg vertex: A vertex object.\n"
-" :type vertex: :class:`SVertex` or :class:`CurvePoint`");
+ ".. method:: push_vertex_back(vertex)\n"
+ "\n"
+ " Adds a single vertex at the end of the Curve.\n"
+ "\n"
+ " :arg vertex: A vertex object.\n"
+ " :type vertex: :class:`SVertex` or :class:`CurvePoint`");
static PyObject *FrsCurve_push_vertex_back(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"vertex", NULL};
- PyObject *obj = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
- return NULL;
-
- if (BPy_CurvePoint_Check(obj)) {
- self->c->push_vertex_back(((BPy_CurvePoint *)obj)->cp);
- }
- else if (BPy_SVertex_Check(obj)) {
- self->c->push_vertex_back(((BPy_SVertex *)obj)->sv);
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument");
- return NULL;
- }
- Py_RETURN_NONE;
+ static const char *kwlist[] = {"vertex", NULL};
+ PyObject *obj = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
+ return NULL;
+
+ if (BPy_CurvePoint_Check(obj)) {
+ self->c->push_vertex_back(((BPy_CurvePoint *)obj)->cp);
+ }
+ else if (BPy_SVertex_Check(obj)) {
+ self->c->push_vertex_back(((BPy_SVertex *)obj)->sv);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument");
+ return NULL;
+ }
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(FrsCurve_push_vertex_front_doc,
-".. method:: push_vertex_front(vertex)\n"
-"\n"
-" Adds a single vertex at the front of the Curve.\n"
-"\n"
-" :arg vertex: A vertex object.\n"
-" :type vertex: :class:`SVertex` or :class:`CurvePoint`");
+ ".. method:: push_vertex_front(vertex)\n"
+ "\n"
+ " Adds a single vertex at the front of the Curve.\n"
+ "\n"
+ " :arg vertex: A vertex object.\n"
+ " :type vertex: :class:`SVertex` or :class:`CurvePoint`");
static PyObject *FrsCurve_push_vertex_front(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"vertex", NULL};
- PyObject *obj = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
- return NULL;
-
- if (BPy_CurvePoint_Check(obj)) {
- self->c->push_vertex_front(((BPy_CurvePoint *)obj)->cp);
- }
- else if (BPy_SVertex_Check(obj)) {
- self->c->push_vertex_front(((BPy_SVertex *)obj)->sv);
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument");
- return NULL;
- }
- Py_RETURN_NONE;
+ static const char *kwlist[] = {"vertex", NULL};
+ PyObject *obj = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
+ return NULL;
+
+ if (BPy_CurvePoint_Check(obj)) {
+ self->c->push_vertex_front(((BPy_CurvePoint *)obj)->cp);
+ }
+ else if (BPy_SVertex_Check(obj)) {
+ self->c->push_vertex_front(((BPy_SVertex *)obj)->sv);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument");
+ return NULL;
+ }
+ Py_RETURN_NONE;
}
static PyMethodDef BPy_FrsCurve_methods[] = {
- {"push_vertex_back", (PyCFunction)FrsCurve_push_vertex_back, METH_VARARGS | METH_KEYWORDS,
- FrsCurve_push_vertex_back_doc},
- {"push_vertex_front", (PyCFunction)FrsCurve_push_vertex_front, METH_VARARGS | METH_KEYWORDS,
- FrsCurve_push_vertex_front_doc},
- {NULL, NULL, 0, NULL},
+ {"push_vertex_back",
+ (PyCFunction)FrsCurve_push_vertex_back,
+ METH_VARARGS | METH_KEYWORDS,
+ FrsCurve_push_vertex_back_doc},
+ {"push_vertex_front",
+ (PyCFunction)FrsCurve_push_vertex_front,
+ METH_VARARGS | METH_KEYWORDS,
+ FrsCurve_push_vertex_front_doc},
+ {NULL, NULL, 0, NULL},
};
/*----------------------CurvePoint get/setters ----------------------------*/
PyDoc_STRVAR(FrsCurve_is_empty_doc,
-"True if the Curve doesn't have any Vertex yet.\n"
-"\n"
-":type: bool");
+ "True if the Curve doesn't have any Vertex yet.\n"
+ "\n"
+ ":type: bool");
static PyObject *FrsCurve_is_empty_get(BPy_FrsCurve *self, void *UNUSED(closure))
{
- return PyBool_from_bool(self->c->empty());
+ return PyBool_from_bool(self->c->empty());
}
PyDoc_STRVAR(FrsCurve_segments_size_doc,
-"The number of segments in the polyline constituting the Curve.\n"
-"\n"
-":type: int");
+ "The number of segments in the polyline constituting the Curve.\n"
+ "\n"
+ ":type: int");
static PyObject *FrsCurve_segments_size_get(BPy_FrsCurve *self, void *UNUSED(closure))
{
- return PyLong_FromLong(self->c->nSegments());
+ return PyLong_FromLong(self->c->nSegments());
}
static PyGetSetDef BPy_FrsCurve_getseters[] = {
- {(char *)"is_empty", (getter)FrsCurve_is_empty_get, (setter)NULL, (char *)FrsCurve_is_empty_doc, NULL},
- {(char *)"segments_size", (getter)FrsCurve_segments_size_get, (setter)NULL,
- (char *)FrsCurve_segments_size_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"is_empty",
+ (getter)FrsCurve_is_empty_get,
+ (setter)NULL,
+ (char *)FrsCurve_is_empty_doc,
+ NULL},
+ {(char *)"segments_size",
+ (getter)FrsCurve_segments_size_get,
+ (setter)NULL,
+ (char *)FrsCurve_segments_size_doc,
+ NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------BPy_FrsCurve type definition ------------------------------*/
PyTypeObject FrsCurve_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "Curve", /* tp_name */
- sizeof(BPy_FrsCurve), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- FrsCurve_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- BPy_FrsCurve_methods, /* tp_methods */
- 0, /* tp_members */
- BPy_FrsCurve_getseters, /* tp_getset */
- &Interface1D_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)FrsCurve_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(NULL, 0) "Curve", /* tp_name */
+ sizeof(BPy_FrsCurve), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ FrsCurve_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ BPy_FrsCurve_methods, /* tp_methods */
+ 0, /* tp_members */
+ BPy_FrsCurve_getseters, /* tp_getset */
+ &Interface1D_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)FrsCurve_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h
index 05415662764..aa4fb409076 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h
@@ -37,8 +37,8 @@ extern PyTypeObject FrsCurve_Type;
/*---------------------------Python BPy_FrsCurve structure definition----------*/
typedef struct {
- BPy_Interface1D py_if1D;
- Curve *c;
+ BPy_Interface1D py_if1D;
+ Curve *c;
} BPy_FrsCurve;
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
index 73907467f66..423a61c7f1d 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
@@ -42,457 +42,495 @@ extern "C" {
// - is it even used ? not even in SWIG version
PyDoc_STRVAR(Stroke_doc,
-"Class hierarchy: :class:`Interface1D` > :class:`Stroke`\n"
-"\n"
-"Class to define a stroke. A stroke is made of a set of 2D vertices\n"
-"(:class:`StrokeVertex`), regularly spaced out. This set of vertices\n"
-"defines the stroke's backbone geometry. Each of these stroke vertices\n"
-"defines the stroke's shape and appearance at this vertex position.\n"
-"\n"
-".. method:: Stroke()\n"
-"\n"
-" Default constructor\n"
-"\n"
-".. method:: Stroke(brother)\n"
-"\n"
-" Copy constructor");
+ "Class hierarchy: :class:`Interface1D` > :class:`Stroke`\n"
+ "\n"
+ "Class to define a stroke. A stroke is made of a set of 2D vertices\n"
+ "(:class:`StrokeVertex`), regularly spaced out. This set of vertices\n"
+ "defines the stroke's backbone geometry. Each of these stroke vertices\n"
+ "defines the stroke's shape and appearance at this vertex position.\n"
+ "\n"
+ ".. method:: Stroke()\n"
+ "\n"
+ " Default constructor\n"
+ "\n"
+ ".. method:: Stroke(brother)\n"
+ "\n"
+ " Copy constructor");
static int Stroke_init(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"brother", NULL};
- PyObject *brother = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &Stroke_Type, &brother))
- return -1;
- if (!brother)
- self->s = new Stroke();
- else
- self->s = new Stroke(*(((BPy_Stroke *)brother)->s));
- self->py_if1D.if1D = self->s;
- self->py_if1D.borrowed = false;
- return 0;
+ static const char *kwlist[] = {"brother", NULL};
+ PyObject *brother = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &Stroke_Type, &brother))
+ return -1;
+ if (!brother)
+ self->s = new Stroke();
+ else
+ self->s = new Stroke(*(((BPy_Stroke *)brother)->s));
+ self->py_if1D.if1D = self->s;
+ self->py_if1D.borrowed = false;
+ return 0;
}
static PyObject *Stroke_iter(PyObject *self)
{
- StrokeInternal::StrokeVertexIterator sv_it( ((BPy_Stroke *)self)->s->strokeVerticesBegin() );
- return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false);
+ StrokeInternal::StrokeVertexIterator sv_it(((BPy_Stroke *)self)->s->strokeVerticesBegin());
+ return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false);
}
static Py_ssize_t Stroke_sq_length(BPy_Stroke *self)
{
- return self->s->strokeVerticesSize();
+ return self->s->strokeVerticesSize();
}
static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum)
{
- if (keynum < 0)
- keynum += Stroke_sq_length(self);
- if (keynum < 0 || keynum >= Stroke_sq_length(self)) {
- PyErr_Format(PyExc_IndexError, "Stroke[index]: index %d out of range", keynum);
- return NULL;
- }
- return BPy_StrokeVertex_from_StrokeVertex(self->s->strokeVerticeAt(keynum));
+ if (keynum < 0)
+ keynum += Stroke_sq_length(self);
+ if (keynum < 0 || keynum >= Stroke_sq_length(self)) {
+ PyErr_Format(PyExc_IndexError, "Stroke[index]: index %d out of range", keynum);
+ return NULL;
+ }
+ return BPy_StrokeVertex_from_StrokeVertex(self->s->strokeVerticeAt(keynum));
}
PyDoc_STRVAR(Stroke_compute_sampling_doc,
-".. method:: compute_sampling(n)\n"
-"\n"
-" Compute the sampling needed to get N vertices. If the\n"
-" specified number of vertices is less than the actual number of\n"
-" vertices, the actual sampling value is returned. (To remove Vertices,\n"
-" use the RemoveVertex() method of this class.)\n"
-"\n"
-" :arg n: The number of stroke vertices we eventually want\n"
-" in our Stroke.\n"
-" :type n: int\n"
-" :return: The sampling that must be used in the Resample(float)\n"
-" method.\n"
-" :rtype: float");
+ ".. method:: compute_sampling(n)\n"
+ "\n"
+ " Compute the sampling needed to get N vertices. If the\n"
+ " specified number of vertices is less than the actual number of\n"
+ " vertices, the actual sampling value is returned. (To remove Vertices,\n"
+ " use the RemoveVertex() method of this class.)\n"
+ "\n"
+ " :arg n: The number of stroke vertices we eventually want\n"
+ " in our Stroke.\n"
+ " :type n: int\n"
+ " :return: The sampling that must be used in the Resample(float)\n"
+ " method.\n"
+ " :rtype: float");
static PyObject *Stroke_compute_sampling(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"n", NULL};
- int i;
+ static const char *kwlist[] = {"n", NULL};
+ int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i))
- return NULL;
- return PyFloat_FromDouble(self->s->ComputeSampling(i));
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i))
+ return NULL;
+ return PyFloat_FromDouble(self->s->ComputeSampling(i));
}
PyDoc_STRVAR(Stroke_resample_doc,
-".. method:: resample(n)\n"
-"\n"
-" Resamples the stroke so that it eventually has N points. That means\n"
-" it is going to add N-vertices_size, where vertices_size is the\n"
-" number of points we already have. If vertices_size >= N, no\n"
-" resampling is done.\n"
-"\n"
-" :arg n: The number of vertices we eventually want in our stroke.\n"
-" :type n: int\n"
-"\n"
-".. method:: resample(sampling)\n"
-"\n"
-" Resamples the stroke with a given sampling. If the sampling is\n"
-" smaller than the actual sampling value, no resampling is done.\n"
-"\n"
-" :arg sampling: The new sampling value.\n"
-" :type sampling: float");
+ ".. method:: resample(n)\n"
+ "\n"
+ " Resamples the stroke so that it eventually has N points. That means\n"
+ " it is going to add N-vertices_size, where vertices_size is the\n"
+ " number of points we already have. If vertices_size >= N, no\n"
+ " resampling is done.\n"
+ "\n"
+ " :arg n: The number of vertices we eventually want in our stroke.\n"
+ " :type n: int\n"
+ "\n"
+ ".. method:: resample(sampling)\n"
+ "\n"
+ " Resamples the stroke with a given sampling. If the sampling is\n"
+ " smaller than the actual sampling value, no resampling is done.\n"
+ "\n"
+ " :arg sampling: The new sampling value.\n"
+ " :type sampling: float");
static PyObject *Stroke_resample(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist_1[] = {"n", NULL};
- static const char *kwlist_2[] = {"sampling", NULL};
- int i;
- float f;
-
- if (PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist_1, &i)) {
- if (self->s->Resample(i) < 0) {
- PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex count) failed");
- return NULL;
- }
- }
- else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist_2, &f)) {
- if (self->s->Resample(f) < 0) {
- PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex interval) failed");
- return NULL;
- }
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument");
- return NULL;
- }
- Py_RETURN_NONE;
+ static const char *kwlist_1[] = {"n", NULL};
+ static const char *kwlist_2[] = {"sampling", NULL};
+ int i;
+ float f;
+
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist_1, &i)) {
+ if (self->s->Resample(i) < 0) {
+ PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex count) failed");
+ return NULL;
+ }
+ }
+ else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist_2, &f)) {
+ if (self->s->Resample(f) < 0) {
+ PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex interval) failed");
+ return NULL;
+ }
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument");
+ return NULL;
+ }
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(Stroke_insert_vertex_doc,
-".. method:: insert_vertex(vertex, next)\n"
-"\n"
-" Inserts the StrokeVertex given as argument into the Stroke before the\n"
-" point specified by next. The length and curvilinear abscissa are\n"
-" updated consequently.\n"
-"\n"
-" :arg vertex: The StrokeVertex to insert in the Stroke.\n"
-" :type vertex: :class:`StrokeVertex`\n"
-" :arg next: A StrokeVertexIterator pointing to the StrokeVertex\n"
-" before which vertex must be inserted.\n"
-" :type next: :class:`StrokeVertexIterator`");
+ ".. method:: insert_vertex(vertex, next)\n"
+ "\n"
+ " Inserts the StrokeVertex given as argument into the Stroke before the\n"
+ " point specified by next. The length and curvilinear abscissa are\n"
+ " updated consequently.\n"
+ "\n"
+ " :arg vertex: The StrokeVertex to insert in the Stroke.\n"
+ " :type vertex: :class:`StrokeVertex`\n"
+ " :arg next: A StrokeVertexIterator pointing to the StrokeVertex\n"
+ " before which vertex must be inserted.\n"
+ " :type next: :class:`StrokeVertexIterator`");
static PyObject *Stroke_insert_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"vertex", "next", NULL};
- PyObject *py_sv = 0, *py_sv_it = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
- &StrokeVertex_Type, &py_sv, &StrokeVertexIterator_Type, &py_sv_it))
- {
- return NULL;
- }
- ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.borrowed = true; /* make the wrapped StrokeVertex internal */
- StrokeVertex *sv = ((BPy_StrokeVertex *)py_sv)->sv;
- StrokeInternal::StrokeVertexIterator sv_it(*(((BPy_StrokeVertexIterator *)py_sv_it)->sv_it));
- self->s->InsertVertex(sv, sv_it);
- Py_RETURN_NONE;
+ static const char *kwlist[] = {"vertex", "next", NULL};
+ PyObject *py_sv = 0, *py_sv_it = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args,
+ kwds,
+ "O!O!",
+ (char **)kwlist,
+ &StrokeVertex_Type,
+ &py_sv,
+ &StrokeVertexIterator_Type,
+ &py_sv_it)) {
+ return NULL;
+ }
+ ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.borrowed =
+ true; /* make the wrapped StrokeVertex internal */
+ StrokeVertex *sv = ((BPy_StrokeVertex *)py_sv)->sv;
+ StrokeInternal::StrokeVertexIterator sv_it(*(((BPy_StrokeVertexIterator *)py_sv_it)->sv_it));
+ self->s->InsertVertex(sv, sv_it);
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(Stroke_remove_vertex_doc,
-".. method:: remove_vertex(vertex)\n"
-"\n"
-" Removes the StrokeVertex given as argument from the Stroke. The length\n"
-" and curvilinear abscissa are updated consequently.\n"
-"\n"
-" :arg vertex: the StrokeVertex to remove from the Stroke.\n"
-" :type vertex: :class:`StrokeVertex`");
-
-static PyObject *Stroke_remove_vertex( BPy_Stroke *self, PyObject *args, PyObject *kwds)
+ ".. method:: remove_vertex(vertex)\n"
+ "\n"
+ " Removes the StrokeVertex given as argument from the Stroke. The length\n"
+ " and curvilinear abscissa are updated consequently.\n"
+ "\n"
+ " :arg vertex: the StrokeVertex to remove from the Stroke.\n"
+ " :type vertex: :class:`StrokeVertex`");
+
+static PyObject *Stroke_remove_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"vertex", NULL};
- PyObject *py_sv = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &StrokeVertex_Type, &py_sv))
- return NULL;
- if (((BPy_StrokeVertex *)py_sv)->sv) {
- self->s->RemoveVertex(((BPy_StrokeVertex *)py_sv)->sv);
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument");
- return NULL;
- }
- Py_RETURN_NONE;
+ static const char *kwlist[] = {"vertex", NULL};
+ PyObject *py_sv = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &StrokeVertex_Type, &py_sv))
+ return NULL;
+ if (((BPy_StrokeVertex *)py_sv)->sv) {
+ self->s->RemoveVertex(((BPy_StrokeVertex *)py_sv)->sv);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument");
+ return NULL;
+ }
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(Stroke_remove_all_vertices_doc,
-".. method:: remove_all_vertices()\n"
-"\n"
-" Removes all vertices from the Stroke.");
+ ".. method:: remove_all_vertices()\n"
+ "\n"
+ " Removes all vertices from the Stroke.");
static PyObject *Stroke_remove_all_vertices(BPy_Stroke *self)
{
- self->s->RemoveAllVertices();
- Py_RETURN_NONE;
+ self->s->RemoveAllVertices();
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(Stroke_update_length_doc,
-".. method:: update_length()\n"
-"\n"
-" Updates the 2D length of the Stroke.");
+ ".. method:: update_length()\n"
+ "\n"
+ " Updates the 2D length of the Stroke.");
static PyObject *Stroke_update_length(BPy_Stroke *self)
{
- self->s->UpdateLength();
- Py_RETURN_NONE;
+ self->s->UpdateLength();
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(Stroke_stroke_vertices_begin_doc,
-".. method:: stroke_vertices_begin(t=0.0)\n"
-"\n"
-" Returns a StrokeVertexIterator pointing on the first StrokeVertex of\n"
-" the Stroke. One can specify a sampling value to resample the Stroke\n"
-" on the fly if needed.\n"
-"\n"
-" :arg t: The resampling value with which we want our Stroke to be\n"
-" resampled. If 0 is specified, no resampling is done.\n"
-" :type t: float\n"
-" :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n"
-" :rtype: :class:`StrokeVertexIterator`");
+ ".. method:: stroke_vertices_begin(t=0.0)\n"
+ "\n"
+ " Returns a StrokeVertexIterator pointing on the first StrokeVertex of\n"
+ " the Stroke. One can specify a sampling value to resample the Stroke\n"
+ " on the fly if needed.\n"
+ "\n"
+ " :arg t: The resampling value with which we want our Stroke to be\n"
+ " resampled. If 0 is specified, no resampling is done.\n"
+ " :type t: float\n"
+ " :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n"
+ " :rtype: :class:`StrokeVertexIterator`");
static PyObject *Stroke_stroke_vertices_begin(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"t", NULL};
- float f = 0.0f;
+ static const char *kwlist[] = {"t", NULL};
+ float f = 0.0f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
- return NULL;
- StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesBegin(f));
- return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false);
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
+ return NULL;
+ StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesBegin(f));
+ return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false);
}
PyDoc_STRVAR(Stroke_stroke_vertices_end_doc,
-".. method:: stroke_vertices_end()\n"
-"\n"
-" Returns a StrokeVertexIterator pointing after the last StrokeVertex\n"
-" of the Stroke.\n"
-"\n"
-" :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n"
-" :rtype: :class:`StrokeVertexIterator`");
+ ".. method:: stroke_vertices_end()\n"
+ "\n"
+ " Returns a StrokeVertexIterator pointing after the last StrokeVertex\n"
+ " of the Stroke.\n"
+ "\n"
+ " :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n"
+ " :rtype: :class:`StrokeVertexIterator`");
static PyObject *Stroke_stroke_vertices_end(BPy_Stroke *self)
{
- StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd());
- return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, true);
+ StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd());
+ return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, true);
}
PyDoc_STRVAR(Stroke_reversed_doc,
-".. method:: __reversed__()\n"
-"\n"
-" Returns a StrokeVertexIterator iterating over the vertices of the Stroke\n"
-" in the reversed order (from the last to the first).\n"
-"\n"
-" :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n"
-" :rtype: :class:`StrokeVertexIterator`");
+ ".. method:: __reversed__()\n"
+ "\n"
+ " Returns a StrokeVertexIterator iterating over the vertices of the Stroke\n"
+ " in the reversed order (from the last to the first).\n"
+ "\n"
+ " :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n"
+ " :rtype: :class:`StrokeVertexIterator`");
static PyObject *Stroke_reversed(BPy_Stroke *self)
{
- StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd());
- return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, true);
+ StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd());
+ return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, true);
}
PyDoc_STRVAR(Stroke_stroke_vertices_size_doc,
-".. method:: stroke_vertices_size()\n"
-"\n"
-" Returns the number of StrokeVertex constituting the Stroke.\n"
-"\n"
-" :return: The number of stroke vertices.\n"
-" :rtype: int");
+ ".. method:: stroke_vertices_size()\n"
+ "\n"
+ " Returns the number of StrokeVertex constituting the Stroke.\n"
+ "\n"
+ " :return: The number of stroke vertices.\n"
+ " :rtype: int");
static PyObject *Stroke_stroke_vertices_size(BPy_Stroke *self)
{
- return PyLong_FromLong(self->s->strokeVerticesSize());
+ return PyLong_FromLong(self->s->strokeVerticesSize());
}
static PyMethodDef BPy_Stroke_methods[] = {
- {"compute_sampling", (PyCFunction)Stroke_compute_sampling, METH_VARARGS | METH_KEYWORDS,
- Stroke_compute_sampling_doc},
- {"resample", (PyCFunction)Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc},
- {"remove_all_vertices", (PyCFunction)Stroke_remove_all_vertices, METH_NOARGS, Stroke_remove_all_vertices_doc},
- {"remove_vertex", (PyCFunction)Stroke_remove_vertex, METH_VARARGS | METH_KEYWORDS, Stroke_remove_vertex_doc},
- {"insert_vertex", (PyCFunction)Stroke_insert_vertex, METH_VARARGS | METH_KEYWORDS, Stroke_insert_vertex_doc},
- {"update_length", (PyCFunction)Stroke_update_length, METH_NOARGS, Stroke_update_length_doc},
- {"stroke_vertices_begin", (PyCFunction)Stroke_stroke_vertices_begin, METH_VARARGS | METH_KEYWORDS,
- Stroke_stroke_vertices_begin_doc},
- {"stroke_vertices_end", (PyCFunction)Stroke_stroke_vertices_end, METH_NOARGS, Stroke_stroke_vertices_end_doc},
- {"__reversed__", (PyCFunction)Stroke_reversed, METH_NOARGS, Stroke_reversed_doc},
- {"stroke_vertices_size", (PyCFunction)Stroke_stroke_vertices_size, METH_NOARGS, Stroke_stroke_vertices_size_doc},
- {NULL, NULL, 0, NULL},
+ {"compute_sampling",
+ (PyCFunction)Stroke_compute_sampling,
+ METH_VARARGS | METH_KEYWORDS,
+ Stroke_compute_sampling_doc},
+ {"resample", (PyCFunction)Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc},
+ {"remove_all_vertices",
+ (PyCFunction)Stroke_remove_all_vertices,
+ METH_NOARGS,
+ Stroke_remove_all_vertices_doc},
+ {"remove_vertex",
+ (PyCFunction)Stroke_remove_vertex,
+ METH_VARARGS | METH_KEYWORDS,
+ Stroke_remove_vertex_doc},
+ {"insert_vertex",
+ (PyCFunction)Stroke_insert_vertex,
+ METH_VARARGS | METH_KEYWORDS,
+ Stroke_insert_vertex_doc},
+ {"update_length", (PyCFunction)Stroke_update_length, METH_NOARGS, Stroke_update_length_doc},
+ {"stroke_vertices_begin",
+ (PyCFunction)Stroke_stroke_vertices_begin,
+ METH_VARARGS | METH_KEYWORDS,
+ Stroke_stroke_vertices_begin_doc},
+ {"stroke_vertices_end",
+ (PyCFunction)Stroke_stroke_vertices_end,
+ METH_NOARGS,
+ Stroke_stroke_vertices_end_doc},
+ {"__reversed__", (PyCFunction)Stroke_reversed, METH_NOARGS, Stroke_reversed_doc},
+ {"stroke_vertices_size",
+ (PyCFunction)Stroke_stroke_vertices_size,
+ METH_NOARGS,
+ Stroke_stroke_vertices_size_doc},
+ {NULL, NULL, 0, NULL},
};
/*----------------------Stroke get/setters ----------------------------*/
PyDoc_STRVAR(Stroke_medium_type_doc,
-"The MediumType used for this Stroke.\n"
-"\n"
-":type: :class:`MediumType`");
+ "The MediumType used for this Stroke.\n"
+ "\n"
+ ":type: :class:`MediumType`");
static PyObject *Stroke_medium_type_get(BPy_Stroke *self, void *UNUSED(closure))
{
- return BPy_MediumType_from_MediumType(self->s->getMediumType());
+ return BPy_MediumType_from_MediumType(self->s->getMediumType());
}
static int Stroke_medium_type_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_MediumType_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be a MediumType");
- return -1;
- }
- self->s->setMediumType(MediumType_from_BPy_MediumType(value));
- return 0;
+ if (!BPy_MediumType_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be a MediumType");
+ return -1;
+ }
+ self->s->setMediumType(MediumType_from_BPy_MediumType(value));
+ return 0;
}
PyDoc_STRVAR(Stroke_texture_id_doc,
-"The ID of the texture used to simulate th marks system for this Stroke.\n"
-"\n"
-":type: int");
+ "The ID of the texture used to simulate th marks system for this Stroke.\n"
+ "\n"
+ ":type: int");
static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure))
{
- return PyLong_FromLong( self->s->getTextureId() );
+ return PyLong_FromLong(self->s->getTextureId());
}
static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
{
- unsigned int i = PyLong_AsUnsignedLong(value);
- if (PyErr_Occurred())
- return -1;
- self->s->setTextureId(i);
- return 0;
+ unsigned int i = PyLong_AsUnsignedLong(value);
+ if (PyErr_Occurred())
+ return -1;
+ self->s->setTextureId(i);
+ return 0;
}
PyDoc_STRVAR(Stroke_tips_doc,
-"True if this Stroke uses a texture with tips, and false otherwise.\n"
-"\n"
-":type: bool");
+ "True if this Stroke uses a texture with tips, and false otherwise.\n"
+ "\n"
+ ":type: bool");
static PyObject *Stroke_tips_get(BPy_Stroke *self, void *UNUSED(closure))
{
- return PyBool_from_bool(self->s->hasTips());
+ return PyBool_from_bool(self->s->hasTips());
}
static int Stroke_tips_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
{
- if (!PyBool_Check(value))
- return -1;
- self->s->setTips(bool_from_PyBool(value));
- return 0;
+ if (!PyBool_Check(value))
+ return -1;
+ self->s->setTips(bool_from_PyBool(value));
+ return 0;
}
PyDoc_STRVAR(Stroke_length_2d_doc,
-"The 2D length of the Stroke.\n"
-"\n"
-":type: float");
+ "The 2D length of the Stroke.\n"
+ "\n"
+ ":type: float");
static PyObject *Stroke_length_2d_get(BPy_Stroke *self, void *UNUSED(closure))
{
- return PyFloat_FromDouble(self->s->getLength2D());
+ return PyFloat_FromDouble(self->s->getLength2D());
}
static int Stroke_length_2d_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
{
- float scalar;
- if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
- PyErr_SetString(PyExc_TypeError, "value must be a number");
- return -1;
- }
- self->s->setLength(scalar);
- return 0;
+ float scalar;
+ if ((scalar = PyFloat_AsDouble(value)) == -1.0f &&
+ PyErr_Occurred()) { /* parsed item not a number */
+ PyErr_SetString(PyExc_TypeError, "value must be a number");
+ return -1;
+ }
+ self->s->setLength(scalar);
+ return 0;
}
PyDoc_STRVAR(Stroke_id_doc,
-"The Id of this Stroke.\n"
-"\n"
-":type: :class:`Id`");
+ "The Id of this Stroke.\n"
+ "\n"
+ ":type: :class:`Id`");
static PyObject *Stroke_id_get(BPy_Stroke *self, void *UNUSED(closure))
{
- Id id(self->s->getId());
- return BPy_Id_from_Id(id); // return a copy
+ Id id(self->s->getId());
+ return BPy_Id_from_Id(id); // return a copy
}
static int Stroke_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_Id_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be an Id");
- return -1;
- }
- self->s->setId(*(((BPy_Id *)value)->id));
- return 0;
+ if (!BPy_Id_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be an Id");
+ return -1;
+ }
+ self->s->setId(*(((BPy_Id *)value)->id));
+ return 0;
}
static PyGetSetDef BPy_Stroke_getseters[] = {
- {(char *)"medium_type", (getter)Stroke_medium_type_get, (setter)Stroke_medium_type_set,
- (char *)Stroke_medium_type_doc, NULL},
- {(char *)"texture_id", (getter)Stroke_texture_id_get, (setter)Stroke_texture_id_set,
- (char *)Stroke_texture_id_doc, NULL},
- {(char *)"tips", (getter)Stroke_tips_get, (setter)Stroke_tips_set, (char *)Stroke_tips_doc, NULL},
- {(char *)"length_2d", (getter)Stroke_length_2d_get, (setter)Stroke_length_2d_set,
- (char *)Stroke_length_2d_doc, NULL},
- {(char *)"id", (getter)Stroke_id_get, (setter)Stroke_id_set, (char *)Stroke_id_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"medium_type",
+ (getter)Stroke_medium_type_get,
+ (setter)Stroke_medium_type_set,
+ (char *)Stroke_medium_type_doc,
+ NULL},
+ {(char *)"texture_id",
+ (getter)Stroke_texture_id_get,
+ (setter)Stroke_texture_id_set,
+ (char *)Stroke_texture_id_doc,
+ NULL},
+ {(char *)"tips",
+ (getter)Stroke_tips_get,
+ (setter)Stroke_tips_set,
+ (char *)Stroke_tips_doc,
+ NULL},
+ {(char *)"length_2d",
+ (getter)Stroke_length_2d_get,
+ (setter)Stroke_length_2d_set,
+ (char *)Stroke_length_2d_doc,
+ NULL},
+ {(char *)"id", (getter)Stroke_id_get, (setter)Stroke_id_set, (char *)Stroke_id_doc, NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------BPy_Stroke type definition ------------------------------*/
static PySequenceMethods BPy_Stroke_as_sequence = {
- (lenfunc)Stroke_sq_length, /* sq_length */
- NULL, /* sq_concat */
- NULL, /* sq_repeat */
- (ssizeargfunc)Stroke_sq_item, /* sq_item */
- NULL, /* sq_slice */
- NULL, /* sq_ass_item */
- NULL, /* *was* sq_ass_slice */
- NULL, /* sq_contains */
- NULL, /* sq_inplace_concat */
- NULL, /* sq_inplace_repeat */
+ (lenfunc)Stroke_sq_length, /* sq_length */
+ NULL, /* sq_concat */
+ NULL, /* sq_repeat */
+ (ssizeargfunc)Stroke_sq_item, /* sq_item */
+ NULL, /* sq_slice */
+ NULL, /* sq_ass_item */
+ NULL, /* *was* sq_ass_slice */
+ NULL, /* sq_contains */
+ NULL, /* sq_inplace_concat */
+ NULL, /* sq_inplace_repeat */
};
PyTypeObject Stroke_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "Stroke", /* tp_name */
- sizeof(BPy_Stroke), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- &BPy_Stroke_as_sequence, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- Stroke_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- (getiterfunc)Stroke_iter, /* tp_iter */
- 0, /* tp_iternext */
- BPy_Stroke_methods, /* tp_methods */
- 0, /* tp_members */
- BPy_Stroke_getseters, /* tp_getset */
- &Interface1D_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)Stroke_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(NULL, 0) "Stroke", /* tp_name */
+ sizeof(BPy_Stroke), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ &BPy_Stroke_as_sequence, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Stroke_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ (getiterfunc)Stroke_iter, /* tp_iter */
+ 0, /* tp_iternext */
+ BPy_Stroke_methods, /* tp_methods */
+ 0, /* tp_members */
+ BPy_Stroke_getseters, /* tp_getset */
+ &Interface1D_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)Stroke_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h
index 869ff7d07d5..a08905e6043 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h
@@ -33,12 +33,12 @@ extern "C" {
extern PyTypeObject Stroke_Type;
-#define BPy_Stroke_Check(v) (((PyObject *)v)->ob_type == &Stroke_Type)
+#define BPy_Stroke_Check(v) (((PyObject *)v)->ob_type == &Stroke_Type)
/*---------------------------Python BPy_Stroke structure definition----------*/
typedef struct {
- BPy_Interface1D py_if1D;
- Stroke *s;
+ BPy_Interface1D py_if1D;
+ Stroke *s;
} BPy_Stroke;
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
index c047b678a64..6331145974a 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
@@ -37,338 +37,381 @@ extern "C" {
/*----------------------ViewEdge methods ----------------------------*/
PyDoc_STRVAR(ViewEdge_doc,
-"Class hierarchy: :class:`Interface1D` > :class:`ViewEdge`\n"
-"\n"
-"Class defining a ViewEdge. A ViewEdge in an edge of the image graph.\n"
-"it connects two :class:`ViewVertex` objects. It is made by connecting\n"
-"a set of FEdges.\n"
-"\n"
-".. method:: __init__()\n"
-"\n"
-" Default constructor.\n"
-"\n"
-".. method:: __init__(brother)\n"
-"\n"
-" Copy constructor.\n"
-"\n"
-" :arg brother: A ViewEdge object.\n"
-" :type brother: :class:`ViewEdge`");
+ "Class hierarchy: :class:`Interface1D` > :class:`ViewEdge`\n"
+ "\n"
+ "Class defining a ViewEdge. A ViewEdge in an edge of the image graph.\n"
+ "it connects two :class:`ViewVertex` objects. It is made by connecting\n"
+ "a set of FEdges.\n"
+ "\n"
+ ".. method:: __init__()\n"
+ "\n"
+ " Default constructor.\n"
+ "\n"
+ ".. method:: __init__(brother)\n"
+ "\n"
+ " Copy constructor.\n"
+ "\n"
+ " :arg brother: A ViewEdge object.\n"
+ " :type brother: :class:`ViewEdge`");
static int ViewEdge_init(BPy_ViewEdge *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"brother", NULL};
- PyObject *brother = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &ViewEdge_Type, &brother))
- return -1;
- if (!brother)
- self->ve = new ViewEdge();
- else
- self->ve = new ViewEdge(*(((BPy_ViewEdge *)brother)->ve));
- self->py_if1D.if1D = self->ve;
- self->py_if1D.borrowed = false;
- return 0;
+ static const char *kwlist[] = {"brother", NULL};
+ PyObject *brother = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &ViewEdge_Type, &brother))
+ return -1;
+ if (!brother)
+ self->ve = new ViewEdge();
+ else
+ self->ve = new ViewEdge(*(((BPy_ViewEdge *)brother)->ve));
+ self->py_if1D.if1D = self->ve;
+ self->py_if1D.borrowed = false;
+ return 0;
}
PyDoc_STRVAR(ViewEdge_update_fedges_doc,
-".. method:: update_fedges()\n"
-"\n"
-" Sets Viewedge to this for all embedded fedges.\n");
+ ".. method:: update_fedges()\n"
+ "\n"
+ " Sets Viewedge to this for all embedded fedges.\n");
static PyObject *ViewEdge_update_fedges(BPy_ViewEdge *self)
{
- self->ve->UpdateFEdges();
- Py_RETURN_NONE;
+ self->ve->UpdateFEdges();
+ Py_RETURN_NONE;
}
static PyMethodDef BPy_ViewEdge_methods[] = {
- {"update_fedges", (PyCFunction)ViewEdge_update_fedges, METH_NOARGS, ViewEdge_update_fedges_doc},
- {NULL, NULL, 0, NULL},
+ {"update_fedges",
+ (PyCFunction)ViewEdge_update_fedges,
+ METH_NOARGS,
+ ViewEdge_update_fedges_doc},
+ {NULL, NULL, 0, NULL},
};
/*----------------------ViewEdge get/setters ----------------------------*/
PyDoc_STRVAR(ViewEdge_first_viewvertex_doc,
-"The first ViewVertex.\n"
-"\n"
-":type: :class:`ViewVertex`");
+ "The first ViewVertex.\n"
+ "\n"
+ ":type: :class:`ViewVertex`");
static PyObject *ViewEdge_first_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- ViewVertex *v = self->ve->A();
- if (v)
- return Any_BPy_ViewVertex_from_ViewVertex(*v);
- Py_RETURN_NONE;
+ ViewVertex *v = self->ve->A();
+ if (v)
+ return Any_BPy_ViewVertex_from_ViewVertex(*v);
+ Py_RETURN_NONE;
}
-static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
+static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self,
+ PyObject *value,
+ void *UNUSED(closure))
{
- if (!BPy_ViewVertex_Check(value))
- return -1;
- self->ve->setA(((BPy_ViewVertex *)value)->vv);
- return 0;
+ if (!BPy_ViewVertex_Check(value))
+ return -1;
+ self->ve->setA(((BPy_ViewVertex *)value)->vv);
+ return 0;
}
PyDoc_STRVAR(ViewEdge_last_viewvertex_doc,
-"The second ViewVertex.\n"
-"\n"
-":type: :class:`ViewVertex`");
+ "The second ViewVertex.\n"
+ "\n"
+ ":type: :class:`ViewVertex`");
static PyObject *ViewEdge_last_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- ViewVertex *v = self->ve->B();
- if (v)
- return Any_BPy_ViewVertex_from_ViewVertex(*v);
- Py_RETURN_NONE;
+ ViewVertex *v = self->ve->B();
+ if (v)
+ return Any_BPy_ViewVertex_from_ViewVertex(*v);
+ Py_RETURN_NONE;
}
static int ViewEdge_last_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_ViewVertex_Check(value))
- return -1;
- self->ve->setB(((BPy_ViewVertex *)value)->vv);
- return 0;
+ if (!BPy_ViewVertex_Check(value))
+ return -1;
+ self->ve->setB(((BPy_ViewVertex *)value)->vv);
+ return 0;
}
PyDoc_STRVAR(ViewEdge_first_fedge_doc,
-"The first FEdge that constitutes this ViewEdge.\n"
-"\n"
-":type: :class:`FEdge`");
+ "The first FEdge that constitutes this ViewEdge.\n"
+ "\n"
+ ":type: :class:`FEdge`");
static PyObject *ViewEdge_first_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- FEdge *fe = self->ve->fedgeA();
- if (fe)
- return Any_BPy_FEdge_from_FEdge(*fe);
- Py_RETURN_NONE;
+ FEdge *fe = self->ve->fedgeA();
+ if (fe)
+ return Any_BPy_FEdge_from_FEdge(*fe);
+ Py_RETURN_NONE;
}
static int ViewEdge_first_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_FEdge_Check(value))
- return -1;
- self->ve->setFEdgeA(((BPy_FEdge *)value)->fe);
- return 0;
+ if (!BPy_FEdge_Check(value))
+ return -1;
+ self->ve->setFEdgeA(((BPy_FEdge *)value)->fe);
+ return 0;
}
PyDoc_STRVAR(ViewEdge_last_fedge_doc,
-"The last FEdge that constitutes this ViewEdge.\n"
-"\n"
-":type: :class:`FEdge`");
+ "The last FEdge that constitutes this ViewEdge.\n"
+ "\n"
+ ":type: :class:`FEdge`");
static PyObject *ViewEdge_last_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- FEdge *fe = self->ve->fedgeB();
- if (fe)
- return Any_BPy_FEdge_from_FEdge(*fe);
- Py_RETURN_NONE;
+ FEdge *fe = self->ve->fedgeB();
+ if (fe)
+ return Any_BPy_FEdge_from_FEdge(*fe);
+ Py_RETURN_NONE;
}
static int ViewEdge_last_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_FEdge_Check(value))
- return -1;
- self->ve->setFEdgeB(((BPy_FEdge *)value)->fe);
- return 0;
+ if (!BPy_FEdge_Check(value))
+ return -1;
+ self->ve->setFEdgeB(((BPy_FEdge *)value)->fe);
+ return 0;
}
PyDoc_STRVAR(ViewEdge_viewshape_doc,
-"The ViewShape to which this ViewEdge belongs to.\n"
-"\n"
-":type: :class:`ViewShape`");
+ "The ViewShape to which this ViewEdge belongs to.\n"
+ "\n"
+ ":type: :class:`ViewShape`");
static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- ViewShape *vs = self->ve->viewShape();
- if (vs)
- return BPy_ViewShape_from_ViewShape(*vs);
- Py_RETURN_NONE;
+ ViewShape *vs = self->ve->viewShape();
+ if (vs)
+ return BPy_ViewShape_from_ViewShape(*vs);
+ Py_RETURN_NONE;
}
static int ViewEdge_viewshape_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_ViewShape_Check(value))
- return -1;
- self->ve->setShape(((BPy_ViewShape *)value)->vs);
- return 0;
+ if (!BPy_ViewShape_Check(value))
+ return -1;
+ self->ve->setShape(((BPy_ViewShape *)value)->vs);
+ return 0;
}
PyDoc_STRVAR(ViewEdge_occludee_doc,
-"The shape that is occluded by the ViewShape to which this ViewEdge\n"
-"belongs to. If no object is occluded, this property is set to None.\n"
-"\n"
-":type: :class:`ViewShape`");
+ "The shape that is occluded by the ViewShape to which this ViewEdge\n"
+ "belongs to. If no object is occluded, this property is set to None.\n"
+ "\n"
+ ":type: :class:`ViewShape`");
static PyObject *ViewEdge_occludee_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- ViewShape *vs = self->ve->aShape();
- if (vs)
- return BPy_ViewShape_from_ViewShape(*vs);
- Py_RETURN_NONE;
+ ViewShape *vs = self->ve->aShape();
+ if (vs)
+ return BPy_ViewShape_from_ViewShape(*vs);
+ Py_RETURN_NONE;
}
static int ViewEdge_occludee_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_ViewShape_Check(value))
- return -1;
- self->ve->setaShape(((BPy_ViewShape *)value)->vs);
- return 0;
+ if (!BPy_ViewShape_Check(value))
+ return -1;
+ self->ve->setaShape(((BPy_ViewShape *)value)->vs);
+ return 0;
}
PyDoc_STRVAR(ViewEdge_is_closed_doc,
-"True if this ViewEdge forms a closed loop.\n"
-"\n"
-":type: bool");
+ "True if this ViewEdge forms a closed loop.\n"
+ "\n"
+ ":type: bool");
static PyObject *ViewEdge_is_closed_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- return PyBool_from_bool(self->ve->isClosed());
+ return PyBool_from_bool(self->ve->isClosed());
}
PyDoc_STRVAR(ViewEdge_id_doc,
-"The Id of this ViewEdge.\n"
-"\n"
-":type: :class:`Id`");
+ "The Id of this ViewEdge.\n"
+ "\n"
+ ":type: :class:`Id`");
static PyObject *ViewEdge_id_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- Id id(self->ve->getId());
- return BPy_Id_from_Id(id); // return a copy
+ Id id(self->ve->getId());
+ return BPy_Id_from_Id(id); // return a copy
}
static int ViewEdge_id_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_Id_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be an Id");
- return -1;
- }
- self->ve->setId(*(((BPy_Id *)value)->id));
- return 0;
+ if (!BPy_Id_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be an Id");
+ return -1;
+ }
+ self->ve->setId(*(((BPy_Id *)value)->id));
+ return 0;
}
PyDoc_STRVAR(ViewEdge_nature_doc,
-"The nature of this ViewEdge.\n"
-"\n"
-":type: :class:`Nature`");
+ "The nature of this ViewEdge.\n"
+ "\n"
+ ":type: :class:`Nature`");
static PyObject *ViewEdge_nature_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- return BPy_Nature_from_Nature(self->ve->getNature());
+ return BPy_Nature_from_Nature(self->ve->getNature());
}
static int ViewEdge_nature_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_Nature_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "value must be a Nature");
- return -1;
- }
- self->ve->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i));
- return 0;
+ if (!BPy_Nature_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "value must be a Nature");
+ return -1;
+ }
+ self->ve->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i));
+ return 0;
}
PyDoc_STRVAR(ViewEdge_qi_doc,
-"The quantitative invisibility.\n"
-"\n"
-":type: int");
+ "The quantitative invisibility.\n"
+ "\n"
+ ":type: int");
static PyObject *ViewEdge_qi_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- return PyLong_FromLong(self->ve->qi());
+ return PyLong_FromLong(self->ve->qi());
}
static int ViewEdge_qi_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- int qi;
+ int qi;
- if ((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred())
- return -1;
- self->ve->setQI(qi);
- return 0;
+ if ((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred())
+ return -1;
+ self->ve->setQI(qi);
+ return 0;
}
PyDoc_STRVAR(ViewEdge_chaining_time_stamp_doc,
-"The time stamp of this ViewEdge.\n"
-"\n"
-":type: int");
+ "The time stamp of this ViewEdge.\n"
+ "\n"
+ ":type: int");
static PyObject *ViewEdge_chaining_time_stamp_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
- return PyLong_FromLong(self->ve->getChainingTimeStamp());
+ return PyLong_FromLong(self->ve->getChainingTimeStamp());
}
-static int ViewEdge_chaining_time_stamp_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
+static int ViewEdge_chaining_time_stamp_set(BPy_ViewEdge *self,
+ PyObject *value,
+ void *UNUSED(closure))
{
- int timestamp;
+ int timestamp;
- if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred())
- return -1;
- self->ve->setChainingTimeStamp(timestamp);
- return 0;
+ if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred())
+ return -1;
+ self->ve->setChainingTimeStamp(timestamp);
+ return 0;
}
static PyGetSetDef BPy_ViewEdge_getseters[] = {
- {(char *)"first_viewvertex", (getter)ViewEdge_first_viewvertex_get, (setter)ViewEdge_first_viewvertex_set,
- (char *)ViewEdge_first_viewvertex_doc, NULL},
- {(char *)"last_viewvertex", (getter)ViewEdge_last_viewvertex_get, (setter)ViewEdge_last_viewvertex_set,
- (char *)ViewEdge_last_viewvertex_doc, NULL},
- {(char *)"first_fedge", (getter)ViewEdge_first_fedge_get, (setter)ViewEdge_first_fedge_set,
- (char *)ViewEdge_first_fedge_doc, NULL},
- {(char *)"last_fedge", (getter)ViewEdge_last_fedge_get, (setter)ViewEdge_last_fedge_set,
- (char *)ViewEdge_last_fedge_doc, NULL},
- {(char *)"viewshape", (getter)ViewEdge_viewshape_get, (setter)ViewEdge_viewshape_set,
- (char *)ViewEdge_viewshape_doc, NULL},
- {(char *)"occludee", (getter)ViewEdge_occludee_get, (setter)ViewEdge_occludee_set,
- (char *)ViewEdge_occludee_doc, NULL},
- {(char *)"is_closed", (getter)ViewEdge_is_closed_get, (setter)NULL, (char *)ViewEdge_is_closed_doc, NULL},
- {(char *)"id", (getter)ViewEdge_id_get, (setter)ViewEdge_id_set, (char *)ViewEdge_id_doc, NULL},
- {(char *)"nature", (getter)ViewEdge_nature_get, (setter)ViewEdge_nature_set, (char *)ViewEdge_nature_doc, NULL},
- {(char *)"qi", (getter)ViewEdge_qi_get, (setter)ViewEdge_qi_set, (char *)ViewEdge_qi_doc, NULL},
- {(char *)"chaining_time_stamp", (getter)ViewEdge_chaining_time_stamp_get, (setter)ViewEdge_chaining_time_stamp_set,
- (char *)ViewEdge_chaining_time_stamp_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"first_viewvertex",
+ (getter)ViewEdge_first_viewvertex_get,
+ (setter)ViewEdge_first_viewvertex_set,
+ (char *)ViewEdge_first_viewvertex_doc,
+ NULL},
+ {(char *)"last_viewvertex",
+ (getter)ViewEdge_last_viewvertex_get,
+ (setter)ViewEdge_last_viewvertex_set,
+ (char *)ViewEdge_last_viewvertex_doc,
+ NULL},
+ {(char *)"first_fedge",
+ (getter)ViewEdge_first_fedge_get,
+ (setter)ViewEdge_first_fedge_set,
+ (char *)ViewEdge_first_fedge_doc,
+ NULL},
+ {(char *)"last_fedge",
+ (getter)ViewEdge_last_fedge_get,
+ (setter)ViewEdge_last_fedge_set,
+ (char *)ViewEdge_last_fedge_doc,
+ NULL},
+ {(char *)"viewshape",
+ (getter)ViewEdge_viewshape_get,
+ (setter)ViewEdge_viewshape_set,
+ (char *)ViewEdge_viewshape_doc,
+ NULL},
+ {(char *)"occludee",
+ (getter)ViewEdge_occludee_get,
+ (setter)ViewEdge_occludee_set,
+ (char *)ViewEdge_occludee_doc,
+ NULL},
+ {(char *)"is_closed",
+ (getter)ViewEdge_is_closed_get,
+ (setter)NULL,
+ (char *)ViewEdge_is_closed_doc,
+ NULL},
+ {(char *)"id",
+ (getter)ViewEdge_id_get,
+ (setter)ViewEdge_id_set,
+ (char *)ViewEdge_id_doc,
+ NULL},
+ {(char *)"nature",
+ (getter)ViewEdge_nature_get,
+ (setter)ViewEdge_nature_set,
+ (char *)ViewEdge_nature_doc,
+ NULL},
+ {(char *)"qi",
+ (getter)ViewEdge_qi_get,
+ (setter)ViewEdge_qi_set,
+ (char *)ViewEdge_qi_doc,
+ NULL},
+ {(char *)"chaining_time_stamp",
+ (getter)ViewEdge_chaining_time_stamp_get,
+ (setter)ViewEdge_chaining_time_stamp_set,
+ (char *)ViewEdge_chaining_time_stamp_doc,
+ NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------BPy_ViewEdge type definition ------------------------------*/
PyTypeObject ViewEdge_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "ViewEdge", /* tp_name */
- sizeof(BPy_ViewEdge), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- ViewEdge_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- BPy_ViewEdge_methods, /* tp_methods */
- 0, /* tp_members */
- BPy_ViewEdge_getseters, /* tp_getset */
- &Interface1D_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)ViewEdge_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(NULL, 0) "ViewEdge", /* tp_name */
+ sizeof(BPy_ViewEdge), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ ViewEdge_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ BPy_ViewEdge_methods, /* tp_methods */
+ 0, /* tp_members */
+ BPy_ViewEdge_getseters, /* tp_getset */
+ &Interface1D_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)ViewEdge_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h
index 81fd21fa092..c02d5d0f21b 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h
@@ -37,8 +37,8 @@ extern PyTypeObject ViewEdge_Type;
/*---------------------------Python BPy_ViewEdge structure definition----------*/
typedef struct {
- BPy_Interface1D py_if1D;
- ViewEdge *ve;
+ BPy_Interface1D py_if1D;
+ ViewEdge *ve;
} BPy_ViewEdge;
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
index 0185fcc5ebe..7a6b2a01728 100644
--- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
@@ -33,160 +33,160 @@ extern "C" {
/*----------------------Chain methods ----------------------------*/
PyDoc_STRVAR(Chain_doc,
-"Class hierarchy: :class:`Interface1D` > :class:`Curve` > :class:`Chain`\n"
-"\n"
-"Class to represent a 1D elements issued from the chaining process. A\n"
-"Chain is the last step before the :class:`Stroke` and is used in the\n"
-"Splitting and Creation processes.\n"
-"\n"
-".. method:: __init__()\n"
-"\n"
-" Default constructor.\n"
-"\n"
-".. method:: __init__(brother)\n"
-"\n"
-" Copy constructor.\n"
-"\n"
-" :arg brother: A Chain object.\n"
-" :type brother: :class:`Chain`\n"
-"\n"
-".. method:: __init__(id)\n"
-"\n"
-" Builds a chain from its Id.\n"
-"\n"
-" :arg id: An Id object.\n"
-" :type id: :class:`Id`");
+ "Class hierarchy: :class:`Interface1D` > :class:`Curve` > :class:`Chain`\n"
+ "\n"
+ "Class to represent a 1D elements issued from the chaining process. A\n"
+ "Chain is the last step before the :class:`Stroke` and is used in the\n"
+ "Splitting and Creation processes.\n"
+ "\n"
+ ".. method:: __init__()\n"
+ "\n"
+ " Default constructor.\n"
+ "\n"
+ ".. method:: __init__(brother)\n"
+ "\n"
+ " Copy constructor.\n"
+ "\n"
+ " :arg brother: A Chain object.\n"
+ " :type brother: :class:`Chain`\n"
+ "\n"
+ ".. method:: __init__(id)\n"
+ "\n"
+ " Builds a chain from its Id.\n"
+ "\n"
+ " :arg id: An Id object.\n"
+ " :type id: :class:`Id`");
static int Chain_init(BPy_Chain *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist_1[] = {"brother", NULL};
- static const char *kwlist_2[] = {"id", NULL};
- PyObject *obj = 0;
-
- if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &Chain_Type, &obj)) {
- if (!obj)
- self->c = new Chain();
- else
- self->c = new Chain(*(((BPy_Chain *)obj)->c));
- }
- else if (PyErr_Clear(),
- PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj))
- {
- self->c = new Chain(*(((BPy_Id *)obj)->id));
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
- return -1;
- }
- self->py_c.c = self->c;
- self->py_c.py_if1D.if1D = self->c;
- self->py_c.py_if1D.borrowed = false;
- return 0;
+ static const char *kwlist_1[] = {"brother", NULL};
+ static const char *kwlist_2[] = {"id", NULL};
+ PyObject *obj = 0;
+
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &Chain_Type, &obj)) {
+ if (!obj)
+ self->c = new Chain();
+ else
+ self->c = new Chain(*(((BPy_Chain *)obj)->c));
+ }
+ else if (PyErr_Clear(),
+ PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) {
+ self->c = new Chain(*(((BPy_Id *)obj)->id));
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return -1;
+ }
+ self->py_c.c = self->c;
+ self->py_c.py_if1D.if1D = self->c;
+ self->py_c.py_if1D.borrowed = false;
+ return 0;
}
PyDoc_STRVAR(Chain_push_viewedge_back_doc,
-".. method:: push_viewedge_back(viewedge, orientation)\n"
-"\n"
-" Adds a ViewEdge at the end of the Chain.\n"
-"\n"
-" :arg viewedge: The ViewEdge that must be added.\n"
-" :type viewedge: :class:`ViewEdge`\n"
-" :arg orientation: The orientation with which the ViewEdge must be\n"
-" processed.\n"
-" :type orientation: bool");
+ ".. method:: push_viewedge_back(viewedge, orientation)\n"
+ "\n"
+ " Adds a ViewEdge at the end of the Chain.\n"
+ "\n"
+ " :arg viewedge: The ViewEdge that must be added.\n"
+ " :type viewedge: :class:`ViewEdge`\n"
+ " :arg orientation: The orientation with which the ViewEdge must be\n"
+ " processed.\n"
+ " :type orientation: bool");
static PyObject *Chain_push_viewedge_back(BPy_Chain *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"viewedge", "orientation", NULL};
- PyObject *obj1 = 0, *obj2 = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
- &ViewEdge_Type, &obj1, &PyBool_Type, &obj2))
- {
- return NULL;
- }
- ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve;
- bool orientation = bool_from_PyBool(obj2);
- self->c->push_viewedge_back(ve, orientation);
- Py_RETURN_NONE;
+ static const char *kwlist[] = {"viewedge", "orientation", NULL};
+ PyObject *obj1 = 0, *obj2 = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kwds, "O!O!", (char **)kwlist, &ViewEdge_Type, &obj1, &PyBool_Type, &obj2)) {
+ return NULL;
+ }
+ ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve;
+ bool orientation = bool_from_PyBool(obj2);
+ self->c->push_viewedge_back(ve, orientation);
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(Chain_push_viewedge_front_doc,
-".. method:: push_viewedge_front(viewedge, orientation)\n"
-"\n"
-" Adds a ViewEdge at the beginning of the Chain.\n"
-"\n"
-" :arg viewedge: The ViewEdge that must be added.\n"
-" :type viewedge: :class:`ViewEdge`\n"
-" :arg orientation: The orientation with which the ViewEdge must be\n"
-" processed.\n"
-" :type orientation: bool");
+ ".. method:: push_viewedge_front(viewedge, orientation)\n"
+ "\n"
+ " Adds a ViewEdge at the beginning of the Chain.\n"
+ "\n"
+ " :arg viewedge: The ViewEdge that must be added.\n"
+ " :type viewedge: :class:`ViewEdge`\n"
+ " :arg orientation: The orientation with which the ViewEdge must be\n"
+ " processed.\n"
+ " :type orientation: bool");
static PyObject *Chain_push_viewedge_front(BPy_Chain *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist[] = {"viewedge", "orientation", NULL};
- PyObject *obj1 = 0, *obj2 = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
- &ViewEdge_Type, &obj1, &PyBool_Type, &obj2))
- {
- return NULL;
- }
- ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve;
- bool orientation = bool_from_PyBool(obj2);
- self->c->push_viewedge_front(ve, orientation);
- Py_RETURN_NONE;
+ static const char *kwlist[] = {"viewedge", "orientation", NULL};
+ PyObject *obj1 = 0, *obj2 = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kwds, "O!O!", (char **)kwlist, &ViewEdge_Type, &obj1, &PyBool_Type, &obj2)) {
+ return NULL;
+ }
+ ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve;
+ bool orientation = bool_from_PyBool(obj2);
+ self->c->push_viewedge_front(ve, orientation);
+ Py_RETURN_NONE;
}
static PyMethodDef BPy_Chain_methods[] = {
- {"push_viewedge_back", (PyCFunction)Chain_push_viewedge_back, METH_VARARGS | METH_KEYWORDS,
- Chain_push_viewedge_back_doc},
- {"push_viewedge_front", (PyCFunction)Chain_push_viewedge_front, METH_VARARGS | METH_KEYWORDS,
- Chain_push_viewedge_front_doc},
- {NULL, NULL, 0, NULL},
+ {"push_viewedge_back",
+ (PyCFunction)Chain_push_viewedge_back,
+ METH_VARARGS | METH_KEYWORDS,
+ Chain_push_viewedge_back_doc},
+ {"push_viewedge_front",
+ (PyCFunction)Chain_push_viewedge_front,
+ METH_VARARGS | METH_KEYWORDS,
+ Chain_push_viewedge_front_doc},
+ {NULL, NULL, 0, NULL},
};
/*-----------------------BPy_Chain type definition ------------------------------*/
PyTypeObject Chain_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "Chain", /* tp_name */
- sizeof(BPy_Chain), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- Chain_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- BPy_Chain_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- &FrsCurve_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)Chain_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(NULL, 0) "Chain", /* tp_name */
+ sizeof(BPy_Chain), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Chain_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ BPy_Chain_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ &FrsCurve_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)Chain_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h
index 3356b0144d6..a9392cd81bf 100644
--- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h
+++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h
@@ -37,8 +37,8 @@ extern PyTypeObject Chain_Type;
/*---------------------------Python BPy_Chain structure definition----------*/
typedef struct {
- BPy_FrsCurve py_c;
- Chain *c;
+ BPy_FrsCurve py_c;
+ Chain *c;
} BPy_Chain;
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
index 8d83c942d93..e91ae155929 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
@@ -32,396 +32,414 @@ extern "C" {
/*----------------------FEdgeSharp methods ----------------------------*/
PyDoc_STRVAR(FEdgeSharp_doc,
-"Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSharp`\n"
-"\n"
-"Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial\n"
-"edge of the input mesh. It can be a silhouette, a crease or a border.\n"
-"If it is a crease edge, then it is borded by two faces of the mesh.\n"
-"Face a lies on its right whereas Face b lies on its left. If it is a\n"
-"border edge, then it doesn't have any face on its right, and thus Face\n"
-"a is None.\n"
-"\n"
-".. method:: __init__()\n"
-"\n"
-" Default constructor.\n"
-"\n"
-".. method:: __init__(brother)\n"
-"\n"
-" Copy constructor.\n"
-"\n"
-" :arg brother: An FEdgeSharp object.\n"
-" :type brother: :class:`FEdgeSharp`\n"
-"\n"
-".. method:: __init__(first_vertex, second_vertex)\n"
-"\n"
-" Builds an FEdgeSharp going from the first vertex to the second.\n"
-"\n"
-" :arg first_vertex: The first SVertex object.\n"
-" :type first_vertex: :class:`SVertex`\n"
-" :arg second_vertex: The second SVertex object.\n"
-" :type second_vertex: :class:`SVertex`");
+ "Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSharp`\n"
+ "\n"
+ "Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial\n"
+ "edge of the input mesh. It can be a silhouette, a crease or a border.\n"
+ "If it is a crease edge, then it is borded by two faces of the mesh.\n"
+ "Face a lies on its right whereas Face b lies on its left. If it is a\n"
+ "border edge, then it doesn't have any face on its right, and thus Face\n"
+ "a is None.\n"
+ "\n"
+ ".. method:: __init__()\n"
+ "\n"
+ " Default constructor.\n"
+ "\n"
+ ".. method:: __init__(brother)\n"
+ "\n"
+ " Copy constructor.\n"
+ "\n"
+ " :arg brother: An FEdgeSharp object.\n"
+ " :type brother: :class:`FEdgeSharp`\n"
+ "\n"
+ ".. method:: __init__(first_vertex, second_vertex)\n"
+ "\n"
+ " Builds an FEdgeSharp going from the first vertex to the second.\n"
+ "\n"
+ " :arg first_vertex: The first SVertex object.\n"
+ " :type first_vertex: :class:`SVertex`\n"
+ " :arg second_vertex: The second SVertex object.\n"
+ " :type second_vertex: :class:`SVertex`");
static int FEdgeSharp_init(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist_1[] = {"brother", NULL};
- static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL};
- PyObject *obj1 = 0, *obj2 = 0;
-
- if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSharp_Type, &obj1)) {
- if (!obj1)
- self->fes = new FEdgeSharp();
- else
- self->fes = new FEdgeSharp(*(((BPy_FEdgeSharp *)obj1)->fes));
- }
- else if (PyErr_Clear(),
- PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist_2,
- &SVertex_Type, &obj1, &SVertex_Type, &obj2))
- {
- self->fes = new FEdgeSharp(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
- return -1;
- }
- self->py_fe.fe = self->fes;
- self->py_fe.py_if1D.if1D = self->fes;
- self->py_fe.py_if1D.borrowed = false;
- return 0;
+ static const char *kwlist_1[] = {"brother", NULL};
+ static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL};
+ PyObject *obj1 = 0, *obj2 = 0;
+
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSharp_Type, &obj1)) {
+ if (!obj1)
+ self->fes = new FEdgeSharp();
+ else
+ self->fes = new FEdgeSharp(*(((BPy_FEdgeSharp *)obj1)->fes));
+ }
+ else if (PyErr_Clear(),
+ PyArg_ParseTupleAndKeywords(args,
+ kwds,
+ "O!O!",
+ (char **)kwlist_2,
+ &SVertex_Type,
+ &obj1,
+ &SVertex_Type,
+ &obj2)) {
+ self->fes = new FEdgeSharp(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return -1;
+ }
+ self->py_fe.fe = self->fes;
+ self->py_fe.py_if1D.if1D = self->fes;
+ self->py_fe.py_if1D.borrowed = false;
+ return 0;
}
/*----------------------mathutils callbacks ----------------------------*/
/* subtype */
-#define MATHUTILS_SUBTYPE_NORMAL_A 1
-#define MATHUTILS_SUBTYPE_NORMAL_B 2
+#define MATHUTILS_SUBTYPE_NORMAL_A 1
+#define MATHUTILS_SUBTYPE_NORMAL_B 2
static int FEdgeSharp_mathutils_check(BaseMathObject *bmo)
{
- if (!BPy_FEdgeSharp_Check(bmo->cb_user))
- return -1;
- return 0;
+ if (!BPy_FEdgeSharp_Check(bmo->cb_user))
+ return -1;
+ return 0;
}
static int FEdgeSharp_mathutils_get(BaseMathObject *bmo, int subtype)
{
- BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
- switch (subtype) {
- case MATHUTILS_SUBTYPE_NORMAL_A:
- {
- Vec3r p(self->fes->normalA());
- bmo->data[0] = p[0];
- bmo->data[1] = p[1];
- bmo->data[2] = p[2];
- }
- break;
- case MATHUTILS_SUBTYPE_NORMAL_B:
- {
- Vec3r p(self->fes->normalB());
- bmo->data[0] = p[0];
- bmo->data[1] = p[1];
- bmo->data[2] = p[2];
- }
- break;
- default:
- return -1;
- }
- return 0;
+ BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
+ switch (subtype) {
+ case MATHUTILS_SUBTYPE_NORMAL_A: {
+ Vec3r p(self->fes->normalA());
+ bmo->data[0] = p[0];
+ bmo->data[1] = p[1];
+ bmo->data[2] = p[2];
+ } break;
+ case MATHUTILS_SUBTYPE_NORMAL_B: {
+ Vec3r p(self->fes->normalB());
+ bmo->data[0] = p[0];
+ bmo->data[1] = p[1];
+ bmo->data[2] = p[2];
+ } break;
+ default:
+ return -1;
+ }
+ return 0;
}
static int FEdgeSharp_mathutils_set(BaseMathObject *bmo, int subtype)
{
- BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
- switch (subtype) {
- case MATHUTILS_SUBTYPE_NORMAL_A:
- {
- Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
- self->fes->setNormalA(p);
- }
- break;
- case MATHUTILS_SUBTYPE_NORMAL_B:
- {
- Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
- self->fes->setNormalB(p);
- }
- break;
- default:
- return -1;
- }
- return 0;
+ BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
+ switch (subtype) {
+ case MATHUTILS_SUBTYPE_NORMAL_A: {
+ Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
+ self->fes->setNormalA(p);
+ } break;
+ case MATHUTILS_SUBTYPE_NORMAL_B: {
+ Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
+ self->fes->setNormalB(p);
+ } break;
+ default:
+ return -1;
+ }
+ return 0;
}
static int FEdgeSharp_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
{
- BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
- switch (subtype) {
- case MATHUTILS_SUBTYPE_NORMAL_A:
- {
- Vec3r p(self->fes->normalA());
- bmo->data[index] = p[index];
- }
- break;
- case MATHUTILS_SUBTYPE_NORMAL_B:
- {
- Vec3r p(self->fes->normalB());
- bmo->data[index] = p[index];
- }
- break;
- default:
- return -1;
- }
- return 0;
+ BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
+ switch (subtype) {
+ case MATHUTILS_SUBTYPE_NORMAL_A: {
+ Vec3r p(self->fes->normalA());
+ bmo->data[index] = p[index];
+ } break;
+ case MATHUTILS_SUBTYPE_NORMAL_B: {
+ Vec3r p(self->fes->normalB());
+ bmo->data[index] = p[index];
+ } break;
+ default:
+ return -1;
+ }
+ return 0;
}
static int FEdgeSharp_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
{
- BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
- switch (subtype) {
- case MATHUTILS_SUBTYPE_NORMAL_A:
- {
- Vec3r p(self->fes->normalA());
- p[index] = bmo->data[index];
- self->fes->setNormalA(p);
- }
- break;
- case MATHUTILS_SUBTYPE_NORMAL_B:
- {
- Vec3r p(self->fes->normalB());
- p[index] = bmo->data[index];
- self->fes->setNormalB(p);
- }
- break;
- default:
- return -1;
- }
- return 0;
+ BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
+ switch (subtype) {
+ case MATHUTILS_SUBTYPE_NORMAL_A: {
+ Vec3r p(self->fes->normalA());
+ p[index] = bmo->data[index];
+ self->fes->setNormalA(p);
+ } break;
+ case MATHUTILS_SUBTYPE_NORMAL_B: {
+ Vec3r p(self->fes->normalB());
+ p[index] = bmo->data[index];
+ self->fes->setNormalB(p);
+ } break;
+ default:
+ return -1;
+ }
+ return 0;
}
static Mathutils_Callback FEdgeSharp_mathutils_cb = {
- FEdgeSharp_mathutils_check,
- FEdgeSharp_mathutils_get,
- FEdgeSharp_mathutils_set,
- FEdgeSharp_mathutils_get_index,
- FEdgeSharp_mathutils_set_index,
+ FEdgeSharp_mathutils_check,
+ FEdgeSharp_mathutils_get,
+ FEdgeSharp_mathutils_set,
+ FEdgeSharp_mathutils_get_index,
+ FEdgeSharp_mathutils_set_index,
};
static unsigned char FEdgeSharp_mathutils_cb_index = -1;
void FEdgeSharp_mathutils_register_callback()
{
- FEdgeSharp_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSharp_mathutils_cb);
+ FEdgeSharp_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSharp_mathutils_cb);
}
/*----------------------FEdgeSharp get/setters ----------------------------*/
PyDoc_STRVAR(FEdgeSharp_normal_right_doc,
-"The normal to the face lying on the right of the FEdge. If this FEdge\n"
-"is a border, it has no Face on its right and therefore no normal.\n"
-"\n"
-":type: :class:`mathutils.Vector`");
+ "The normal to the face lying on the right of the FEdge. If this FEdge\n"
+ "is a border, it has no Face on its right and therefore no normal.\n"
+ "\n"
+ ":type: :class:`mathutils.Vector`");
static PyObject *FEdgeSharp_normal_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
{
- return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_A);
+ return Vector_CreatePyObject_cb(
+ (PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_A);
}
-static int FEdgeSharp_normal_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
+static int FEdgeSharp_normal_right_set(BPy_FEdgeSharp *self,
+ PyObject *value,
+ void *UNUSED(closure))
{
- float v[3];
- if (mathutils_array_parse(v, 3, 3, value,
- "value must be a 3-dimensional vector") == -1)
- {
- return -1;
- }
- Vec3r p(v[0], v[1], v[2]);
- self->fes->setNormalA(p);
- return 0;
+ float v[3];
+ if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) {
+ return -1;
+ }
+ Vec3r p(v[0], v[1], v[2]);
+ self->fes->setNormalA(p);
+ return 0;
}
PyDoc_STRVAR(FEdgeSharp_normal_left_doc,
-"The normal to the face lying on the left of the FEdge.\n"
-"\n"
-":type: :class:`mathutils.Vector`");
+ "The normal to the face lying on the left of the FEdge.\n"
+ "\n"
+ ":type: :class:`mathutils.Vector`");
static PyObject *FEdgeSharp_normal_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
{
- return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_B);
+ return Vector_CreatePyObject_cb(
+ (PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_B);
}
static int FEdgeSharp_normal_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
{
- float v[3];
- if (mathutils_array_parse(v, 3, 3, value,
- "value must be a 3-dimensional vector") == -1)
- {
- return -1;
- }
- Vec3r p(v[0], v[1], v[2]);
- self->fes->setNormalB(p);
- return 0;
+ float v[3];
+ if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) {
+ return -1;
+ }
+ Vec3r p(v[0], v[1], v[2]);
+ self->fes->setNormalB(p);
+ return 0;
}
PyDoc_STRVAR(FEdgeSharp_material_index_right_doc,
-"The index of the material of the face lying on the right of the FEdge.\n"
-"If this FEdge is a border, it has no Face on its right and therefore\n"
-"no material.\n"
-"\n"
-":type: int");
+ "The index of the material of the face lying on the right of the FEdge.\n"
+ "If this FEdge is a border, it has no Face on its right and therefore\n"
+ "no material.\n"
+ "\n"
+ ":type: int");
static PyObject *FEdgeSharp_material_index_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
{
- return PyLong_FromLong(self->fes->aFrsMaterialIndex());
+ return PyLong_FromLong(self->fes->aFrsMaterialIndex());
}
-static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
+static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self,
+ PyObject *value,
+ void *UNUSED(closure))
{
- unsigned int i = PyLong_AsUnsignedLong(value);
- if (PyErr_Occurred())
- return -1;
- self->fes->setaFrsMaterialIndex(i);
- return 0;
+ unsigned int i = PyLong_AsUnsignedLong(value);
+ if (PyErr_Occurred())
+ return -1;
+ self->fes->setaFrsMaterialIndex(i);
+ return 0;
}
PyDoc_STRVAR(FEdgeSharp_material_index_left_doc,
-"The index of the material of the face lying on the left of the FEdge.\n"
-"\n"
-":type: int");
+ "The index of the material of the face lying on the left of the FEdge.\n"
+ "\n"
+ ":type: int");
static PyObject *FEdgeSharp_material_index_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
{
- return PyLong_FromLong(self->fes->bFrsMaterialIndex());
+ return PyLong_FromLong(self->fes->bFrsMaterialIndex());
}
-static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
+static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self,
+ PyObject *value,
+ void *UNUSED(closure))
{
- unsigned int i = PyLong_AsUnsignedLong(value);
- if (PyErr_Occurred())
- return -1;
- self->fes->setbFrsMaterialIndex(i);
- return 0;
+ unsigned int i = PyLong_AsUnsignedLong(value);
+ if (PyErr_Occurred())
+ return -1;
+ self->fes->setbFrsMaterialIndex(i);
+ return 0;
}
PyDoc_STRVAR(FEdgeSharp_material_right_doc,
-"The material of the face lying on the right of the FEdge. If this FEdge\n"
-"is a border, it has no Face on its right and therefore no material.\n"
-"\n"
-":type: :class:`Material`");
+ "The material of the face lying on the right of the FEdge. If this FEdge\n"
+ "is a border, it has no Face on its right and therefore no material.\n"
+ "\n"
+ ":type: :class:`Material`");
static PyObject *FEdgeSharp_material_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
{
- return BPy_FrsMaterial_from_FrsMaterial(self->fes->aFrsMaterial());
+ return BPy_FrsMaterial_from_FrsMaterial(self->fes->aFrsMaterial());
}
PyDoc_STRVAR(FEdgeSharp_material_left_doc,
-"The material of the face lying on the left of the FEdge.\n"
-"\n"
-":type: :class:`Material`");
+ "The material of the face lying on the left of the FEdge.\n"
+ "\n"
+ ":type: :class:`Material`");
static PyObject *FEdgeSharp_material_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
{
- return BPy_FrsMaterial_from_FrsMaterial(self->fes->bFrsMaterial());
+ return BPy_FrsMaterial_from_FrsMaterial(self->fes->bFrsMaterial());
}
PyDoc_STRVAR(FEdgeSharp_face_mark_right_doc,
-"The face mark of the face lying on the right of the FEdge. If this FEdge\n"
-"is a border, it has no face on the right and thus this property is set to\n"
-"false.\n"
-"\n"
-":type: bool");
+ "The face mark of the face lying on the right of the FEdge. If this FEdge\n"
+ "is a border, it has no face on the right and thus this property is set to\n"
+ "false.\n"
+ "\n"
+ ":type: bool");
static PyObject *FEdgeSharp_face_mark_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
{
- return PyBool_from_bool(self->fes->aFaceMark());
+ return PyBool_from_bool(self->fes->aFaceMark());
}
-static int FEdgeSharp_face_mark_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
+static int FEdgeSharp_face_mark_right_set(BPy_FEdgeSharp *self,
+ PyObject *value,
+ void *UNUSED(closure))
{
- if (!PyBool_Check(value))
- return -1;
- self->fes->setaFaceMark(bool_from_PyBool(value));
- return 0;
+ if (!PyBool_Check(value))
+ return -1;
+ self->fes->setaFaceMark(bool_from_PyBool(value));
+ return 0;
}
PyDoc_STRVAR(FEdgeSharp_face_mark_left_doc,
-"The face mark of the face lying on the left of the FEdge.\n"
-"\n"
-":type: bool");
+ "The face mark of the face lying on the left of the FEdge.\n"
+ "\n"
+ ":type: bool");
static PyObject *FEdgeSharp_face_mark_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure))
{
- return PyBool_from_bool(self->fes->bFaceMark());
+ return PyBool_from_bool(self->fes->bFaceMark());
}
-static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure))
+static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self,
+ PyObject *value,
+ void *UNUSED(closure))
{
- if (!PyBool_Check(value))
- return -1;
- self->fes->setbFaceMark(bool_from_PyBool(value));
- return 0;
+ if (!PyBool_Check(value))
+ return -1;
+ self->fes->setbFaceMark(bool_from_PyBool(value));
+ return 0;
}
static PyGetSetDef BPy_FEdgeSharp_getseters[] = {
- {(char *)"normal_right", (getter)FEdgeSharp_normal_right_get, (setter)FEdgeSharp_normal_right_set,
- (char *)FEdgeSharp_normal_right_doc, NULL},
- {(char *)"normal_left", (getter)FEdgeSharp_normal_left_get, (setter)FEdgeSharp_normal_left_set,
- (char *)FEdgeSharp_normal_left_doc, NULL},
- {(char *)"material_index_right", (getter)FEdgeSharp_material_index_right_get,
- (setter)FEdgeSharp_material_index_right_set,
- (char *)FEdgeSharp_material_index_right_doc, NULL},
- {(char *)"material_index_left", (getter)FEdgeSharp_material_index_left_get,
- (setter)FEdgeSharp_material_index_left_set,
- (char *)FEdgeSharp_material_index_left_doc, NULL},
- {(char *)"material_right", (getter)FEdgeSharp_material_right_get, (setter)NULL,
- (char *)FEdgeSharp_material_right_doc, NULL},
- {(char *)"material_left", (getter)FEdgeSharp_material_left_get, (setter)NULL,
- (char *)FEdgeSharp_material_left_doc, NULL},
- {(char *)"face_mark_right", (getter)FEdgeSharp_face_mark_right_get, (setter)FEdgeSharp_face_mark_right_set,
- (char *)FEdgeSharp_face_mark_right_doc, NULL},
- {(char *)"face_mark_left", (getter)FEdgeSharp_face_mark_left_get, (setter)FEdgeSharp_face_mark_left_set,
- (char *)FEdgeSharp_face_mark_left_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"normal_right",
+ (getter)FEdgeSharp_normal_right_get,
+ (setter)FEdgeSharp_normal_right_set,
+ (char *)FEdgeSharp_normal_right_doc,
+ NULL},
+ {(char *)"normal_left",
+ (getter)FEdgeSharp_normal_left_get,
+ (setter)FEdgeSharp_normal_left_set,
+ (char *)FEdgeSharp_normal_left_doc,
+ NULL},
+ {(char *)"material_index_right",
+ (getter)FEdgeSharp_material_index_right_get,
+ (setter)FEdgeSharp_material_index_right_set,
+ (char *)FEdgeSharp_material_index_right_doc,
+ NULL},
+ {(char *)"material_index_left",
+ (getter)FEdgeSharp_material_index_left_get,
+ (setter)FEdgeSharp_material_index_left_set,
+ (char *)FEdgeSharp_material_index_left_doc,
+ NULL},
+ {(char *)"material_right",
+ (getter)FEdgeSharp_material_right_get,
+ (setter)NULL,
+ (char *)FEdgeSharp_material_right_doc,
+ NULL},
+ {(char *)"material_left",
+ (getter)FEdgeSharp_material_left_get,
+ (setter)NULL,
+ (char *)FEdgeSharp_material_left_doc,
+ NULL},
+ {(char *)"face_mark_right",
+ (getter)FEdgeSharp_face_mark_right_get,
+ (setter)FEdgeSharp_face_mark_right_set,
+ (char *)FEdgeSharp_face_mark_right_doc,
+ NULL},
+ {(char *)"face_mark_left",
+ (getter)FEdgeSharp_face_mark_left_get,
+ (setter)FEdgeSharp_face_mark_left_set,
+ (char *)FEdgeSharp_face_mark_left_doc,
+ NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------BPy_FEdgeSharp type definition ------------------------------*/
PyTypeObject FEdgeSharp_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "FEdgeSharp", /* tp_name */
- sizeof(BPy_FEdgeSharp), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- FEdgeSharp_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- BPy_FEdgeSharp_getseters, /* tp_getset */
- &FEdge_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)FEdgeSharp_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(NULL, 0) "FEdgeSharp", /* tp_name */
+ sizeof(BPy_FEdgeSharp), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ FEdgeSharp_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ BPy_FEdgeSharp_getseters, /* tp_getset */
+ &FEdge_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)FEdgeSharp_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h
index be9adf311b6..450539acb16 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h
@@ -37,8 +37,8 @@ extern PyTypeObject FEdgeSharp_Type;
/*---------------------------Python BPy_FEdgeSharp structure definition----------*/
typedef struct {
- BPy_FEdge py_fe;
- FEdgeSharp *fes;
+ BPy_FEdge py_fe;
+ FEdgeSharp *fes;
} BPy_FEdgeSharp;
/*---------------------------Python BPy_FEdgeSharp visible prototypes-----------*/
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
index 726fe97b3ea..08d18123172 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
@@ -32,243 +32,261 @@ extern "C" {
/*----------------------FEdgeSmooth methods ----------------------------*/
PyDoc_STRVAR(FEdgeSmooth_doc,
-"Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSmooth`\n"
-"\n"
-"Class defining a smooth edge. This kind of edge typically runs across\n"
-"a face of the input mesh. It can be a silhouette, a ridge or valley,\n"
-"a suggestive contour.\n"
-"\n"
-".. method:: __init__()\n"
-"\n"
-" Default constructor.\n"
-"\n"
-".. method:: __init__(brother)\n"
-"\n"
-" Copy constructor.\n"
-"\n"
-" :arg brother: An FEdgeSmooth object.\n"
-" :type brother: :class:`FEdgeSmooth`\n"
-"\n"
-".. method:: __init__(first_vertex, second_vertex)\n"
-"\n"
-" Builds an FEdgeSmooth going from the first to the second.\n"
-"\n"
-" :arg first_vertex: The first SVertex object.\n"
-" :type first_vertex: :class:`SVertex`\n"
-" :arg second_vertex: The second SVertex object.\n"
-" :type second_vertex: :class:`SVertex`");
+ "Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSmooth`\n"
+ "\n"
+ "Class defining a smooth edge. This kind of edge typically runs across\n"
+ "a face of the input mesh. It can be a silhouette, a ridge or valley,\n"
+ "a suggestive contour.\n"
+ "\n"
+ ".. method:: __init__()\n"
+ "\n"
+ " Default constructor.\n"
+ "\n"
+ ".. method:: __init__(brother)\n"
+ "\n"
+ " Copy constructor.\n"
+ "\n"
+ " :arg brother: An FEdgeSmooth object.\n"
+ " :type brother: :class:`FEdgeSmooth`\n"
+ "\n"
+ ".. method:: __init__(first_vertex, second_vertex)\n"
+ "\n"
+ " Builds an FEdgeSmooth going from the first to the second.\n"
+ "\n"
+ " :arg first_vertex: The first SVertex object.\n"
+ " :type first_vertex: :class:`SVertex`\n"
+ " :arg second_vertex: The second SVertex object.\n"
+ " :type second_vertex: :class:`SVertex`");
static int FEdgeSmooth_init(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist_1[] = {"brother", NULL};
- static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL};
- PyObject *obj1 = 0, *obj2 = 0;
-
- if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSmooth_Type, &obj1)) {
- if (!obj1)
- self->fes = new FEdgeSmooth();
- else
- self->fes = new FEdgeSmooth(*(((BPy_FEdgeSmooth *)obj1)->fes));
- }
- else if (PyErr_Clear(),
- PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist_2,
- &SVertex_Type, &obj1, &SVertex_Type, &obj2))
- {
- self->fes = new FEdgeSmooth(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
- return -1;
- }
- self->py_fe.fe = self->fes;
- self->py_fe.py_if1D.if1D = self->fes;
- self->py_fe.py_if1D.borrowed = false;
- return 0;
+ static const char *kwlist_1[] = {"brother", NULL};
+ static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL};
+ PyObject *obj1 = 0, *obj2 = 0;
+
+ if (PyArg_ParseTupleAndKeywords(
+ args, kwds, "|O!", (char **)kwlist_1, &FEdgeSmooth_Type, &obj1)) {
+ if (!obj1)
+ self->fes = new FEdgeSmooth();
+ else
+ self->fes = new FEdgeSmooth(*(((BPy_FEdgeSmooth *)obj1)->fes));
+ }
+ else if (PyErr_Clear(),
+ PyArg_ParseTupleAndKeywords(args,
+ kwds,
+ "O!O!",
+ (char **)kwlist_2,
+ &SVertex_Type,
+ &obj1,
+ &SVertex_Type,
+ &obj2)) {
+ self->fes = new FEdgeSmooth(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv);
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return -1;
+ }
+ self->py_fe.fe = self->fes;
+ self->py_fe.py_if1D.if1D = self->fes;
+ self->py_fe.py_if1D.borrowed = false;
+ return 0;
}
/*----------------------mathutils callbacks ----------------------------*/
static int FEdgeSmooth_mathutils_check(BaseMathObject *bmo)
{
- if (!BPy_FEdgeSmooth_Check(bmo->cb_user))
- return -1;
- return 0;
+ if (!BPy_FEdgeSmooth_Check(bmo->cb_user))
+ return -1;
+ return 0;
}
static int FEdgeSmooth_mathutils_get(BaseMathObject *bmo, int /*subtype*/)
{
- BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
- Vec3r p(self->fes->normal());
- bmo->data[0] = p[0];
- bmo->data[1] = p[1];
- bmo->data[2] = p[2];
- return 0;
+ BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
+ Vec3r p(self->fes->normal());
+ bmo->data[0] = p[0];
+ bmo->data[1] = p[1];
+ bmo->data[2] = p[2];
+ return 0;
}
static int FEdgeSmooth_mathutils_set(BaseMathObject *bmo, int /*subtype*/)
{
- BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
- Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
- self->fes->setNormal(p);
- return 0;
+ BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
+ Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
+ self->fes->setNormal(p);
+ return 0;
}
static int FEdgeSmooth_mathutils_get_index(BaseMathObject *bmo, int /*subtype*/, int index)
{
- BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
- Vec3r p(self->fes->normal());
- bmo->data[index] = p[index];
- return 0;
+ BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
+ Vec3r p(self->fes->normal());
+ bmo->data[index] = p[index];
+ return 0;
}
static int FEdgeSmooth_mathutils_set_index(BaseMathObject *bmo, int /*subtype*/, int index)
{
- BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
- Vec3r p(self->fes->normal());
- p[index] = bmo->data[index];
- self->fes->setNormal(p);
- return 0;
+ BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user;
+ Vec3r p(self->fes->normal());
+ p[index] = bmo->data[index];
+ self->fes->setNormal(p);
+ return 0;
}
static Mathutils_Callback FEdgeSmooth_mathutils_cb = {
- FEdgeSmooth_mathutils_check,
- FEdgeSmooth_mathutils_get,
- FEdgeSmooth_mathutils_set,
- FEdgeSmooth_mathutils_get_index,
- FEdgeSmooth_mathutils_set_index,
+ FEdgeSmooth_mathutils_check,
+ FEdgeSmooth_mathutils_get,
+ FEdgeSmooth_mathutils_set,
+ FEdgeSmooth_mathutils_get_index,
+ FEdgeSmooth_mathutils_set_index,
};
static unsigned char FEdgeSmooth_mathutils_cb_index = -1;
void FEdgeSmooth_mathutils_register_callback()
{
- FEdgeSmooth_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSmooth_mathutils_cb);
+ FEdgeSmooth_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSmooth_mathutils_cb);
}
/*----------------------FEdgeSmooth get/setters ----------------------------*/
PyDoc_STRVAR(FEdgeSmooth_normal_doc,
-"The normal of the face that this FEdge is running across.\n"
-"\n"
-":type: :class:`mathutils.Vector`");
+ "The normal of the face that this FEdge is running across.\n"
+ "\n"
+ ":type: :class:`mathutils.Vector`");
static PyObject *FEdgeSmooth_normal_get(BPy_FEdgeSmooth *self, void *UNUSED(closure))
{
- return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSmooth_mathutils_cb_index, 0);
+ return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSmooth_mathutils_cb_index, 0);
}
static int FEdgeSmooth_normal_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure))
{
- float v[3];
- if (mathutils_array_parse(v, 3, 3, value,
- "value must be a 3-dimensional vector") == -1)
- {
- return -1;
- }
- Vec3r p(v[0], v[1], v[2]);
- self->fes->setNormal(p);
- return 0;
+ float v[3];
+ if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) {
+ return -1;
+ }
+ Vec3r p(v[0], v[1], v[2]);
+ self->fes->setNormal(p);
+ return 0;
}
PyDoc_STRVAR(FEdgeSmooth_material_index_doc,
-"The index of the material of the face that this FEdge is running across.\n"
-"\n"
-":type: int");
+ "The index of the material of the face that this FEdge is running across.\n"
+ "\n"
+ ":type: int");
static PyObject *FEdgeSmooth_material_index_get(BPy_FEdgeSmooth *self, void *UNUSED(closure))
{
- return PyLong_FromLong(self->fes->frs_materialIndex());
+ return PyLong_FromLong(self->fes->frs_materialIndex());
}
-static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure))
+static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self,
+ PyObject *value,
+ void *UNUSED(closure))
{
- unsigned int i = PyLong_AsUnsignedLong(value);
- if (PyErr_Occurred())
- return -1;
- self->fes->setFrsMaterialIndex(i);
- return 0;
+ unsigned int i = PyLong_AsUnsignedLong(value);
+ if (PyErr_Occurred())
+ return -1;
+ self->fes->setFrsMaterialIndex(i);
+ return 0;
}
PyDoc_STRVAR(FEdgeSmooth_material_doc,
-"The material of the face that this FEdge is running across.\n"
-"\n"
-":type: :class:`Material`");
+ "The material of the face that this FEdge is running across.\n"
+ "\n"
+ ":type: :class:`Material`");
static PyObject *FEdgeSmooth_material_get(BPy_FEdgeSmooth *self, void *UNUSED(closure))
{
- return BPy_FrsMaterial_from_FrsMaterial(self->fes->frs_material());
+ return BPy_FrsMaterial_from_FrsMaterial(self->fes->frs_material());
}
PyDoc_STRVAR(FEdgeSmooth_face_mark_doc,
-"The face mark of the face that this FEdge is running across.\n"
-"\n"
-":type: bool");
+ "The face mark of the face that this FEdge is running across.\n"
+ "\n"
+ ":type: bool");
static PyObject *FEdgeSmooth_face_mark_get(BPy_FEdgeSmooth *self, void *UNUSED(closure))
{
- return PyBool_from_bool(self->fes->faceMark());
+ return PyBool_from_bool(self->fes->faceMark());
}
static int FEdgeSmooth_face_mark_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure))
{
- if (!PyBool_Check(value))
- return -1;
- self->fes->setFaceMark(bool_from_PyBool(value));
- return 0;
+ if (!PyBool_Check(value))
+ return -1;
+ self->fes->setFaceMark(bool_from_PyBool(value));
+ return 0;
}
static PyGetSetDef BPy_FEdgeSmooth_getseters[] = {
- {(char *)"normal", (getter)FEdgeSmooth_normal_get, (setter)FEdgeSmooth_normal_set,
- (char *)FEdgeSmooth_normal_doc, NULL},
- {(char *)"material_index", (getter)FEdgeSmooth_material_index_get, (setter)FEdgeSmooth_material_index_set,
- (char *)FEdgeSmooth_material_index_doc, NULL},
- {(char *)"material", (getter)FEdgeSmooth_material_get, (setter)NULL, (char *)FEdgeSmooth_material_doc, NULL},
- {(char *)"face_mark", (getter)FEdgeSmooth_face_mark_get, (setter)FEdgeSmooth_face_mark_set,
- (char *)FEdgeSmooth_face_mark_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"normal",
+ (getter)FEdgeSmooth_normal_get,
+ (setter)FEdgeSmooth_normal_set,
+ (char *)FEdgeSmooth_normal_doc,
+ NULL},
+ {(char *)"material_index",
+ (getter)FEdgeSmooth_material_index_get,
+ (setter)FEdgeSmooth_material_index_set,
+ (char *)FEdgeSmooth_material_index_doc,
+ NULL},
+ {(char *)"material",
+ (getter)FEdgeSmooth_material_get,
+ (setter)NULL,
+ (char *)FEdgeSmooth_material_doc,
+ NULL},
+ {(char *)"face_mark",
+ (getter)FEdgeSmooth_face_mark_get,
+ (setter)FEdgeSmooth_face_mark_set,
+ (char *)FEdgeSmooth_face_mark_doc,
+ NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------BPy_FEdgeSmooth type definition ------------------------------*/
PyTypeObject FEdgeSmooth_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "FEdgeSmooth", /* tp_name */
- sizeof(BPy_FEdgeSmooth), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- FEdgeSmooth_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- BPy_FEdgeSmooth_getseters, /* tp_getset */
- &FEdge_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)FEdgeSmooth_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(NULL, 0) "FEdgeSmooth", /* tp_name */
+ sizeof(BPy_FEdgeSmooth), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ FEdgeSmooth_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ BPy_FEdgeSmooth_getseters, /* tp_getset */
+ &FEdge_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)FEdgeSmooth_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h
index b460795228c..901741a76ff 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h
@@ -33,12 +33,13 @@ extern "C" {
extern PyTypeObject FEdgeSmooth_Type;
-#define BPy_FEdgeSmooth_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&FEdgeSmooth_Type))
+#define BPy_FEdgeSmooth_Check(v) \
+ (PyObject_IsInstance((PyObject *)v, (PyObject *)&FEdgeSmooth_Type))
/*---------------------------Python BPy_FEdgeSmooth structure definition----------*/
typedef struct {
- BPy_FEdge py_fe;
- FEdgeSmooth *fes;
+ BPy_FEdge py_fe;
+ FEdgeSmooth *fes;
} BPy_FEdgeSmooth;
/*---------------------------Python BPy_FEdgeSmooth visible prototypes-----------*/