Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-03-14 16:20:06 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-03-14 16:20:06 +0300
commitf38183d6b4b28828d71a6739dd5141effd43a375 (patch)
treead06d4c787e952496a2c417b079feba7c78236f8 /source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
parent52e289ee3bfdeb063a3099c0a805a0294044af47 (diff)
Fixed the subclassing of int to define the IntegrationType type.
Also changed the type of integration type constants from int to IntegrationType.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_IntegrationType.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_IntegrationType.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
index 9c21557da3d..67c2e53a7cb 100644
--- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
+++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
@@ -82,7 +82,7 @@ PyTypeObject IntegrationType_Type = {
NULL, /* descrgetfunc tp_descr_get; */
NULL, /* descrsetfunc tp_descr_set; */
0, /* long tp_dictoffset; */
- (initproc)IntegrationType___init__, /* initproc tp_init; */
+ NULL, /* initproc tp_init; */
NULL, /* allocfunc tp_alloc; */
PyType_GenericNew, /* newfunc tp_new; */
@@ -101,6 +101,18 @@ PyTypeObject IntegrationType_Type = {
NULL
};
+static PyObject *
+BPy_IntegrationType_FromIntegrationType(IntegrationType t)
+{
+ BPy_IntegrationType *obj;
+
+ obj = PyObject_New(BPy_IntegrationType, &IntegrationType_Type);
+ if (!obj)
+ return NULL;
+ ((PyIntObject *)obj)->ob_ival = (long)t;
+ return (PyObject *)obj;
+}
+
//-------------------MODULE INITIALIZATION--------------------------------
PyMODINIT_FUNC IntegrationType_Init( PyObject *module )
{
@@ -114,37 +126,29 @@ PyMODINIT_FUNC IntegrationType_Init( PyObject *module )
Py_INCREF( &IntegrationType_Type );
PyModule_AddObject(module, "IntegrationType", (PyObject *)&IntegrationType_Type);
- tmp = PyInt_FromLong( MEAN );
+ tmp = BPy_IntegrationType_FromIntegrationType( MEAN );
PyDict_SetItemString( IntegrationType_Type.tp_dict, "MEAN", tmp);
Py_DECREF(tmp);
- tmp = PyInt_FromLong( MIN );
+ tmp = BPy_IntegrationType_FromIntegrationType( MIN );
PyDict_SetItemString( IntegrationType_Type.tp_dict, "MIN", tmp);
Py_DECREF(tmp);
- tmp = PyInt_FromLong( MAX );
+ tmp = BPy_IntegrationType_FromIntegrationType( MAX );
PyDict_SetItemString( IntegrationType_Type.tp_dict, "MAX", tmp);
Py_DECREF(tmp);
- tmp = PyInt_FromLong( FIRST );
+ tmp = BPy_IntegrationType_FromIntegrationType( FIRST );
PyDict_SetItemString( IntegrationType_Type.tp_dict, "FIRST", tmp);
Py_DECREF(tmp);
- tmp = PyInt_FromLong( LAST );
+ tmp = BPy_IntegrationType_FromIntegrationType( LAST );
PyDict_SetItemString( IntegrationType_Type.tp_dict, "LAST", tmp);
Py_DECREF(tmp);
}
-int IntegrationType___init__(BPy_IntegrationType *self, PyObject *args, PyObject *kwds)
-{
- if (PyInt_Type.tp_init((PyObject *)self, args, kwds) < 0)
- return -1;
-
- return 0;
-}
-
///////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus