Blender  V2.93
BPy_SmoothingShader.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "BPy_SmoothingShader.h"
22 
23 #include "../../stroke/AdvancedStrokeShaders.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 using namespace Freestyle;
30 
32 
33 //------------------------INSTANCE METHODS ----------------------------------
34 
35 static char SmoothingShader___doc__[] =
36  "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SmoothingShader`\n"
37  "\n"
38  "[Geometry shader]\n"
39  "\n"
40  ".. method:: __init__(num_iterations=100, factor_point=0.1, \\\n"
41  " factor_curvature=0.0, factor_curvature_difference=0.2, \\\n"
42  " aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0, \\\n"
43  " carricature_factor=1.0)\n"
44  "\n"
45  " Builds a SmoothingShader object.\n"
46  "\n"
47  " :arg num_iterations: The number of iterations.\n"
48  " :type num_iterations: int\n"
49  " :arg factor_point: 0.1\n"
50  " :type factor_point: float\n"
51  " :arg factor_curvature: 0.0\n"
52  " :type factor_curvature: float\n"
53  " :arg factor_curvature_difference: 0.2\n"
54  " :type factor_curvature_difference: float\n"
55  " :arg aniso_point: 0.0\n"
56  " :type aniso_point: float\n"
57  " :arg aniso_normal: 0.0\n"
58  " :type aniso_normal: float\n"
59  " :arg aniso_curvature: 0.0\n"
60  " :type aniso_curvature: float\n"
61  " :arg carricature_factor: 1.0\n"
62  " :type carricature_factor: float\n"
63  "\n"
64  ".. method:: shade(stroke)\n"
65  "\n"
66  " Smoothes the stroke by moving the vertices to make the stroke\n"
67  " smoother. Uses curvature flow to converge towards a curve of\n"
68  " constant curvature. The diffusion method we use is anisotropic to\n"
69  " prevent the diffusion across corners.\n"
70  "\n"
71  " :arg stroke: A Stroke object.\n"
72  " :type stroke: :class:`freestyle.types.Stroke`\n";
73 
74 static int SmoothingShader___init__(BPy_SmoothingShader *self, PyObject *args, PyObject *kwds)
75 {
76  static const char *kwlist[] = {
77  "num_iterations",
78  "factor_point",
79  "factor_curvature",
80  "factor_curvature_difference",
81  "aniso_point",
82  "aniso_normal",
83  "aniso_curvature",
84  "carricature_factor",
85  nullptr,
86  };
87  int i1 = 100;
88  double d2 = 0.1, d3 = 0.0, d4 = 0.2, d5 = 0.0, d6 = 0.0, d7 = 0.0, d8 = 1.0;
89 
90  if (!PyArg_ParseTupleAndKeywords(
91  args, kwds, "|iddddddd", (char **)kwlist, &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8)) {
92  return -1;
93  }
94  self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8);
95  return 0;
96 }
97 
98 /*-----------------------BPy_SmoothingShader type definition ------------------------------*/
99 
100 PyTypeObject SmoothingShader_Type = {
101  PyVarObject_HEAD_INIT(nullptr, 0) "SmoothingShader", /* tp_name */
102  sizeof(BPy_SmoothingShader), /* tp_basicsize */
103  0, /* tp_itemsize */
104  nullptr, /* tp_dealloc */
105  0, /* tp_vectorcall_offset */
106  nullptr, /* tp_getattr */
107  nullptr, /* tp_setattr */
108  nullptr, /* tp_reserved */
109  nullptr, /* tp_repr */
110  nullptr, /* tp_as_number */
111  nullptr, /* tp_as_sequence */
112  nullptr, /* tp_as_mapping */
113  nullptr, /* tp_hash */
114  nullptr, /* tp_call */
115  nullptr, /* tp_str */
116  nullptr, /* tp_getattro */
117  nullptr, /* tp_setattro */
118  nullptr, /* tp_as_buffer */
119  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
120  SmoothingShader___doc__, /* tp_doc */
121  nullptr, /* tp_traverse */
122  nullptr, /* tp_clear */
123  nullptr, /* tp_richcompare */
124  0, /* tp_weaklistoffset */
125  nullptr, /* tp_iter */
126  nullptr, /* tp_iternext */
127  nullptr, /* tp_methods */
128  nullptr, /* tp_members */
129  nullptr, /* tp_getset */
130  &StrokeShader_Type, /* tp_base */
131  nullptr, /* tp_dict */
132  nullptr, /* tp_descr_get */
133  nullptr, /* tp_descr_set */
134  0, /* tp_dictoffset */
135  (initproc)SmoothingShader___init__, /* tp_init */
136  nullptr, /* tp_alloc */
137  nullptr, /* tp_new */
138 };
139 
141 
142 #ifdef __cplusplus
143 }
144 #endif
static char SmoothingShader___doc__[]
static int SmoothingShader___init__(BPy_SmoothingShader *self, PyObject *args, PyObject *kwds)
PyTypeObject SmoothingShader_Type
PyTypeObject StrokeShader_Type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint i1
inherits from class Rep
Definition: AppCanvas.cpp:32