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-09-27 04:32:20 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-09-27 04:32:20 +0400
commit069d21dddfef3361068afa987cc618f8fdaf48c3 (patch)
tree60770a4941397178ea254c32f4f1622043b829c8 /source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
parent1ed4d4cbfbd3bf4768935b454afba88eb42ea14e (diff)
Made the Freestyle Python API compatible with Python 3.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
index 94254084400..43db0f0eb29 100644
--- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
@@ -22,7 +22,7 @@ static PyObject * ContextFunctions_GetSelectedFEdgeCF( PyObject *self );
/*-----------------------ContextFunctions module docstring-------------------------------*/
-static char module_docstring[] = "The Blender.Freestyle.ContextFunctions submodule";
+static char module_docstring[] = "The Blender Freestyle.ContextFunctions submodule\n\n";
/*-----------------------ContextFunctions module functions definitions-------------------*/
@@ -38,18 +38,28 @@ static PyMethodDef module_functions[] = {
{NULL, NULL, 0, NULL}
};
+/*-----------------------ContextFunctions module definition--------------------------------*/
+
+static PyModuleDef module_definition = {
+ PyModuleDef_HEAD_INIT,
+ "Freestyle.ContextFunctions",
+ module_docstring,
+ -1,
+ module_functions
+};
+
//------------------- MODULE INITIALIZATION --------------------------------
-void ContextFunctions_Init( PyObject *module )
+int ContextFunctions_Init( PyObject *module )
{
PyObject *m, *d, *f;
if( module == NULL )
- return;
+ return -1;
- m = Py_InitModule3("Blender.Freestyle.ContextFunctions", module_functions, module_docstring);
+ m = PyModule_Create(&module_definition);
if (m == NULL)
- return;
+ return -1;
Py_INCREF(m);
PyModule_AddObject(module, "ContextFunctions", m);
@@ -60,6 +70,8 @@ void ContextFunctions_Init( PyObject *module )
Py_INCREF(f);
PyModule_AddObject(module, p->ml_name, f);
}
+
+ return 0;
}
//------------------------ MODULE FUNCTIONS ----------------------------------
@@ -67,19 +79,19 @@ void ContextFunctions_Init( PyObject *module )
static PyObject *
ContextFunctions_GetTimeStampCF( PyObject* self )
{
- return PyInt_FromLong( ContextFunctions::GetTimeStampCF() );
+ return PyLong_FromLong( ContextFunctions::GetTimeStampCF() );
}
static PyObject *
ContextFunctions_GetCanvasWidthCF( PyObject* self )
{
- return PyInt_FromLong( ContextFunctions::GetCanvasWidthCF() );
+ return PyLong_FromLong( ContextFunctions::GetCanvasWidthCF() );
}
static PyObject *
ContextFunctions_GetCanvasHeightCF( PyObject* self )
{
- return PyInt_FromLong( ContextFunctions::GetCanvasHeightCF() );
+ return PyLong_FromLong( ContextFunctions::GetCanvasHeightCF() );
}
static PyObject *