Blender V5.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
8
10
11#include "../BPy_Convert.h"
13
14using namespace Freestyle;
15
17
18//------------------------INSTANCE METHODS ----------------------------------
19
20// ChainSilhouetteIterator (bool restrict_to_selection=true, ViewEdge *begin=nullptr, bool
21// orientation=true) ChainSilhouetteIterator (const ChainSilhouetteIterator &brother)
22
24 /* Wrap. */
25 ChainSilhouetteIterator_doc,
26 "Class hierarchy: :class:`freestyle.types.Iterator` >\n"
27 ":class:`freestyle.types.ViewEdgeIterator` >\n"
28 ":class:`freestyle.types.ChainingIterator` >\n"
29 ":class:`ChainSilhouetteIterator`\n"
30 "\n"
31 "A ViewEdge Iterator used to follow ViewEdges the most naturally. For\n"
32 "example, it will follow visible ViewEdges of same nature. As soon, as\n"
33 "the nature or the visibility changes, the iteration stops (by setting\n"
34 "the pointed ViewEdge to 0). In the case of an iteration over a set of\n"
35 "ViewEdge that are both Silhouette and Crease, there will be a\n"
36 "precedence of the silhouette over the crease criterion.\n"
37 "\n"
38 ".. method:: __init__(*args)\n"
39 "\n"
40 " Accepted call signatures:\n"
41 "\n"
42 " - ``__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 " :param 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 " :param begin: The ViewEdge from where to start the iteration.\n"
52 " :type begin: :class:`freestyle.types.ViewEdge` | None\n"
53 " :param 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 " :param brother: A ChainSilhouetteIterator object.\n"
59 " :type brother: :class:`ChainSilhouetteIterator`\n");
60static int check_begin(PyObject *obj, void *v)
61{
62 if (obj != nullptr && obj != Py_None && !BPy_ViewEdge_Check(obj)) {
63 return 0;
64 }
65 *((PyObject **)v) = obj;
66 return 1;
67}
68
70 PyObject *args,
71 PyObject *kwds)
72{
73 static const char *kwlist_1[] = {"brother", nullptr};
74 static const char *kwlist_2[] = {"restrict_to_selection", "begin", "orientation", nullptr};
75 PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr;
76
77 if (PyArg_ParseTupleAndKeywords(args,
78 kwds,
79 "O!" /* `brother` */
80 ":__init__",
81 (char **)kwlist_1,
83 &obj1))
84 {
85 self->cs_it = new ChainSilhouetteIterator(*(((BPy_ChainSilhouetteIterator *)obj1)->cs_it));
86 }
87 else if ((void)PyErr_Clear(),
88 (void)(obj1 = obj2 = obj3 = nullptr),
89 PyArg_ParseTupleAndKeywords(args,
90 kwds,
91 "|" /* Optional arguments. */
92 "O!" /* `restrict_to_selection` */
93 "O&" /* `begin` */
94 "O!" /* `orientation` */
95 ":__init__",
96 (char **)kwlist_2,
97 &PyBool_Type,
98 &obj1,
100 &obj2,
101 &PyBool_Type,
102 &obj3))
103 {
104 bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1);
105 ViewEdge *begin = (!obj2 || obj2 == Py_None) ? nullptr : ((BPy_ViewEdge *)obj2)->ve;
106 bool orientation = (!obj3) ? true : bool_from_PyBool(obj3);
107 self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation);
108 }
109 else {
110 PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
111 return -1;
112 }
113 self->py_c_it.c_it = self->cs_it;
114 self->py_c_it.py_ve_it.ve_it = self->cs_it;
115 self->py_c_it.py_ve_it.py_it.it = self->cs_it;
116 return 0;
117}
118
119/*-----------------------BPy_ChainSilhouetteIterator type definition ----------------------------*/
120
122 /*ob_base*/ PyVarObject_HEAD_INIT(nullptr, 0)
123 /*tp_name*/ "ChainSilhouetteIterator",
124 /*tp_basicsize*/ sizeof(BPy_ChainSilhouetteIterator),
125 /*tp_itemsize*/ 0,
126 /*tp_dealloc*/ nullptr,
127 /*tp_vectorcall_offset*/ 0,
128 /*tp_getattr*/ nullptr,
129 /*tp_setattr*/ nullptr,
130 /*tp_as_async*/ nullptr,
131 /*tp_repr*/ nullptr,
132 /*tp_as_number*/ nullptr,
133 /*tp_as_sequence*/ nullptr,
134 /*tp_as_mapping*/ nullptr,
135 /*tp_hash*/ nullptr,
136 /*tp_call*/ nullptr,
137 /*tp_str*/ nullptr,
138 /*tp_getattro*/ nullptr,
139 /*tp_setattro*/ nullptr,
140 /*tp_as_buffer*/ nullptr,
141 /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
142 /*tp_doc*/ ChainSilhouetteIterator_doc,
143 /*tp_traverse*/ nullptr,
144 /*tp_clear*/ nullptr,
145 /*tp_richcompare*/ nullptr,
146 /*tp_weaklistoffset*/ 0,
147 /*tp_iter*/ nullptr,
148 /*tp_iternext*/ nullptr,
149 /*tp_methods*/ nullptr,
150 /*tp_members*/ nullptr,
151 /*tp_getset*/ nullptr,
152 /*tp_base*/ &ChainingIterator_Type,
153 /*tp_dict*/ nullptr,
154 /*tp_descr_get*/ nullptr,
155 /*tp_descr_set*/ nullptr,
156 /*tp_dictoffset*/ 0,
157 /*tp_init*/ (initproc)ChainSilhouetteIterator_init,
158 /*tp_alloc*/ nullptr,
159 /*tp_new*/ nullptr,
160};
161
static int check_begin(PyObject *obj, void *v)
PyTypeObject ChainSilhouetteIterator_Type
static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self, PyObject *args, PyObject *kwds)
PyTypeObject ChainingIterator_Type
bool bool_from_PyBool(PyObject *b)
PyDoc_STRVAR(FalseBP1D___doc__, "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`FalseBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Always returns false.\n" "\n" " :param inter1: The first Interface1D object.\n" " :type inter1: :class:`freestyle.types.Interface1D`\n" " :param inter2: The second Interface1D object.\n" " :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: False.\n" " :rtype: bool\n")
#define BPy_ViewEdge_Check(v)
ChainSilhouetteIterator(bool iRestrictToSelection=true, ViewEdge *begin=nullptr, bool orientation=true)
inherits from class Rep
Definition AppCanvas.cpp:20
Freestyle::ChainSilhouetteIterator * cs_it
Freestyle::ChainingIterator * c_it
BPy_ViewEdgeIterator py_ve_it
PyObject_HEAD Freestyle::Iterator * it
Freestyle::ViewEdgeInternal::ViewEdgeIterator * ve_it