42 "Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n"
43 "and :class:`ViewEdge`) that are issued from the same input shape.\n"
45 ".. method:: __init__()\n"
46 " __init__(brother)\n"
49 " Builds a :class:`ViewShape` using the default constructor,\n"
50 " copy constructor, or from a :class:`SShape`.\n"
52 " :arg brother: A ViewShape object.\n"
53 " :type brother: :class:`ViewShape`\n"
54 " :arg sshape: An SShape object.\n"
55 " :type sshape: :class:`SShape`");
59 static const char *kwlist_1[] = {
"brother",
nullptr};
60 static const char *kwlist_2[] = {
"sshape",
nullptr};
61 PyObject *obj =
nullptr;
63 if (PyArg_ParseTupleAndKeywords(args, kwds,
"|O!", (
char **)kwlist_1, &
ViewShape_Type, &obj)) {
66 self->py_ss =
nullptr;
73 else if ((
void)PyErr_Clear(),
74 PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist_2, &
SShape_Type, &obj)) {
77 self->py_ss = (!py_ss->
borrowed) ? py_ss :
nullptr;
80 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
83 self->borrowed =
false;
84 Py_XINCREF(
self->py_ss);
91 self->vs->setSShape((
SShape *)
nullptr);
92 Py_DECREF(
self->py_ss);
97 Py_TYPE(
self)->tp_free((PyObject *)
self);
102 return PyUnicode_FromFormat(
"ViewShape - address: %p",
self->vs);
106 ".. method:: add_edge(edge)\n"
108 " Adds a ViewEdge to the list of ViewEdge objects.\n"
110 " :arg edge: A ViewEdge object.\n"
111 " :type edge: :class:`ViewEdge`\n");
115 static const char *kwlist[] = {
"edge",
nullptr};
116 PyObject *py_ve =
nullptr;
118 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
ViewEdge_Type, &py_ve)) {
126 ".. method:: add_vertex(vertex)\n"
128 " Adds a ViewVertex to the list of the ViewVertex objects.\n"
130 " :arg vertex: A ViewVertex object.\n"
131 " :type vertex: :class:`ViewVertex`");
135 static const char *kwlist[] = {
"vertex",
nullptr};
136 PyObject *py_vv =
nullptr;
138 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
ViewVertex_Type, &py_vv)) {
150 METH_VARARGS | METH_KEYWORDS,
151 ViewShape_add_edge_doc},
154 METH_VARARGS | METH_KEYWORDS,
155 ViewShape_add_vertex_doc},
156 {
nullptr,
nullptr, 0,
nullptr},
162 "The SShape on top of which this ViewShape is built.\n"
164 ":type: :class:`SShape`");
168 SShape *ss =
self->vs->sshape();
178 PyErr_SetString(PyExc_TypeError,
"value must be an SShape");
182 self->vs->setSShape(py_ss->
ss);
184 Py_DECREF(
self->py_ss);
188 Py_INCREF(
self->py_ss);
194 "The list of ViewVertex objects contained in this ViewShape.\n"
196 ":type: List of :class:`ViewVertex` objects");
200 vector<ViewVertex *> vertices =
self->vs->vertices();
201 vector<ViewVertex *>::iterator it;
202 PyObject *py_vertices = PyList_New(vertices.size());
205 for (it = vertices.begin(); it != vertices.end(); it++) {
214 vector<ViewVertex *>
v;
216 if (!PyList_Check(value)) {
217 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
221 v.reserve(PyList_GET_SIZE(value));
222 for (
unsigned int i = 0; i < PyList_GET_SIZE(value); i++) {
223 item = PyList_GET_ITEM(value, i);
228 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
232 self->vs->setVertices(
v);
237 "The list of ViewEdge objects contained in this ViewShape.\n"
239 ":type: List of :class:`ViewEdge` objects");
243 vector<ViewEdge *> edges =
self->vs->edges();
244 vector<ViewEdge *>::iterator it;
245 PyObject *py_edges = PyList_New(edges.size());
248 for (it = edges.begin(); it != edges.end(); it++) {
257 vector<ViewEdge *>
v;
259 if (!PyList_Check(value)) {
260 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewEdge objects");
264 v.reserve(PyList_GET_SIZE(value));
265 for (
int i = 0; i < PyList_GET_SIZE(value); i++) {
266 item = PyList_GET_ITEM(value, i);
271 PyErr_SetString(PyExc_TypeError,
"argument must be list of ViewEdge objects");
275 self->vs->setEdges(
v);
280 "The name of the ViewShape.\n"
286 return PyUnicode_FromString(
self->vs->getName().c_str());
290 "The library path of the ViewShape.\n"
292 ":type: str, or None if the ViewShape is not part of a library");
296 return PyUnicode_FromString(
self->vs->getLibraryPath().c_str());
300 "The Id of this ViewShape.\n"
302 ":type: :class:`Id`");
314 ViewShape_sshape_doc,
319 ViewShape_vertices_doc,
330 ViewShape_library_path_doc,
332 {
"id", (getter)
ViewShape_id_get, (setter)
nullptr, ViewShape_id_doc,
nullptr},
333 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
339 PyVarObject_HEAD_INIT(
nullptr, 0)
"ViewShape",
357 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PyObject * BPy_SShape_from_SShape(SShape &ss)
PyObject * BPy_ViewEdge_from_ViewEdge(ViewEdge &ve)
PyObject * BPy_Id_from_Id(Id &id)
PyObject * Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv)
#define BPy_SShape_Check(v)
PyTypeObject ViewEdge_Type
#define BPy_ViewEdge_Check(v)
PyTypeObject ViewShape_Type
static int ViewShape_edges_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
static int ViewShape_init(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
static void ViewShape_dealloc(BPy_ViewShape *self)
static PyObject * ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyObject * ViewShape_name_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyMethodDef BPy_ViewShape_methods[]
int ViewShape_Init(PyObject *module)
PyDoc_STRVAR(ViewShape_doc, "Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n" "and :class:`ViewEdge`) that are issued from the same input shape.\n" "\n" ".. method:: __init__()\n" " __init__(brother)\n" " __init__(sshape)\n" "\n" " Builds a :class:`ViewShape` using the default constructor,\n" " copy constructor, or from a :class:`SShape`.\n" "\n" " :arg brother: A ViewShape object.\n" " :type brother: :class:`ViewShape`\n" " :arg sshape: An SShape object.\n" " :type sshape: :class:`SShape`")
static PyObject * ViewShape_sshape_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyObject * ViewShape_library_path_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyGetSetDef BPy_ViewShape_getseters[]
static PyObject * ViewShape_id_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyObject * ViewShape_repr(BPy_ViewShape *self)
static PyObject * ViewShape_add_edge(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
static PyObject * ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyObject * ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
PyTypeObject ViewVertex_Type
#define BPy_ViewVertex_Check(v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
static struct PyModuleDef module
PyObject_HEAD Freestyle::SShape * ss