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