Blender V4.3
BPy_NonTVertex.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2004-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "BPy_NonTVertex.h"
10
11#include "../../BPy_Convert.h"
12#include "../BPy_SVertex.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18using namespace Freestyle;
19
21
22/*----------------------NonTVertex methods ----------------------------*/
23
25 /* Wrap. */
26 NonTVertex_doc,
27 "Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`NonTVertex`\n"
28 "\n"
29 "View vertex for corners, cusps, etc. associated to a single SVertex.\n"
30 "Can be associated to 2 or more view edges.\n"
31 "\n"
32 ".. method:: __init__()\n"
33 " __init__(svertex)\n"
34 "\n"
35 " Builds a :class:`NonTVertex` using the default constructor or a :class:`SVertex`.\n"
36 "\n"
37 " :arg svertex: An SVertex object.\n"
38 " :type svertex: :class:`SVertex`");
39
40/* NOTE: No copy constructor in Python because the C++ copy constructor is 'protected'. */
41
42static int NonTVertex_init(BPy_NonTVertex *self, PyObject *args, PyObject *kwds)
43{
44 static const char *kwlist[] = {"svertex", nullptr};
45 PyObject *obj = nullptr;
46
47 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SVertex_Type, &obj)) {
48 return -1;
49 }
50 if (!obj) {
51 self->ntv = new NonTVertex();
52 }
53 else {
54 self->ntv = new NonTVertex(((BPy_SVertex *)obj)->sv);
55 }
56 self->py_vv.vv = self->ntv;
57 self->py_vv.py_if0D.if0D = self->ntv;
58 self->py_vv.py_if0D.borrowed = false;
59 return 0;
60}
61
62/*----------------------NonTVertex get/setters ----------------------------*/
63
65 /* Wrap. */
66 NonTVertex_svertex_doc,
67 "The SVertex on top of which this NonTVertex is built.\n"
68 "\n"
69 ":type: :class:`SVertex`");
70
71static PyObject *NonTVertex_svertex_get(BPy_NonTVertex *self, void * /*closure*/)
72{
73 SVertex *v = self->ntv->svertex();
74 if (v) {
76 }
77 Py_RETURN_NONE;
78}
79
80static int NonTVertex_svertex_set(BPy_NonTVertex *self, PyObject *value, void * /*closure*/)
81{
82 if (!BPy_SVertex_Check(value)) {
83 PyErr_SetString(PyExc_TypeError, "value must be an SVertex");
84 return -1;
85 }
86 self->ntv->setSVertex(((BPy_SVertex *)value)->sv);
87 return 0;
88}
89
90static PyGetSetDef BPy_NonTVertex_getseters[] = {
91 {"svertex",
94 NonTVertex_svertex_doc,
95 nullptr},
96 {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */
97};
98
99/*-----------------------BPy_NonTVertex type definition ------------------------------*/
100
101PyTypeObject NonTVertex_Type = {
102 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
103 /*tp_name*/ "NonTVertex",
104 /*tp_basicsize*/ sizeof(BPy_NonTVertex),
105 /*tp_itemsize*/ 0,
106 /*tp_dealloc*/ nullptr,
107 /*tp_vectorcall_offset*/ 0,
108 /*tp_getattr*/ nullptr,
109 /*tp_setattr*/ nullptr,
110 /*tp_as_async*/ nullptr,
111 /*tp_repr*/ nullptr,
112 /*tp_as_number*/ nullptr,
113 /*tp_as_sequence*/ nullptr,
114 /*tp_as_mapping*/ nullptr,
115 /*tp_hash*/ nullptr,
116 /*tp_call*/ nullptr,
117 /*tp_str*/ nullptr,
118 /*tp_getattro*/ nullptr,
119 /*tp_setattro*/ nullptr,
120 /*tp_as_buffer*/ nullptr,
121 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
122 /*tp_doc*/ NonTVertex_doc,
123 /*tp_traverse*/ nullptr,
124 /*tp_clear*/ nullptr,
125 /*tp_richcompare*/ nullptr,
126 /*tp_weaklistoffset*/ 0,
127 /*tp_iter*/ nullptr,
128 /*tp_iternext*/ nullptr,
129 /*tp_methods*/ nullptr,
130 /*tp_members*/ nullptr,
131 /*tp_getset*/ BPy_NonTVertex_getseters,
132 /*tp_base*/ &ViewVertex_Type,
133 /*tp_dict*/ nullptr,
134 /*tp_descr_get*/ nullptr,
135 /*tp_descr_set*/ nullptr,
136 /*tp_dictoffset*/ 0,
137 /*tp_init*/ (initproc)NonTVertex_init,
138 /*tp_alloc*/ nullptr,
139 /*tp_new*/ nullptr,
140};
141
143
144#ifdef __cplusplus
145}
146#endif
PyObject * BPy_SVertex_from_SVertex(SVertex &sv)
static PyObject * NonTVertex_svertex_get(BPy_NonTVertex *self, void *)
static PyGetSetDef BPy_NonTVertex_getseters[]
PyDoc_STRVAR(NonTVertex_doc, "Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`NonTVertex`\n" "\n" "View vertex for corners, cusps, etc. associated to a single SVertex.\n" "Can be associated to 2 or more view edges.\n" "\n" ".. method:: __init__()\n" " __init__(svertex)\n" "\n" " Builds a :class:`NonTVertex` using the default constructor or a :class:`SVertex`.\n" "\n" " :arg svertex: An SVertex object.\n" " :type svertex: :class:`SVertex`")
static int NonTVertex_svertex_set(BPy_NonTVertex *self, PyObject *value, void *)
PyTypeObject NonTVertex_Type
static int NonTVertex_init(BPy_NonTVertex *self, PyObject *args, PyObject *kwds)
PyTypeObject SVertex_Type
#define BPy_SVertex_Check(v)
Definition BPy_SVertex.h:23
PyTypeObject ViewVertex_Type
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject * self
inherits from class Rep
Definition AppCanvas.cpp:20