Blender V4.3
BPy_ChainSilhouetteIterator.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2004-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include "../BPy_Convert.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18using namespace Freestyle;
19
21
22//------------------------INSTANCE METHODS ----------------------------------
23
24// ChainSilhouetteIterator (bool restrict_to_selection=true, ViewEdge *begin=nullptr, bool
25// orientation=true) ChainSilhouetteIterator (const ChainSilhouetteIterator &brother)
26
28 /* Wrap. */
29 ChainSilhouetteIterator_doc,
30 "Class hierarchy: :class:`freestyle.types.Iterator` >\n"
31 ":class:`freestyle.types.ViewEdgeIterator` >\n"
32 ":class:`freestyle.types.ChainingIterator` >\n"
33 ":class:`ChainSilhouetteIterator`\n"
34 "\n"
35 "A ViewEdge Iterator used to follow ViewEdges the most naturally. For\n"
36 "example, it will follow visible ViewEdges of same nature. As soon, as\n"
37 "the nature or the visibility changes, the iteration stops (by setting\n"
38 "the pointed ViewEdge to 0). In the case of an iteration over a set of\n"
39 "ViewEdge that are both Silhouette and Crease, there will be a\n"
40 "precedence of the silhouette over the crease criterion.\n"
41 "\n"
42 ".. method:: __init__(restrict_to_selection=True, begin=None, orientation=True)\n"
43 " __init__(brother)\n"
44 "\n"
45 " Builds a ChainSilhouetteIterator from the first ViewEdge used for\n"
46 " iteration and its orientation or the copy constructor.\n"
47 "\n"
48 " :arg restrict_to_selection: Indicates whether to force the chaining\n"
49 " to stay within the set of selected ViewEdges or not.\n"
50 " :type restrict_to_selection: bool\n"
51 " :arg begin: The ViewEdge from where to start the iteration.\n"
52 " :type begin: :class:`freestyle.types.ViewEdge` | None\n"
53 " :arg orientation: If true, we'll look for the next ViewEdge among\n"
54 " the ViewEdges that surround the ending ViewVertex of begin. If\n"
55 " false, we'll search over the ViewEdges surrounding the ending\n"
56 " ViewVertex of begin.\n"
57 " :type orientation: bool\n"
58 " :arg brother: A ChainSilhouetteIterator object.\n"
59 " :type brother: :class:`ChainSilhouetteIterator`");
60
61static int check_begin(PyObject *obj, void *v)
62{
63 if (obj != nullptr && obj != Py_None && !BPy_ViewEdge_Check(obj)) {
64 return 0;
65 }
66 *((PyObject **)v) = obj;
67 return 1;
68}
69
71 PyObject *args,
72 PyObject *kwds)
73{
74 static const char *kwlist_1[] = {"brother", nullptr};
75 static const char *kwlist_2[] = {"restrict_to_selection", "begin", "orientation", nullptr};
76 PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr;
77
78 if (PyArg_ParseTupleAndKeywords(
79 args, kwds, "O!", (char **)kwlist_1, &ChainSilhouetteIterator_Type, &obj1))
80 {
81 self->cs_it = new ChainSilhouetteIterator(*(((BPy_ChainSilhouetteIterator *)obj1)->cs_it));
82 }
83 else if ((void)PyErr_Clear(),
84 (void)(obj1 = obj2 = obj3 = nullptr),
85 PyArg_ParseTupleAndKeywords(args,
86 kwds,
87 "|O!O&O!",
88 (char **)kwlist_2,
89 &PyBool_Type,
90 &obj1,
92 &obj2,
93 &PyBool_Type,
94 &obj3))
95 {
96 bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1);
97 ViewEdge *begin = (!obj2 || obj2 == Py_None) ? nullptr : ((BPy_ViewEdge *)obj2)->ve;
98 bool orientation = (!obj3) ? true : bool_from_PyBool(obj3);
99 self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation);
100 }
101 else {
102 PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
103 return -1;
104 }
105 self->py_c_it.c_it = self->cs_it;
106 self->py_c_it.py_ve_it.ve_it = self->cs_it;
107 self->py_c_it.py_ve_it.py_it.it = self->cs_it;
108 return 0;
109}
110
111/*-----------------------BPy_ChainSilhouetteIterator type definition ----------------------------*/
112
114 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
115 /*tp_name*/ "ChainSilhouetteIterator",
116 /*tp_basicsize*/ sizeof(BPy_ChainSilhouetteIterator),
117 /*tp_itemsize*/ 0,
118 /*tp_dealloc*/ nullptr,
119 /*tp_vectorcall_offset*/ 0,
120 /*tp_getattr*/ nullptr,
121 /*tp_setattr*/ nullptr,
122 /*tp_as_async*/ nullptr,
123 /*tp_repr*/ nullptr,
124 /*tp_as_number*/ nullptr,
125 /*tp_as_sequence*/ nullptr,
126 /*tp_as_mapping*/ nullptr,
127 /*tp_hash*/ nullptr,
128 /*tp_call*/ nullptr,
129 /*tp_str*/ nullptr,
130 /*tp_getattro*/ nullptr,
131 /*tp_setattro*/ nullptr,
132 /*tp_as_buffer*/ nullptr,
133 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
134 /*tp_doc*/ ChainSilhouetteIterator_doc,
135 /*tp_traverse*/ nullptr,
136 /*tp_clear*/ nullptr,
137 /*tp_richcompare*/ nullptr,
138 /*tp_weaklistoffset*/ 0,
139 /*tp_iter*/ nullptr,
140 /*tp_iternext*/ nullptr,
141 /*tp_methods*/ nullptr,
142 /*tp_members*/ nullptr,
143 /*tp_getset*/ nullptr,
144 /*tp_base*/ &ChainingIterator_Type,
145 /*tp_dict*/ nullptr,
146 /*tp_descr_get*/ nullptr,
147 /*tp_descr_set*/ nullptr,
148 /*tp_dictoffset*/ 0,
149 /*tp_init*/ (initproc)ChainSilhouetteIterator_init,
150 /*tp_alloc*/ nullptr,
151 /*tp_new*/ nullptr,
152};
153
155
156#ifdef __cplusplus
157}
158#endif
static int check_begin(PyObject *obj, void *v)
PyTypeObject ChainSilhouetteIterator_Type
PyDoc_STRVAR(ChainSilhouetteIterator_doc, "Class hierarchy: :class:`freestyle.types.Iterator` >\n" ":class:`freestyle.types.ViewEdgeIterator` >\n" ":class:`freestyle.types.ChainingIterator` >\n" ":class:`ChainSilhouetteIterator`\n" "\n" "A ViewEdge Iterator used to follow ViewEdges the most naturally. For\n" "example, it will follow visible ViewEdges of same nature. As soon, as\n" "the nature or the visibility changes, the iteration stops (by setting\n" "the pointed ViewEdge to 0). In the case of an iteration over a set of\n" "ViewEdge that are both Silhouette and Crease, there will be a\n" "precedence of the silhouette over the crease criterion.\n" "\n" ".. method:: __init__(restrict_to_selection=True, begin=None, orientation=True)\n" " __init__(brother)\n" "\n" " Builds a ChainSilhouetteIterator from the first ViewEdge used for\n" " iteration and its orientation or the copy constructor.\n" "\n" " :arg restrict_to_selection: Indicates whether to force the chaining\n" " to stay within the set of selected ViewEdges or not.\n" " :type restrict_to_selection: bool\n" " :arg begin: The ViewEdge from where to start the iteration.\n" " :type begin: :class:`freestyle.types.ViewEdge` | None\n" " :arg orientation: If true, we'll look for the next ViewEdge among\n" " the ViewEdges that surround the ending ViewVertex of begin. If\n" " false, we'll search over the ViewEdges surrounding the ending\n" " ViewVertex of begin.\n" " :type orientation: bool\n" " :arg brother: A ChainSilhouetteIterator object.\n" " :type brother: :class:`ChainSilhouetteIterator`")
static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self, PyObject *args, PyObject *kwds)
PyTypeObject ChainingIterator_Type
bool bool_from_PyBool(PyObject *b)
#define BPy_ViewEdge_Check(v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject * self
inherits from class Rep
Definition AppCanvas.cpp:20