Blender  V3.3
BPy_PolygonalizationShader.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
8 
9 #include "../../stroke/BasicStrokeShaders.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 using namespace Freestyle;
16 
18 
19 //------------------------INSTANCE METHODS ----------------------------------
20 
22  "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`PolygonalizationShader`\n"
23  "\n"
24  "[Geometry shader]\n"
25  "\n"
26  ".. method:: __init__(error)\n"
27  "\n"
28  " Builds a PolygonalizationShader object.\n"
29  "\n"
30  " :arg error: The error we want our polygonal approximation to have\n"
31  " with respect to the original geometry. The smaller, the closer\n"
32  " the new stroke is to the original one. This error corresponds to\n"
33  " the maximum distance between the new stroke and the old one.\n"
34  " :type error: float\n"
35  "\n"
36  ".. method:: shade(stroke)\n"
37  "\n"
38  " Modifies the Stroke geometry so that it looks more \"polygonal\".\n"
39  " The basic idea is to start from the minimal stroke approximation\n"
40  " consisting in a line joining the first vertex to the last one and\n"
41  " to subdivide using the original stroke vertices until a certain\n"
42  " error is reached.\n"
43  "\n"
44  " :arg stroke: A Stroke object.\n"
45  " :type stroke: :class:`freestyle.types.Stroke`\n";
46 
48  PyObject *args,
49  PyObject *kwds)
50 {
51  static const char *kwlist[] = {"error", nullptr};
52  float f;
53 
54  if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) {
55  return -1;
56  }
57  self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f);
58  return 0;
59 }
60 
61 /*-----------------------BPy_PolygonalizationShader type definition -----------------------------*/
62 
64  PyVarObject_HEAD_INIT(nullptr, 0) "PolygonalizationShader", /* tp_name */
65  sizeof(BPy_PolygonalizationShader), /* tp_basicsize */
66  0, /* tp_itemsize */
67  nullptr, /* tp_dealloc */
68  0, /* tp_vectorcall_offset */
69  nullptr, /* tp_getattr */
70  nullptr, /* tp_setattr */
71  nullptr, /* tp_reserved */
72  nullptr, /* tp_repr */
73  nullptr, /* tp_as_number */
74  nullptr, /* tp_as_sequence */
75  nullptr, /* tp_as_mapping */
76  nullptr, /* tp_hash */
77  nullptr, /* tp_call */
78  nullptr, /* tp_str */
79  nullptr, /* tp_getattro */
80  nullptr, /* tp_setattro */
81  nullptr, /* tp_as_buffer */
82  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
83  PolygonalizationShader___doc__, /* tp_doc */
84  nullptr, /* tp_traverse */
85  nullptr, /* tp_clear */
86  nullptr, /* tp_richcompare */
87  0, /* tp_weaklistoffset */
88  nullptr, /* tp_iter */
89  nullptr, /* tp_iternext */
90  nullptr, /* tp_methods */
91  nullptr, /* tp_members */
92  nullptr, /* tp_getset */
93  &StrokeShader_Type, /* tp_base */
94  nullptr, /* tp_dict */
95  nullptr, /* tp_descr_get */
96  nullptr, /* tp_descr_set */
97  0, /* tp_dictoffset */
98  (initproc)PolygonalizationShader___init__, /* tp_init */
99  nullptr, /* tp_alloc */
100  nullptr, /* tp_new */
101 };
102 
104 
105 #ifdef __cplusplus
106 }
107 #endif
static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self, PyObject *args, PyObject *kwds)
static char PolygonalizationShader___doc__[]
PyTypeObject PolygonalizationShader_Type
PyTypeObject StrokeShader_Type
inherits from class Rep
Definition: AppCanvas.cpp:18