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