23 #include "../../BPy_Convert.h"
24 #include "../../BPy_Freestyle.h"
25 #include "../../BPy_StrokeAttribute.h"
26 #include "../../Interface0D/BPy_SVertex.h"
40 "Class hierarchy: :class:`Interface0D` > :class:`CurvePoint` > :class:`StrokeVertex`\n"
42 "Class to define a stroke vertex.\n"
44 ".. method:: __init__()\n"
45 " __init__(brother)\n"
46 " __init__(first_vertex, second_vertex, t3d)\n"
48 " __init__(svertex)\n"
49 " __init__(svertex, attribute)\n"
51 " Builds a :class:`StrokeVertex` using the default constructor,\n"
52 " copy constructor, from 2 :class:`StrokeVertex` and an interpolation parameter,\n"
53 " from a CurvePoint, from a SVertex, or a :class:`SVertex`"
54 " and a :class:`StrokeAttribute` object.\n"
56 " :arg brother: A StrokeVertex object.\n"
57 " :type brother: :class:`StrokeVertex`\n"
58 " :arg first_vertex: The first StrokeVertex.\n"
59 " :type first_vertex: :class:`StrokeVertex`\n"
60 " :arg second_vertex: The second StrokeVertex.\n"
61 " :type second_vertex: :class:`StrokeVertex`\n"
62 " :arg t3d: An interpolation parameter.\n"
64 " :arg point: A CurvePoint object.\n"
65 " :type point: :class:`CurvePoint`\n"
66 " :arg svertex: An SVertex object.\n"
67 " :type svertex: :class:`SVertex`\n"
68 " :arg svertex: An SVertex object.\n"
69 " :type svertex: :class:`SVertex`\n"
70 " :arg attribute: A StrokeAttribute object.\n"
71 " :type attribute: :class:`StrokeAttribute`");
75 static const char *kwlist_1[] = {
"brother",
nullptr};
76 static const char *kwlist_2[] = {
"first_vertex",
"second_vertex",
"t3d",
nullptr};
77 static const char *kwlist_3[] = {
"point",
nullptr};
78 static const char *kwlist_4[] = {
"svertex",
"attribute",
nullptr};
79 PyObject *obj1 =
nullptr, *obj2 =
nullptr;
82 if (PyArg_ParseTupleAndKeywords(
89 PyErr_SetString(PyExc_TypeError,
"argument 1 is an invalid StrokeVertex object");
95 else if ((
void)PyErr_Clear(),
96 PyArg_ParseTupleAndKeywords(args,
107 if (!sv1 || (sv1->
A() ==
nullptr && sv1->
B() ==
nullptr)) {
108 PyErr_SetString(PyExc_TypeError,
"argument 1 is an invalid StrokeVertex object");
111 if (!sv2 || (sv2->
A() ==
nullptr && sv2->
B() ==
nullptr)) {
112 PyErr_SetString(PyExc_TypeError,
"argument 2 is an invalid StrokeVertex object");
117 else if ((
void)PyErr_Clear(),
118 PyArg_ParseTupleAndKeywords(
121 if (!cp || cp->
A() ==
nullptr || cp->
B() ==
nullptr) {
122 PyErr_SetString(PyExc_TypeError,
"argument 1 is an invalid CurvePoint object");
127 else if ((
void)PyErr_Clear(),
128 (
void)(obj2 =
nullptr),
129 PyArg_ParseTupleAndKeywords(args,
145 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
148 self->py_cp.cp =
self->sv;
149 self->py_cp.py_if0D.if0D =
self->sv;
150 self->py_cp.py_if0D.borrowed =
false;
170 bmo->data[0] = (
float)
self->sv->x();
179 self->sv->setY((
real)bmo->data[1]);
204 self->sv->setX((
real)bmo->data[0]);
207 self->sv->setY((
real)bmo->data[1]);
233 "StrokeAttribute for this StrokeVertex.\n"
235 ":type: :class:`StrokeAttribute`");
247 PyErr_SetString(PyExc_TypeError,
"value must be a StrokeAttribute object");
255 "Curvilinear abscissa of this StrokeVertex in the Stroke.\n"
262 return PyFloat_FromDouble(
self->sv->curvilinearAbscissa());
270 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
272 PyErr_SetString(PyExc_TypeError,
"value must be a number");
275 self->sv->setCurvilinearAbscissa(scalar);
280 "2D point coordinates.\n"
282 ":type: :class:`mathutils.Vector`");
295 self->sv->setX(
v[0]);
296 self->sv->setY(
v[1]);
301 "Stroke length (it is only a value retained by the StrokeVertex,\n"
302 "and it won't change the real stroke length).\n"
308 return PyFloat_FromDouble(
self->sv->strokeLength());
316 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
318 PyErr_SetString(PyExc_TypeError,
"value must be a number");
321 self->sv->setStrokeLength(scalar);
326 "Curvilinear abscissa of this StrokeVertex in the Stroke.\n"
332 return PyFloat_FromDouble(
self->sv->u());
339 StrokeVertex_attribute_doc,
341 {
"curvilinear_abscissa",
344 StrokeVertex_curvilinear_abscissa_doc,
349 StrokeVertex_point_doc,
354 StrokeVertex_stroke_length_doc,
357 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
362 PyVarObject_HEAD_INIT(
nullptr, 0)
"StrokeVertex",
380 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
typedef float(TangentPoint)[2]
PyObject * BPy_StrokeAttribute_from_StrokeAttribute(StrokeAttribute &sa)
PyTypeObject CurvePoint_Type
PyTypeObject SVertex_Type
PyTypeObject StrokeAttribute_Type
#define BPy_StrokeAttribute_Check(v)
static int StrokeVertex_point_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure))
static PyGetSetDef BPy_StrokeVertex_getseters[]
static PyObject * StrokeVertex_attribute_get(BPy_StrokeVertex *self, void *UNUSED(closure))
static Mathutils_Callback StrokeVertex_mathutils_cb
static int StrokeVertex_mathutils_check(BaseMathObject *bmo)
static int StrokeVertex_stroke_length_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure))
static PyObject * StrokeVertex_u_get(BPy_StrokeVertex *self, void *UNUSED(closure))
static int StrokeVertex_mathutils_get(BaseMathObject *bmo, int)
static int StrokeVertex_mathutils_set_index(BaseMathObject *bmo, int, int index)
static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeVertex_curvilinear_abscissa_get(BPy_StrokeVertex *self, void *UNUSED(closure))
static int StrokeVertex_attribute_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure))
static int StrokeVertex_mathutils_get_index(BaseMathObject *bmo, int, int index)
static int StrokeVertex_mathutils_set(BaseMathObject *bmo, int)
void StrokeVertex_mathutils_register_callback()
static PyObject * StrokeVertex_stroke_length_get(BPy_StrokeVertex *self, void *UNUSED(closure))
static int StrokeVertex_curvilinear_abscissa_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure))
PyTypeObject StrokeVertex_Type
PyDoc_STRVAR(StrokeVertex_doc, "Class hierarchy: :class:`Interface0D` > :class:`CurvePoint` > :class:`StrokeVertex`\n" "\n" "Class to define a stroke vertex.\n" "\n" ".. method:: __init__()\n" " __init__(brother)\n" " __init__(first_vertex, second_vertex, t3d)\n" " __init__(point)\n" " __init__(svertex)\n" " __init__(svertex, attribute)\n" "\n" " Builds a :class:`StrokeVertex` using the default constructor,\n" " copy constructor, from 2 :class:`StrokeVertex` and an interpolation parameter,\n" " from a CurvePoint, from a SVertex, or a :class:`SVertex`" " and a :class:`StrokeAttribute` object.\n" "\n" " :arg brother: A StrokeVertex object.\n" " :type brother: :class:`StrokeVertex`\n" " :arg first_vertex: The first StrokeVertex.\n" " :type first_vertex: :class:`StrokeVertex`\n" " :arg second_vertex: The second StrokeVertex.\n" " :type second_vertex: :class:`StrokeVertex`\n" " :arg t3d: An interpolation parameter.\n" " :type t3d: float\n" " :arg point: A CurvePoint object.\n" " :type point: :class:`CurvePoint`\n" " :arg svertex: An SVertex object.\n" " :type svertex: :class:`SVertex`\n" " :arg svertex: An SVertex object.\n" " :type svertex: :class:`SVertex`\n" " :arg attribute: A StrokeAttribute object.\n" " :type attribute: :class:`StrokeAttribute`")
static unsigned char StrokeVertex_mathutils_cb_index
static PyObject * StrokeVertex_point_get(BPy_StrokeVertex *self, void *UNUSED(closure))
#define BPy_StrokeVertex_Check(v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int size, uchar cb_type, uchar cb_subtype)