2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2004-2023 Blender Authors
|
2023-06-14 23:30:43 +10:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2013-02-23 18:32:28 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup freestyle
|
2013-02-23 18:32:28 +00:00
|
|
|
*/
|
|
|
|
|
|
2008-07-23 07:56:08 +00:00
|
|
|
#include "BPy_StrokeAttribute.h"
|
2008-07-21 21:24:37 +00:00
|
|
|
|
2008-07-23 07:56:08 +00:00
|
|
|
#include "BPy_Convert.h"
|
2008-07-21 21:24:37 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-02-08 17:28:15 +02:00
|
|
|
using namespace Freestyle;
|
|
|
|
|
|
2008-07-21 21:24:37 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
//-------------------MODULE INITIALIZATION--------------------------------
|
2013-02-21 02:57:44 +00:00
|
|
|
int StrokeAttribute_Init(PyObject *module)
|
2008-07-21 21:24:37 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
if (module == nullptr) {
|
2009-09-27 00:32:20 +00:00
|
|
|
return -1;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2008-07-21 21:24:37 +00:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (PyType_Ready(&StrokeAttribute_Type) < 0) {
|
2009-09-27 00:32:20 +00:00
|
|
|
return -1;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
Py_INCREF(&StrokeAttribute_Type);
|
2008-07-21 21:24:37 +00:00
|
|
|
PyModule_AddObject(module, "StrokeAttribute", (PyObject *)&StrokeAttribute_Type);
|
2013-01-27 20:17:49 +00:00
|
|
|
|
|
|
|
|
StrokeAttribute_mathutils_register_callback();
|
2009-09-27 00:32:20 +00:00
|
|
|
return 0;
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-21 21:24:37 +00:00
|
|
|
//------------------------INSTANCE METHODS ----------------------------------
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_doc,
|
2010-04-17 23:47:47 +00:00
|
|
|
"Class to define a set of attributes associated with a :class:`StrokeVertex`.\n"
|
|
|
|
|
"The attribute set stores the color, alpha and thickness values for a Stroke\n"
|
|
|
|
|
"Vertex.\n"
|
|
|
|
|
"\n"
|
|
|
|
|
".. method:: __init__()\n"
|
2020-10-22 17:20:57 -04:00
|
|
|
" __init__(brother)\n"
|
|
|
|
|
" __init__(red, green, blue, alpha, thickness_right, thickness_left)\n"
|
|
|
|
|
" __init__(attribute1, attribute2, t)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
2020-10-22 17:20:57 -04:00
|
|
|
" Creates a :class:`StrokeAttribute` object using either a default constructor,\n"
|
|
|
|
|
" copy constructor, overloaded constructor, or and interpolation constructor\n"
|
|
|
|
|
" to interpolate between two :class:`StrokeAttribute` objects.\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
2020-10-22 17:20:57 -04:00
|
|
|
" :arg brother: A StrokeAttribute object to be used as a copy constructor.\n"
|
2013-02-21 02:57:44 +00:00
|
|
|
" :type brother: :class:`StrokeAttribute`\n"
|
|
|
|
|
" :arg red: Red component of a stroke color.\n"
|
|
|
|
|
" :type red: float\n"
|
|
|
|
|
" :arg green: Green component of a stroke color.\n"
|
|
|
|
|
" :type green: float\n"
|
|
|
|
|
" :arg blue: Blue component of a stroke color.\n"
|
|
|
|
|
" :type blue: float\n"
|
|
|
|
|
" :arg alpha: Alpha component of a stroke color.\n"
|
|
|
|
|
" :type alpha: float\n"
|
|
|
|
|
" :arg thickness_right: Stroke thickness on the right.\n"
|
|
|
|
|
" :type thickness_right: float\n"
|
|
|
|
|
" :arg thickness_left: Stroke thickness on the left.\n"
|
|
|
|
|
" :type thickness_left: float\n"
|
|
|
|
|
" :arg attribute1: The first StrokeAttribute object.\n"
|
|
|
|
|
" :type attribute1: :class:`StrokeAttribute`\n"
|
|
|
|
|
" :arg attribute2: The second StrokeAttribute object.\n"
|
|
|
|
|
" :type attribute2: :class:`StrokeAttribute`\n"
|
|
|
|
|
" :arg t: The interpolation parameter (0 <= t <= 1).\n"
|
2013-01-27 21:51:25 +00:00
|
|
|
" :type t: float\n");
|
2010-04-17 23:47:47 +00:00
|
|
|
|
2013-02-21 02:57:44 +00:00
|
|
|
static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
|
2008-07-21 21:24:37 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist_1[] = {"brother", nullptr};
|
|
|
|
|
static const char *kwlist_2[] = {"attribute1", "attribute2", "t", nullptr};
|
2013-02-21 02:57:44 +00:00
|
|
|
static const char *kwlist_3[] = {
|
2020-11-06 17:49:09 +01:00
|
|
|
"red", "green", "blue", "alpha", "thickness_right", "thickness_left", nullptr};
|
|
|
|
|
PyObject *obj1 = nullptr, *obj2 = nullptr;
|
2013-02-21 02:57:44 +00:00
|
|
|
float red, green, blue, alpha, thickness_right, thickness_left, t;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-21 02:57:44 +00:00
|
|
|
if (PyArg_ParseTupleAndKeywords(
|
|
|
|
|
args, kwds, "|O!", (char **)kwlist_1, &StrokeAttribute_Type, &obj1))
|
|
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!obj1) {
|
2013-02-21 02:57:44 +00:00
|
|
|
self->sa = new StrokeAttribute();
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2013-02-21 02:57:44 +00:00
|
|
|
self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa));
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
}
|
2020-07-29 10:53:00 +10:00
|
|
|
else if ((void)PyErr_Clear(),
|
2013-02-21 02:57:44 +00:00
|
|
|
PyArg_ParseTupleAndKeywords(args,
|
|
|
|
|
kwds,
|
|
|
|
|
"O!O!f",
|
|
|
|
|
(char **)kwlist_2,
|
|
|
|
|
&StrokeAttribute_Type,
|
|
|
|
|
&obj1,
|
|
|
|
|
&StrokeAttribute_Type,
|
|
|
|
|
&obj2,
|
|
|
|
|
&t))
|
|
|
|
|
{
|
|
|
|
|
self->sa = new StrokeAttribute(
|
|
|
|
|
*(((BPy_StrokeAttribute *)obj1)->sa), *(((BPy_StrokeAttribute *)obj2)->sa), t);
|
|
|
|
|
}
|
2020-07-29 10:53:00 +10:00
|
|
|
else if ((void)PyErr_Clear(),
|
2013-02-21 02:57:44 +00:00
|
|
|
PyArg_ParseTupleAndKeywords(args,
|
|
|
|
|
kwds,
|
|
|
|
|
"ffffff",
|
|
|
|
|
(char **)kwlist_3,
|
|
|
|
|
&red,
|
|
|
|
|
&green,
|
|
|
|
|
&blue,
|
|
|
|
|
&alpha,
|
|
|
|
|
&thickness_right,
|
|
|
|
|
&thickness_left))
|
|
|
|
|
{
|
|
|
|
|
self->sa = new StrokeAttribute(red, green, blue, alpha, thickness_right, thickness_left);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
|
2008-07-21 21:24:37 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2014-06-24 22:44:53 +09:00
|
|
|
self->borrowed = false;
|
2008-07-21 21:24:37 +00:00
|
|
|
return 0;
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-07 23:17:23 +00:00
|
|
|
static void StrokeAttribute_dealloc(BPy_StrokeAttribute *self)
|
2008-07-21 21:24:37 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (self->sa && !self->borrowed) {
|
2008-08-02 07:39:49 +00:00
|
|
|
delete self->sa;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-03-07 23:17:23 +00:00
|
|
|
Py_TYPE(self)->tp_free((PyObject *)self);
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2018-10-11 08:49:28 +11:00
|
|
|
static PyObject *StrokeAttribute_repr(BPy_StrokeAttribute *self)
|
2008-07-21 21:24:37 +00:00
|
|
|
{
|
2008-07-22 00:27:40 +00:00
|
|
|
stringstream repr("StrokeAttribute:");
|
2013-03-07 23:17:23 +00:00
|
|
|
repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG()
|
|
|
|
|
<< " b: " << self->sa->getColorB() << " a: " << self->sa->getAlpha()
|
|
|
|
|
<< " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL();
|
2008-07-22 00:27:40 +00:00
|
|
|
|
2013-02-21 02:57:44 +00:00
|
|
|
return PyUnicode_FromString(repr.str().c_str());
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_get_attribute_real_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: get_attribute_real(name)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
|
|
|
|
" Returns an attribute of float type.\n"
|
|
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
" :return: The attribute value.\n"
|
2013-01-27 21:51:25 +00:00
|
|
|
" :rtype: float\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-24 02:39:38 +00:00
|
|
|
static PyObject *StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", nullptr};
|
2008-07-21 21:24:37 +00:00
|
|
|
char *attr;
|
2008-07-09 08:24:13 +00:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
double a = self->sa->getAttributeReal(attr);
|
|
|
|
|
return PyFloat_FromDouble(a);
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_get_attribute_vec2_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: get_attribute_vec2(name)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
|
|
|
|
" Returns an attribute of two-dimensional vector type.\n"
|
|
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
" :return: The attribute value.\n"
|
2013-01-27 21:51:25 +00:00
|
|
|
" :rtype: :class:`mathutils.Vector`\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-24 02:39:38 +00:00
|
|
|
static PyObject *StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", nullptr};
|
2008-07-21 21:24:37 +00:00
|
|
|
char *attr;
|
2008-07-09 08:24:13 +00:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
Vec2f a = self->sa->getAttributeVec2f(attr);
|
|
|
|
|
return Vector_from_Vec2f(a);
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_get_attribute_vec3_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: get_attribute_vec3(name)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
|
|
|
|
" Returns an attribute of three-dimensional vector type.\n"
|
|
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
" :return: The attribute value.\n"
|
2013-01-27 21:51:25 +00:00
|
|
|
" :rtype: :class:`mathutils.Vector`\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-24 02:39:38 +00:00
|
|
|
static PyObject *StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", nullptr};
|
2008-07-21 21:24:37 +00:00
|
|
|
char *attr;
|
2008-07-09 08:24:13 +00:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
Vec3f a = self->sa->getAttributeVec3f(attr);
|
|
|
|
|
return Vector_from_Vec3f(a);
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_has_attribute_real_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: has_attribute_real(name)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" Checks whether the attribute name of float type is available.\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
2019-08-01 13:53:25 +10:00
|
|
|
" :return: True if the attribute is available.\n"
|
2013-01-27 21:51:25 +00:00
|
|
|
" :rtype: bool\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-24 02:39:38 +00:00
|
|
|
static PyObject *StrokeAttribute_has_attribute_real(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", nullptr};
|
2008-07-21 21:24:37 +00:00
|
|
|
char *attr;
|
|
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr));
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_has_attribute_vec2_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: has_attribute_vec2(name)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" Checks whether the attribute name of two-dimensional vector type\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
" is available.\n"
|
|
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
2019-08-01 13:53:25 +10:00
|
|
|
" :return: True if the attribute is available.\n"
|
2013-01-27 21:51:25 +00:00
|
|
|
" :rtype: bool\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-24 02:39:38 +00:00
|
|
|
static PyObject *StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", nullptr};
|
2008-07-21 21:24:37 +00:00
|
|
|
char *attr;
|
2008-07-09 08:24:13 +00:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr));
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_has_attribute_vec3_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: has_attribute_vec3(name)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" Checks whether the attribute name of three-dimensional vector\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
" type is available.\n"
|
|
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
2019-08-01 13:53:25 +10:00
|
|
|
" :return: True if the attribute is available.\n"
|
2013-01-27 21:51:25 +00:00
|
|
|
" :rtype: bool\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-24 02:39:38 +00:00
|
|
|
static PyObject *StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", nullptr};
|
2008-07-21 21:24:37 +00:00
|
|
|
char *attr;
|
|
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr));
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_set_attribute_real_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: set_attribute_real(name, value)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
2023-07-13 13:40:25 +10:00
|
|
|
" Adds a user-defined attribute of float type. If there is no\n"
|
|
|
|
|
" attribute of the given name, it is added. Otherwise, the new value\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
" replaces the old one.\n"
|
|
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
|
|
|
|
" :arg value: The attribute value.\n"
|
|
|
|
|
" :type value: float\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-10-11 08:49:28 +11:00
|
|
|
static PyObject *StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", "value", nullptr};
|
|
|
|
|
char *s = nullptr;
|
2008-07-21 21:24:37 +00:00
|
|
|
double d = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-21 02:57:44 +00:00
|
|
|
self->sa->setAttributeReal(s, d);
|
2008-07-22 00:27:40 +00:00
|
|
|
Py_RETURN_NONE;
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_set_attribute_vec2_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: set_attribute_vec2(name, value)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
2023-07-13 13:40:25 +10:00
|
|
|
" Adds a user-defined attribute of two-dimensional vector type. If\n"
|
|
|
|
|
" there is no attribute of the given name, it is added. Otherwise,\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
" the new value replaces the old one.\n"
|
|
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
|
|
|
|
" :arg value: The attribute value.\n"
|
|
|
|
|
" :type value: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-10-11 08:49:28 +11:00
|
|
|
static PyObject *StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", "value", nullptr};
|
2008-07-21 21:24:37 +00:00
|
|
|
char *s;
|
2020-11-06 17:49:09 +01:00
|
|
|
PyObject *obj = nullptr;
|
2013-11-05 00:51:59 +00:00
|
|
|
Vec2f vec;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-12-17 18:01:15 +11:00
|
|
|
if (!Vec2f_ptr_from_PyObject(obj, vec)) {
|
2009-07-25 11:27:18 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2008-07-21 21:24:37 +00:00
|
|
|
}
|
2013-11-05 00:51:59 +00:00
|
|
|
self->sa->setAttributeVec2f(s, vec);
|
2008-07-22 00:27:40 +00:00
|
|
|
Py_RETURN_NONE;
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-27 21:51:25 +00:00
|
|
|
PyDoc_STRVAR(StrokeAttribute_set_attribute_vec3_doc,
|
2013-02-24 02:39:38 +00:00
|
|
|
".. method:: set_attribute_vec3(name, value)\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
|
|
|
|
" Adds a user-defined attribute of three-dimensional vector type.\n"
|
|
|
|
|
" If there is no attribute of the given name, it is added.\n"
|
|
|
|
|
" Otherwise, the new value replaces the old one.\n"
|
|
|
|
|
"\n"
|
2013-02-24 02:39:38 +00:00
|
|
|
" :arg name: The name of the attribute.\n"
|
|
|
|
|
" :type name: str\n"
|
|
|
|
|
" :arg value: The attribute value.\n"
|
|
|
|
|
" :type value: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-10-11 08:49:28 +11:00
|
|
|
static PyObject *StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *args,
|
|
|
|
|
PyObject *kwds)
|
2013-02-21 02:57:44 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
static const char *kwlist[] = {"name", "value", nullptr};
|
2008-07-21 21:24:37 +00:00
|
|
|
char *s;
|
2020-11-06 17:49:09 +01:00
|
|
|
PyObject *obj = nullptr;
|
2013-11-05 00:51:59 +00:00
|
|
|
Vec3f vec;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-12-17 18:01:15 +11:00
|
|
|
if (!Vec3f_ptr_from_PyObject(obj, vec)) {
|
2009-07-25 11:27:18 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2008-07-21 21:24:37 +00:00
|
|
|
}
|
2013-11-05 00:51:59 +00:00
|
|
|
self->sa->setAttributeVec3f(s, vec);
|
2008-07-22 00:27:40 +00:00
|
|
|
Py_RETURN_NONE;
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
2010-04-17 23:47:47 +00:00
|
|
|
static PyMethodDef BPy_StrokeAttribute_methods[] = {
|
2013-03-07 23:17:23 +00:00
|
|
|
{"get_attribute_real",
|
|
|
|
|
(PyCFunction)StrokeAttribute_get_attribute_real,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_get_attribute_real_doc},
|
|
|
|
|
{"get_attribute_vec2",
|
|
|
|
|
(PyCFunction)StrokeAttribute_get_attribute_vec2,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_get_attribute_vec2_doc},
|
|
|
|
|
{"get_attribute_vec3",
|
|
|
|
|
(PyCFunction)StrokeAttribute_get_attribute_vec3,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_get_attribute_vec3_doc},
|
|
|
|
|
{"has_attribute_real",
|
|
|
|
|
(PyCFunction)StrokeAttribute_has_attribute_real,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_has_attribute_real_doc},
|
|
|
|
|
{"has_attribute_vec2",
|
|
|
|
|
(PyCFunction)StrokeAttribute_has_attribute_vec2,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_has_attribute_vec2_doc},
|
|
|
|
|
{"has_attribute_vec3",
|
|
|
|
|
(PyCFunction)StrokeAttribute_has_attribute_vec3,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_has_attribute_vec3_doc},
|
|
|
|
|
{"set_attribute_real",
|
|
|
|
|
(PyCFunction)StrokeAttribute_set_attribute_real,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_set_attribute_real_doc},
|
|
|
|
|
{"set_attribute_vec2",
|
|
|
|
|
(PyCFunction)StrokeAttribute_set_attribute_vec2,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_set_attribute_vec2_doc},
|
|
|
|
|
{"set_attribute_vec3",
|
|
|
|
|
(PyCFunction)StrokeAttribute_set_attribute_vec3,
|
|
|
|
|
METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
StrokeAttribute_set_attribute_vec3_doc},
|
2020-11-06 17:49:09 +01:00
|
|
|
{nullptr, nullptr, 0, nullptr},
|
2010-04-17 23:47:47 +00:00
|
|
|
};
|
|
|
|
|
|
2013-01-27 20:17:49 +00:00
|
|
|
/*----------------------mathutils callbacks ----------------------------*/
|
|
|
|
|
|
|
|
|
|
/* subtype */
|
|
|
|
|
#define MATHUTILS_SUBTYPE_COLOR 1
|
|
|
|
|
#define MATHUTILS_SUBTYPE_THICKNESS 2
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_mathutils_check(BaseMathObject *bmo)
|
|
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (!BPy_StrokeAttribute_Check(bmo->cb_user)) {
|
2013-01-27 20:17:49 +00:00
|
|
|
return -1;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-01-27 20:17:49 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_mathutils_get(BaseMathObject *bmo, int subtype)
|
|
|
|
|
{
|
|
|
|
|
BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
|
|
|
|
|
switch (subtype) {
|
2018-08-30 01:31:20 +10:00
|
|
|
case MATHUTILS_SUBTYPE_COLOR:
|
|
|
|
|
bmo->data[0] = self->sa->getColorR();
|
|
|
|
|
bmo->data[1] = self->sa->getColorG();
|
|
|
|
|
bmo->data[2] = self->sa->getColorB();
|
|
|
|
|
break;
|
|
|
|
|
case MATHUTILS_SUBTYPE_THICKNESS:
|
|
|
|
|
bmo->data[0] = self->sa->getThicknessR();
|
|
|
|
|
bmo->data[1] = self->sa->getThicknessL();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return -1;
|
2013-01-27 20:17:49 +00:00
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_mathutils_set(BaseMathObject *bmo, int subtype)
|
|
|
|
|
{
|
|
|
|
|
BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
|
|
|
|
|
switch (subtype) {
|
2018-08-30 01:31:20 +10:00
|
|
|
case MATHUTILS_SUBTYPE_COLOR:
|
|
|
|
|
self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]);
|
|
|
|
|
break;
|
|
|
|
|
case MATHUTILS_SUBTYPE_THICKNESS:
|
|
|
|
|
self->sa->setThickness(bmo->data[0], bmo->data[1]);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return -1;
|
2013-01-27 20:17:49 +00:00
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
|
|
|
|
|
{
|
|
|
|
|
BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
|
|
|
|
|
switch (subtype) {
|
2018-08-30 01:31:20 +10:00
|
|
|
case MATHUTILS_SUBTYPE_COLOR:
|
|
|
|
|
switch (index) {
|
|
|
|
|
case 0:
|
|
|
|
|
bmo->data[0] = self->sa->getColorR();
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
bmo->data[1] = self->sa->getColorG();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
bmo->data[2] = self->sa->getColorB();
|
2019-04-17 06:17:24 +02:00
|
|
|
break;
|
2018-08-30 01:31:20 +10:00
|
|
|
default:
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case MATHUTILS_SUBTYPE_THICKNESS:
|
|
|
|
|
switch (index) {
|
|
|
|
|
case 0:
|
|
|
|
|
bmo->data[0] = self->sa->getThicknessR();
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
bmo->data[1] = self->sa->getThicknessL();
|
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
default:
|
2013-01-27 20:17:49 +00:00
|
|
|
return -1;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
break;
|
2013-01-27 20:17:49 +00:00
|
|
|
default:
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
|
|
|
|
|
{
|
|
|
|
|
BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
|
|
|
|
|
switch (subtype) {
|
2018-08-30 01:31:20 +10:00
|
|
|
case MATHUTILS_SUBTYPE_COLOR: {
|
|
|
|
|
float r = (index == 0) ? bmo->data[0] : self->sa->getColorR();
|
|
|
|
|
float g = (index == 1) ? bmo->data[1] : self->sa->getColorG();
|
|
|
|
|
float b = (index == 2) ? bmo->data[2] : self->sa->getColorB();
|
|
|
|
|
self->sa->setColor(r, g, b);
|
|
|
|
|
} break;
|
|
|
|
|
case MATHUTILS_SUBTYPE_THICKNESS: {
|
|
|
|
|
float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR();
|
|
|
|
|
float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL();
|
|
|
|
|
self->sa->setThickness(tr, tl);
|
|
|
|
|
} break;
|
|
|
|
|
default:
|
|
|
|
|
return -1;
|
2013-01-27 20:17:49 +00:00
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Mathutils_Callback StrokeAttribute_mathutils_cb = {
|
|
|
|
|
StrokeAttribute_mathutils_check,
|
|
|
|
|
StrokeAttribute_mathutils_get,
|
|
|
|
|
StrokeAttribute_mathutils_set,
|
|
|
|
|
StrokeAttribute_mathutils_get_index,
|
2019-02-03 14:01:45 +11:00
|
|
|
StrokeAttribute_mathutils_set_index,
|
2013-01-27 20:17:49 +00:00
|
|
|
};
|
|
|
|
|
|
2022-09-25 17:04:52 +10:00
|
|
|
static uchar StrokeAttribute_mathutils_cb_index = -1;
|
2013-01-27 20:17:49 +00:00
|
|
|
|
|
|
|
|
void StrokeAttribute_mathutils_register_callback()
|
|
|
|
|
{
|
|
|
|
|
StrokeAttribute_mathutils_cb_index = Mathutils_RegisterCallback(&StrokeAttribute_mathutils_cb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*----------------------StrokeAttribute get/setters ----------------------------*/
|
|
|
|
|
|
|
|
|
|
PyDoc_STRVAR(StrokeAttribute_alpha_doc,
|
|
|
|
|
"Alpha component of the stroke color.\n"
|
|
|
|
|
"\n"
|
2013-02-03 23:04:42 +00:00
|
|
|
":type: float");
|
2013-01-27 20:17:49 +00:00
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void * /*closure*/)
|
2013-01-27 20:17:49 +00:00
|
|
|
{
|
|
|
|
|
return PyFloat_FromDouble(self->sa->getAlpha());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_alpha_set(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *value,
|
2022-10-03 17:37:25 -05:00
|
|
|
void * /*closure*/)
|
2013-01-27 20:17:49 +00:00
|
|
|
{
|
|
|
|
|
float scalar;
|
2019-07-10 14:41:19 +10:00
|
|
|
if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
|
|
|
|
|
/* parsed item not a number */
|
2013-01-27 20:17:49 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError, "value must be a number");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
self->sa->setAlpha(scalar);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyDoc_STRVAR(StrokeAttribute_color_doc,
|
|
|
|
|
"RGB components of the stroke color.\n"
|
|
|
|
|
"\n"
|
2014-09-19 13:22:20 +09:00
|
|
|
":type: :class:`mathutils.Color`");
|
2013-01-27 20:17:49 +00:00
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void * /*closure*/)
|
2013-01-27 20:17:49 +00:00
|
|
|
{
|
|
|
|
|
return Color_CreatePyObject_cb(
|
|
|
|
|
(PyObject *)self, StrokeAttribute_mathutils_cb_index, MATHUTILS_SUBTYPE_COLOR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_color_set(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *value,
|
2022-10-03 17:37:25 -05:00
|
|
|
void * /*closure*/)
|
2013-01-27 20:17:49 +00:00
|
|
|
{
|
2013-05-14 22:51:11 +00:00
|
|
|
float v[3];
|
2014-06-24 22:48:15 +09:00
|
|
|
if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) {
|
2013-01-27 20:17:49 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2013-05-14 22:51:11 +00:00
|
|
|
self->sa->setColor(v[0], v[1], v[2]);
|
2013-01-27 20:17:49 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyDoc_STRVAR(StrokeAttribute_thickness_doc,
|
|
|
|
|
"Right and left components of the stroke thickness.\n"
|
|
|
|
|
"The right (left) component is the thickness on the right (left) of the vertex\n"
|
|
|
|
|
"when following the stroke.\n"
|
|
|
|
|
"\n"
|
2014-09-19 13:22:20 +09:00
|
|
|
":type: :class:`mathutils.Vector`");
|
2013-01-27 20:17:49 +00:00
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void * /*closure*/)
|
2013-01-27 20:17:49 +00:00
|
|
|
{
|
2013-03-07 23:17:23 +00:00
|
|
|
return Vector_CreatePyObject_cb(
|
|
|
|
|
(PyObject *)self, 2, StrokeAttribute_mathutils_cb_index, MATHUTILS_SUBTYPE_THICKNESS);
|
2013-01-27 20:17:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *value,
|
2022-10-03 17:37:25 -05:00
|
|
|
void * /*closure*/)
|
2013-01-27 20:17:49 +00:00
|
|
|
{
|
2013-05-14 22:51:11 +00:00
|
|
|
float v[2];
|
2014-06-24 22:48:15 +09:00
|
|
|
if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) {
|
2013-01-27 20:17:49 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2013-05-14 22:51:11 +00:00
|
|
|
self->sa->setThickness(v[0], v[1]);
|
2013-01-27 20:17:49 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyDoc_STRVAR(StrokeAttribute_visible_doc,
|
2023-07-13 13:40:25 +10:00
|
|
|
"The visibility flag. True if the StrokeVertex is visible.\n"
|
2013-01-27 20:17:49 +00:00
|
|
|
"\n"
|
2013-02-03 23:04:42 +00:00
|
|
|
":type: bool");
|
2013-01-27 20:17:49 +00:00
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void * /*closure*/)
|
2013-01-27 20:17:49 +00:00
|
|
|
{
|
|
|
|
|
return PyBool_from_bool(self->sa->isVisible());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int StrokeAttribute_visible_set(BPy_StrokeAttribute *self,
|
|
|
|
|
PyObject *value,
|
2022-10-03 17:37:25 -05:00
|
|
|
void * /*closure*/)
|
2013-01-27 20:17:49 +00:00
|
|
|
{
|
2013-02-03 23:04:42 +00:00
|
|
|
if (!PyBool_Check(value)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "value must be boolean");
|
2013-01-27 20:17:49 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2013-02-03 23:04:42 +00:00
|
|
|
self->sa->setVisible(bool_from_PyBool(value));
|
2013-01-27 20:17:49 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyGetSetDef BPy_StrokeAttribute_getseters[] = {
|
2019-12-20 10:42:57 +11:00
|
|
|
{"alpha",
|
2013-03-07 23:17:23 +00:00
|
|
|
(getter)StrokeAttribute_alpha_get,
|
|
|
|
|
(setter)StrokeAttribute_alpha_set,
|
2019-12-20 10:42:57 +11:00
|
|
|
StrokeAttribute_alpha_doc,
|
2020-11-06 17:49:09 +01:00
|
|
|
nullptr},
|
2019-12-20 10:42:57 +11:00
|
|
|
{"color",
|
2013-03-07 23:17:23 +00:00
|
|
|
(getter)StrokeAttribute_color_get,
|
|
|
|
|
(setter)StrokeAttribute_color_set,
|
2019-12-20 10:42:57 +11:00
|
|
|
StrokeAttribute_color_doc,
|
2020-11-06 17:49:09 +01:00
|
|
|
nullptr},
|
2019-12-20 10:42:57 +11:00
|
|
|
{"thickness",
|
2013-03-07 23:17:23 +00:00
|
|
|
(getter)StrokeAttribute_thickness_get,
|
|
|
|
|
(setter)StrokeAttribute_thickness_set,
|
2019-12-20 10:42:57 +11:00
|
|
|
StrokeAttribute_thickness_doc,
|
2020-11-06 17:49:09 +01:00
|
|
|
nullptr},
|
2019-12-20 10:42:57 +11:00
|
|
|
{"visible",
|
2013-03-07 23:17:23 +00:00
|
|
|
(getter)StrokeAttribute_visible_get,
|
|
|
|
|
(setter)StrokeAttribute_visible_set,
|
2019-12-20 10:42:57 +11:00
|
|
|
StrokeAttribute_visible_doc,
|
2020-11-06 17:49:09 +01:00
|
|
|
nullptr},
|
|
|
|
|
{nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
|
2013-01-27 20:17:49 +00:00
|
|
|
};
|
|
|
|
|
|
2010-04-17 23:47:47 +00:00
|
|
|
/*-----------------------BPy_StrokeAttribute type definition ------------------------------*/
|
|
|
|
|
|
|
|
|
|
PyTypeObject StrokeAttribute_Type = {
|
2023-07-16 17:43:31 +10:00
|
|
|
/*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
|
2022-11-07 22:34:35 +11:00
|
|
|
/*tp_name*/ "StrokeAttribute",
|
|
|
|
|
/*tp_basicsize*/ sizeof(BPy_StrokeAttribute),
|
|
|
|
|
/*tp_itemsize*/ 0,
|
|
|
|
|
/*tp_dealloc*/ (destructor)StrokeAttribute_dealloc,
|
|
|
|
|
/*tp_vectorcall_offset*/ 0,
|
|
|
|
|
/*tp_getattr*/ nullptr,
|
|
|
|
|
/*tp_setattr*/ nullptr,
|
|
|
|
|
/*tp_as_async*/ nullptr,
|
|
|
|
|
/*tp_repr*/ (reprfunc)StrokeAttribute_repr,
|
|
|
|
|
/*tp_as_number*/ nullptr,
|
|
|
|
|
/*tp_as_sequence*/ nullptr,
|
|
|
|
|
/*tp_as_mapping*/ nullptr,
|
|
|
|
|
/*tp_hash*/ nullptr,
|
|
|
|
|
/*tp_call*/ nullptr,
|
|
|
|
|
/*tp_str*/ nullptr,
|
|
|
|
|
/*tp_getattro*/ nullptr,
|
|
|
|
|
/*tp_setattro*/ nullptr,
|
|
|
|
|
/*tp_as_buffer*/ nullptr,
|
|
|
|
|
/*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|
|
|
|
/*tp_doc*/ StrokeAttribute_doc,
|
|
|
|
|
/*tp_traverse*/ nullptr,
|
|
|
|
|
/*tp_clear*/ nullptr,
|
|
|
|
|
/*tp_richcompare*/ nullptr,
|
|
|
|
|
/*tp_weaklistoffset*/ 0,
|
|
|
|
|
/*tp_iter*/ nullptr,
|
|
|
|
|
/*tp_iternext*/ nullptr,
|
|
|
|
|
/*tp_methods*/ BPy_StrokeAttribute_methods,
|
|
|
|
|
/*tp_members*/ nullptr,
|
|
|
|
|
/*tp_getset*/ BPy_StrokeAttribute_getseters,
|
|
|
|
|
/*tp_base*/ nullptr,
|
|
|
|
|
/*tp_dict*/ nullptr,
|
|
|
|
|
/*tp_descr_get*/ nullptr,
|
|
|
|
|
/*tp_descr_set*/ nullptr,
|
|
|
|
|
/*tp_dictoffset*/ 0,
|
|
|
|
|
/*tp_init*/ (initproc)StrokeAttribute_init,
|
|
|
|
|
/*tp_alloc*/ nullptr,
|
|
|
|
|
/*tp_new*/ PyType_GenericNew,
|
2010-04-17 23:47:47 +00:00
|
|
|
};
|
|
|
|
|
|
2008-07-21 21:24:37 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
2008-07-09 08:24:13 +00:00
|
|
|
|
2008-07-21 21:24:37 +00:00
|
|
|
#ifdef __cplusplus
|
2008-07-09 08:24:13 +00:00
|
|
|
}
|
2008-07-21 21:24:37 +00:00
|
|
|
#endif
|