Made the Freestyle Python API compatible with Python 3.
[blender.git] / source / blender / freestyle / intern / python / StrokeShader / BPy_ThicknessVariationPatternShader.cpp
1 #include "BPy_ThicknessVariationPatternShader.h"
2
3 #include "../../stroke/BasicStrokeShaders.h"
4 #include "../BPy_Convert.h"
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 ///////////////////////////////////////////////////////////////////////////////////////////
11
12 /*---------------  Python API function prototypes for ThicknessVariationPatternShader instance  -----------*/
13 static int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args);
14
15 /*-----------------------BPy_ThicknessVariationPatternShader type definition ------------------------------*/
16
17 PyTypeObject ThicknessVariationPatternShader_Type = {
18         PyObject_HEAD_INIT(NULL)
19         "ThicknessVariationPatternShader", /* tp_name */
20         sizeof(BPy_ThicknessVariationPatternShader), /* tp_basicsize */
21         0,                              /* tp_itemsize */
22         0,                              /* tp_dealloc */
23         0,                              /* tp_print */
24         0,                              /* tp_getattr */
25         0,                              /* tp_setattr */
26         0,                              /* tp_reserved */
27         0,                              /* tp_repr */
28         0,                              /* tp_as_number */
29         0,                              /* tp_as_sequence */
30         0,                              /* tp_as_mapping */
31         0,                              /* tp_hash  */
32         0,                              /* tp_call */
33         0,                              /* tp_str */
34         0,                              /* tp_getattro */
35         0,                              /* tp_setattro */
36         0,                              /* tp_as_buffer */
37         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
38         "ThicknessVariationPatternShader objects", /* tp_doc */
39         0,                              /* tp_traverse */
40         0,                              /* tp_clear */
41         0,                              /* tp_richcompare */
42         0,                              /* tp_weaklistoffset */
43         0,                              /* tp_iter */
44         0,                              /* tp_iternext */
45         0,                              /* tp_methods */
46         0,                              /* tp_members */
47         0,                              /* tp_getset */
48         &StrokeShader_Type,             /* tp_base */
49         0,                              /* tp_dict */
50         0,                              /* tp_descr_get */
51         0,                              /* tp_descr_set */
52         0,                              /* tp_dictoffset */
53         (initproc)ThicknessVariationPatternShader___init__, /* tp_init */
54         0,                              /* tp_alloc */
55         0,                              /* tp_new */
56 };
57
58 //------------------------INSTANCE METHODS ----------------------------------
59
60 int ThicknessVariationPatternShader___init__( BPy_ThicknessVariationPatternShader* self, PyObject *args)
61 {
62         const char *s1;
63         float f2 = 1.0, f3 = 5.0;
64         PyObject *obj4 = 0;
65
66         if(!( PyArg_ParseTuple(args, "s|ffO", &s1, &f2, &f3, &obj4) ))
67                 return -1;
68
69         bool b = (obj4) ? bool_from_PyBool(obj4) : true;
70         self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b);
71         return 0;
72 }
73
74 ///////////////////////////////////////////////////////////////////////////////////////////
75
76 #ifdef __cplusplus
77 }
78 #endif