Blender  V3.3
BPy_SmoothingShader.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "BPy_SmoothingShader.h"
8 
9 #include "../../stroke/AdvancedStrokeShaders.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 using namespace Freestyle;
16 
18 
19 //------------------------INSTANCE METHODS ----------------------------------
20 
21 static char SmoothingShader___doc__[] =
22  "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SmoothingShader`\n"
23  "\n"
24  "[Geometry shader]\n"
25  "\n"
26  ".. method:: __init__(num_iterations=100, factor_point=0.1, \\\n"
27  " factor_curvature=0.0, factor_curvature_difference=0.2, \\\n"
28  " aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0, \\\n"
29  " carricature_factor=1.0)\n"
30  "\n"
31  " Builds a SmoothingShader object.\n"
32  "\n"
33  " :arg num_iterations: The number of iterations.\n"
34  " :type num_iterations: int\n"
35  " :arg factor_point: 0.1\n"
36  " :type factor_point: float\n"
37  " :arg factor_curvature: 0.0\n"
38  " :type factor_curvature: float\n"
39  " :arg factor_curvature_difference: 0.2\n"
40  " :type factor_curvature_difference: float\n"
41  " :arg aniso_point: 0.0\n"
42  " :type aniso_point: float\n"
43  " :arg aniso_normal: 0.0\n"
44  " :type aniso_normal: float\n"
45  " :arg aniso_curvature: 0.0\n"
46  " :type aniso_curvature: float\n"
47  " :arg carricature_factor: 1.0\n"
48  " :type carricature_factor: float\n"
49  "\n"
50  ".. method:: shade(stroke)\n"
51  "\n"
52  " Smooths the stroke by moving the vertices to make the stroke\n"
53  " smoother. Uses curvature flow to converge towards a curve of\n"
54  " constant curvature. The diffusion method we use is anisotropic to\n"
55  " prevent the diffusion across corners.\n"
56  "\n"
57  " :arg stroke: A Stroke object.\n"
58  " :type stroke: :class:`freestyle.types.Stroke`\n";
59 
60 static int SmoothingShader___init__(BPy_SmoothingShader *self, PyObject *args, PyObject *kwds)
61 {
62  static const char *kwlist[] = {
63  "num_iterations",
64  "factor_point",
65  "factor_curvature",
66  "factor_curvature_difference",
67  "aniso_point",
68  "aniso_normal",
69  "aniso_curvature",
70  "carricature_factor",
71  nullptr,
72  };
73  int i1 = 100;
74  double d2 = 0.1, d3 = 0.0, d4 = 0.2, d5 = 0.0, d6 = 0.0, d7 = 0.0, d8 = 1.0;
75 
76  if (!PyArg_ParseTupleAndKeywords(
77  args, kwds, "|iddddddd", (char **)kwlist, &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8)) {
78  return -1;
79  }
80  self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8);
81  return 0;
82 }
83 
84 /*-----------------------BPy_SmoothingShader type definition ------------------------------*/
85 
86 PyTypeObject SmoothingShader_Type = {
87  PyVarObject_HEAD_INIT(nullptr, 0) "SmoothingShader", /* tp_name */
88  sizeof(BPy_SmoothingShader), /* tp_basicsize */
89  0, /* tp_itemsize */
90  nullptr, /* tp_dealloc */
91  0, /* tp_vectorcall_offset */
92  nullptr, /* tp_getattr */
93  nullptr, /* tp_setattr */
94  nullptr, /* tp_reserved */
95  nullptr, /* tp_repr */
96  nullptr, /* tp_as_number */
97  nullptr, /* tp_as_sequence */
98  nullptr, /* tp_as_mapping */
99  nullptr, /* tp_hash */
100  nullptr, /* tp_call */
101  nullptr, /* tp_str */
102  nullptr, /* tp_getattro */
103  nullptr, /* tp_setattro */
104  nullptr, /* tp_as_buffer */
105  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
106  SmoothingShader___doc__, /* tp_doc */
107  nullptr, /* tp_traverse */
108  nullptr, /* tp_clear */
109  nullptr, /* tp_richcompare */
110  0, /* tp_weaklistoffset */
111  nullptr, /* tp_iter */
112  nullptr, /* tp_iternext */
113  nullptr, /* tp_methods */
114  nullptr, /* tp_members */
115  nullptr, /* tp_getset */
116  &StrokeShader_Type, /* tp_base */
117  nullptr, /* tp_dict */
118  nullptr, /* tp_descr_get */
119  nullptr, /* tp_descr_set */
120  0, /* tp_dictoffset */
121  (initproc)SmoothingShader___init__, /* tp_init */
122  nullptr, /* tp_alloc */
123  nullptr, /* tp_new */
124 };
125 
127 
128 #ifdef __cplusplus
129 }
130 #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:18