Made the Freestyle Python API compatible with Python 3.
[blender.git] / source / blender / freestyle / intern / python / BPy_UnaryFunction1D.cpp
1 #include "BPy_UnaryFunction1D.h"
2
3 #include "UnaryFunction1D/BPy_UnaryFunction1DDouble.h"
4 #include "UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h"
5 #include "UnaryFunction1D/BPy_UnaryFunction1DFloat.h"
6 #include "UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h"
7 #include "UnaryFunction1D/BPy_UnaryFunction1DVec2f.h"
8 #include "UnaryFunction1D/BPy_UnaryFunction1DVec3f.h"
9 #include "UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h"
10 #include "UnaryFunction1D/BPy_UnaryFunction1DVoid.h"
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 ///////////////////////////////////////////////////////////////////////////////////////////
17
18 /*---------------  Python API function prototypes for UnaryFunction1D instance  -----------*/
19
20 static void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D *self);
21 static PyObject * UnaryFunction1D___repr__(BPy_UnaryFunction1D *self);
22
23 /*-----------------------BPy_UnaryFunction1D type definition ------------------------------*/
24
25 PyTypeObject UnaryFunction1D_Type = {
26         PyVarObject_HEAD_INIT(NULL, 0)
27         "UnaryFunction1D",              /* tp_name */
28         sizeof(BPy_UnaryFunction1D),    /* tp_basicsize */
29         0,                              /* tp_itemsize */
30         (destructor)UnaryFunction1D___dealloc__, /* tp_dealloc */
31         0,                              /* tp_print */
32         0,                              /* tp_getattr */
33         0,                              /* tp_setattr */
34         0,                              /* tp_reserved */
35         (reprfunc)UnaryFunction1D___repr__, /* tp_repr */
36         0,                              /* tp_as_number */
37         0,                              /* tp_as_sequence */
38         0,                              /* tp_as_mapping */
39         0,                              /* tp_hash  */
40         0,                              /* tp_call */
41         0,                              /* tp_str */
42         0,                              /* tp_getattro */
43         0,                              /* tp_setattro */
44         0,                              /* tp_as_buffer */
45         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
46         "UnaryFunction1D objects",      /* tp_doc */
47         0,                              /* tp_traverse */
48         0,                              /* tp_clear */
49         0,                              /* tp_richcompare */
50         0,                              /* tp_weaklistoffset */
51         0,                              /* tp_iter */
52         0,                              /* tp_iternext */
53         0,                              /* tp_methods */
54         0,                              /* tp_members */
55         0,                              /* tp_getset */
56         0,                              /* tp_base */
57         0,                              /* tp_dict */
58         0,                              /* tp_descr_get */
59         0,                              /* tp_descr_set */
60         0,                              /* tp_dictoffset */
61         0,                              /* tp_init */
62         0,                              /* tp_alloc */
63         PyType_GenericNew,              /* tp_new */
64 };
65
66 //-------------------MODULE INITIALIZATION--------------------------------
67 int UnaryFunction1D_Init( PyObject *module )
68 {
69         if( module == NULL )
70                 return -1;
71
72         if( PyType_Ready( &UnaryFunction1D_Type ) < 0 )
73                 return -1;
74         Py_INCREF( &UnaryFunction1D_Type );
75         PyModule_AddObject(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type);
76
77         UnaryFunction1DDouble_Init( module );
78         UnaryFunction1DEdgeNature_Init( module );
79         UnaryFunction1DFloat_Init( module );
80         UnaryFunction1DUnsigned_Init( module );
81         UnaryFunction1DVec2f_Init( module );
82         UnaryFunction1DVec3f_Init( module );
83         UnaryFunction1DVectorViewShape_Init( module );
84         UnaryFunction1DVoid_Init( module );
85         return 0;
86 }
87
88 //------------------------INSTANCE METHODS ----------------------------------
89
90 void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D* self)
91 {
92     Py_TYPE(self)->tp_free((PyObject*)self);
93 }
94
95
96 PyObject * UnaryFunction1D___repr__(BPy_UnaryFunction1D* self)
97 {
98     return PyUnicode_FromFormat("UnaryFunction1D");
99 }
100
101 ///////////////////////////////////////////////////////////////////////////////////////////
102
103 #ifdef __cplusplus
104 }
105 #endif