2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2004-2022 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_UnaryFunction0D.h"
|
2008-07-18 04:59:07 +00:00
|
|
|
|
2008-07-27 03:40:37 +00:00
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h"
|
2008-07-27 06:57:46 +00:00
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h"
|
|
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DFloat.h"
|
|
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DId.h"
|
|
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DMaterial.h"
|
|
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h"
|
|
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DVec2f.h"
|
|
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DVec3f.h"
|
|
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h"
|
|
|
|
|
#include "UnaryFunction0D/BPy_UnaryFunction0DViewShape.h"
|
|
|
|
|
|
2008-07-18 04:59:07 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-02-08 17:28:15 +02:00
|
|
|
using namespace Freestyle;
|
|
|
|
|
|
2008-07-18 04:59:07 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-04-17 23:47:47 +00:00
|
|
|
//-------------------MODULE INITIALIZATION--------------------------------
|
2013-02-22 01:57:20 +00:00
|
|
|
int UnaryFunction0D_Init(PyObject *module)
|
2010-04-17 23:47:47 +00:00
|
|
|
{
|
2020-11-06 17:49:09 +01:00
|
|
|
if (module == nullptr) {
|
2010-04-17 23:47:47 +00:00
|
|
|
return -1;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (PyType_Ready(&UnaryFunction0D_Type) < 0) {
|
2010-04-17 23:47:47 +00:00
|
|
|
return -1;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2013-02-22 01:57:20 +00:00
|
|
|
Py_INCREF(&UnaryFunction0D_Type);
|
2010-04-17 23:47:47 +00:00
|
|
|
PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-22 01:57:20 +00:00
|
|
|
UnaryFunction0DDouble_Init(module);
|
|
|
|
|
UnaryFunction0DEdgeNature_Init(module);
|
|
|
|
|
UnaryFunction0DFloat_Init(module);
|
|
|
|
|
UnaryFunction0DId_Init(module);
|
|
|
|
|
UnaryFunction0DMaterial_Init(module);
|
|
|
|
|
UnaryFunction0DUnsigned_Init(module);
|
|
|
|
|
UnaryFunction0DVec2f_Init(module);
|
|
|
|
|
UnaryFunction0DVec3f_Init(module);
|
|
|
|
|
UnaryFunction0DVectorViewShape_Init(module);
|
|
|
|
|
UnaryFunction0DViewShape_Init(module);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-04-17 23:47:47 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------INSTANCE METHODS ----------------------------------
|
|
|
|
|
|
2024-01-25 10:22:16 +11:00
|
|
|
PyDoc_STRVAR(
|
|
|
|
|
/* Wrap. */
|
|
|
|
|
UnaryFunction0D___doc__,
|
2010-04-17 23:47:47 +00:00
|
|
|
"Base class for Unary Functions (functors) working on\n"
|
2023-07-13 13:40:25 +10:00
|
|
|
":class:`Interface0DIterator`. A unary function will be used by\n"
|
|
|
|
|
"invoking __call__() on an Interface0DIterator. In Python, several\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"different subclasses of UnaryFunction0D are used depending on the\n"
|
2023-07-13 13:40:25 +10:00
|
|
|
"types of functors' return values. For example, you would inherit from\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"a :class:`UnaryFunction0DDouble` if you wish to define a function that\n"
|
2023-07-13 13:40:25 +10:00
|
|
|
"returns a double value. Available UnaryFunction0D subclasses are:\n"
|
2010-04-17 23:47:47 +00:00
|
|
|
"\n"
|
|
|
|
|
"* :class:`UnaryFunction0DDouble`\n"
|
|
|
|
|
"* :class:`UnaryFunction0DEdgeNature`\n"
|
|
|
|
|
"* :class:`UnaryFunction0DFloat`\n"
|
|
|
|
|
"* :class:`UnaryFunction0DId`\n"
|
|
|
|
|
"* :class:`UnaryFunction0DMaterial`\n"
|
|
|
|
|
"* :class:`UnaryFunction0DUnsigned`\n"
|
|
|
|
|
"* :class:`UnaryFunction0DVec2f`\n"
|
|
|
|
|
"* :class:`UnaryFunction0DVec3f`\n"
|
|
|
|
|
"* :class:`UnaryFunction0DVectorViewShape`\n"
|
2024-01-25 10:22:16 +11:00
|
|
|
"* :class:`UnaryFunction0DViewShape`\n");
|
2010-04-17 23:47:47 +00:00
|
|
|
|
2013-03-07 23:17:23 +00:00
|
|
|
static void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D *self)
|
2010-04-17 23:47:47 +00:00
|
|
|
{
|
2013-03-07 23:17:23 +00:00
|
|
|
Py_TYPE(self)->tp_free((PyObject *)self);
|
2010-04-17 23:47:47 +00:00
|
|
|
}
|
|
|
|
|
|
2015-03-27 15:50:18 +05:00
|
|
|
static PyObject *UnaryFunction0D___repr__(BPy_UnaryFunction0D * /*self*/)
|
2010-04-17 23:47:47 +00:00
|
|
|
{
|
2013-02-22 01:57:20 +00:00
|
|
|
return PyUnicode_FromString("UnaryFunction0D");
|
2010-04-17 23:47:47 +00:00
|
|
|
}
|
2008-07-18 04:59:07 +00:00
|
|
|
|
2013-02-22 01:57:20 +00:00
|
|
|
/*----------------------UnaryFunction0D get/setters ----------------------------*/
|
|
|
|
|
|
2024-01-25 10:22:16 +11:00
|
|
|
PyDoc_STRVAR(
|
|
|
|
|
/* Wrap. */
|
|
|
|
|
UnaryFunction0D_name_doc,
|
|
|
|
|
"The name of the unary 0D function.\n"
|
|
|
|
|
"\n"
|
|
|
|
|
":type: str");
|
2013-02-22 01:57:20 +00:00
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static PyObject *UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void * /*closure*/)
|
2013-02-22 01:57:20 +00:00
|
|
|
{
|
|
|
|
|
return PyUnicode_FromString(Py_TYPE(self)->tp_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyGetSetDef BPy_UnaryFunction0D_getseters[] = {
|
2020-11-06 17:49:09 +01:00
|
|
|
{"name",
|
|
|
|
|
(getter)UnaryFunction0D_name_get,
|
|
|
|
|
(setter) nullptr,
|
|
|
|
|
UnaryFunction0D_name_doc,
|
|
|
|
|
nullptr},
|
|
|
|
|
{nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
|
2013-02-22 01:57:20 +00:00
|
|
|
};
|
|
|
|
|
|
2008-07-18 04:59:07 +00:00
|
|
|
/*-----------------------BPy_UnaryFunction0D type definition ------------------------------*/
|
|
|
|
|
|
|
|
|
|
PyTypeObject UnaryFunction0D_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*/ "UnaryFunction0D",
|
|
|
|
|
/*tp_basicsize*/ sizeof(BPy_UnaryFunction0D),
|
|
|
|
|
/*tp_itemsize*/ 0,
|
|
|
|
|
/*tp_dealloc*/ (destructor)UnaryFunction0D___dealloc__,
|
|
|
|
|
/*tp_vectorcall_offset*/ 0,
|
|
|
|
|
/*tp_getattr*/ nullptr,
|
|
|
|
|
/*tp_setattr*/ nullptr,
|
|
|
|
|
/*tp_as_async*/ nullptr,
|
|
|
|
|
/*tp_repr*/ (reprfunc)UnaryFunction0D___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*/ UnaryFunction0D___doc__,
|
|
|
|
|
/*tp_traverse*/ nullptr,
|
|
|
|
|
/*tp_clear*/ nullptr,
|
|
|
|
|
/*tp_richcompare*/ nullptr,
|
|
|
|
|
/*tp_weaklistoffset*/ 0,
|
|
|
|
|
/*tp_iter*/ nullptr,
|
|
|
|
|
/*tp_iternext*/ nullptr,
|
|
|
|
|
/*tp_methods*/ nullptr,
|
|
|
|
|
/*tp_members*/ nullptr,
|
|
|
|
|
/*tp_getset*/ BPy_UnaryFunction0D_getseters,
|
|
|
|
|
/*tp_base*/ nullptr,
|
|
|
|
|
/*tp_dict*/ nullptr,
|
|
|
|
|
/*tp_descr_get*/ nullptr,
|
|
|
|
|
/*tp_descr_set*/ nullptr,
|
|
|
|
|
/*tp_dictoffset*/ 0,
|
|
|
|
|
/*tp_init*/ nullptr,
|
|
|
|
|
/*tp_alloc*/ nullptr,
|
|
|
|
|
/*tp_new*/ PyType_GenericNew,
|
2008-07-18 04:59:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|