9 #include "../../BPy_Convert.h"
10 #include "../../BPy_Freestyle.h"
11 #include "../../BPy_StrokeAttribute.h"
12 #include "../../Interface0D/BPy_SVertex.h"
26 "Class hierarchy: :class:`Interface0D` > :class:`CurvePoint` > :class:`StrokeVertex`\n"
28 "Class to define a stroke vertex.\n"
30 ".. method:: __init__()\n"
31 " __init__(brother)\n"
32 " __init__(first_vertex, second_vertex, t3d)\n"
34 " __init__(svertex)\n"
35 " __init__(svertex, attribute)\n"
37 " Builds a :class:`StrokeVertex` using the default constructor,\n"
38 " copy constructor, from 2 :class:`StrokeVertex` and an interpolation parameter,\n"
39 " from a CurvePoint, from a SVertex, or a :class:`SVertex`"
40 " and a :class:`StrokeAttribute` object.\n"
42 " :arg brother: A StrokeVertex object.\n"
43 " :type brother: :class:`StrokeVertex`\n"
44 " :arg first_vertex: The first StrokeVertex.\n"
45 " :type first_vertex: :class:`StrokeVertex`\n"
46 " :arg second_vertex: The second StrokeVertex.\n"
47 " :type second_vertex: :class:`StrokeVertex`\n"
48 " :arg t3d: An interpolation parameter.\n"
50 " :arg point: A CurvePoint object.\n"
51 " :type point: :class:`CurvePoint`\n"
52 " :arg svertex: An SVertex object.\n"
53 " :type svertex: :class:`SVertex`\n"
54 " :arg svertex: An SVertex object.\n"
55 " :type svertex: :class:`SVertex`\n"
56 " :arg attribute: A StrokeAttribute object.\n"
57 " :type attribute: :class:`StrokeAttribute`");
61 static const char *kwlist_1[] = {
"brother",
nullptr};
62 static const char *kwlist_2[] = {
"first_vertex",
"second_vertex",
"t3d",
nullptr};
63 static const char *kwlist_3[] = {
"point",
nullptr};
64 static const char *kwlist_4[] = {
"svertex",
"attribute",
nullptr};
65 PyObject *obj1 =
nullptr, *obj2 =
nullptr;
68 if (PyArg_ParseTupleAndKeywords(
75 PyErr_SetString(PyExc_TypeError,
"argument 1 is an invalid StrokeVertex object");
81 else if ((
void)PyErr_Clear(),
82 PyArg_ParseTupleAndKeywords(args,
93 if (!sv1 || (sv1->
A() ==
nullptr && sv1->
B() ==
nullptr)) {
94 PyErr_SetString(PyExc_TypeError,
"argument 1 is an invalid StrokeVertex object");
97 if (!sv2 || (sv2->
A() ==
nullptr && sv2->
B() ==
nullptr)) {
98 PyErr_SetString(PyExc_TypeError,
"argument 2 is an invalid StrokeVertex object");
103 else if ((
void)PyErr_Clear(),
104 PyArg_ParseTupleAndKeywords(
107 if (!cp || cp->
A() ==
nullptr || cp->
B() ==
nullptr) {
108 PyErr_SetString(PyExc_TypeError,
"argument 1 is an invalid CurvePoint object");
113 else if ((
void)PyErr_Clear(),
114 (
void)(obj2 =
nullptr),
115 PyArg_ParseTupleAndKeywords(args,
131 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
134 self->py_cp.cp =
self->sv;
135 self->py_cp.py_if0D.if0D =
self->sv;
136 self->py_cp.py_if0D.borrowed =
false;
156 bmo->data[0] = (
float)
self->sv->x();
165 self->sv->setY((
real)bmo->data[1]);
190 self->sv->setX((
real)bmo->data[0]);
193 self->sv->setY((
real)bmo->data[1]);
219 "StrokeAttribute for this StrokeVertex.\n"
221 ":type: :class:`StrokeAttribute`");
233 PyErr_SetString(PyExc_TypeError,
"value must be a StrokeAttribute object");
241 "Curvilinear abscissa of this StrokeVertex in the Stroke.\n"
248 return PyFloat_FromDouble(
self->sv->curvilinearAbscissa());
256 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
258 PyErr_SetString(PyExc_TypeError,
"value must be a number");
261 self->sv->setCurvilinearAbscissa(scalar);
266 "2D point coordinates.\n"
268 ":type: :class:`mathutils.Vector`");
281 self->sv->setX(
v[0]);
282 self->sv->setY(
v[1]);
287 "Stroke length (it is only a value retained by the StrokeVertex,\n"
288 "and it won't change the real stroke length).\n"
294 return PyFloat_FromDouble(
self->sv->strokeLength());
302 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
304 PyErr_SetString(PyExc_TypeError,
"value must be a number");
307 self->sv->setStrokeLength(scalar);
312 "Curvilinear abscissa of this StrokeVertex in the Stroke.\n"
318 return PyFloat_FromDouble(
self->sv->u());
325 StrokeVertex_attribute_doc,
327 {
"curvilinear_abscissa",
330 StrokeVertex_curvilinear_abscissa_doc,
335 StrokeVertex_point_doc,
340 StrokeVertex_stroke_length_doc,
343 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
348 PyVarObject_HEAD_INIT(
nullptr, 0)
"StrokeVertex",
366 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
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int vec_num, uchar cb_type, uchar cb_subtype)