ifdef's for future py3 support, after this adding py3 can mostly be done with defines...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 29 Apr 2009 16:54:45 +0000 (16:54 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 29 Apr 2009 16:54:45 +0000 (16:54 +0000)
.
No changes for py2.x.

77 files changed:
source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Expressions/InputParser.cpp
source/gameengine/Expressions/ListValue.cpp
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/Value.cpp
source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
source/gameengine/GameLogic/SCA_ANDController.cpp
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
source/gameengine/GameLogic/SCA_DelaySensor.cpp
source/gameengine/GameLogic/SCA_ILogicBrick.cpp
source/gameengine/GameLogic/SCA_IObject.cpp
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_NANDController.cpp
source/gameengine/GameLogic/SCA_NORController.cpp
source/gameengine/GameLogic/SCA_ORController.cpp
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/GameLogic/SCA_XNORController.cpp
source/gameengine/GameLogic/SCA_XORController.cpp
source/gameengine/Ketsji/BL_Shader.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_CDActuator.cpp
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_ConstraintActuator.cpp
source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
source/gameengine/Ketsji/KX_GameActuator.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
source/gameengine/Ketsji/KX_NearSensor.cpp
source/gameengine/Ketsji/KX_ObjectActuator.cpp
source/gameengine/Ketsji/KX_ParentActuator.cpp
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_RadarSensor.cpp
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/Ketsji/KX_SoundActuator.cpp
source/gameengine/Ketsji/KX_StateActuator.cpp
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Ketsji/KX_VehicleWrapper.cpp
source/gameengine/Ketsji/KX_VertexProxy.cpp
source/gameengine/Ketsji/KX_VisibilityActuator.cpp
source/gameengine/VideoTexture/FilterBlueScreen.cpp
source/gameengine/VideoTexture/FilterColor.cpp
source/gameengine/VideoTexture/FilterNormal.cpp
source/gameengine/VideoTexture/FilterSource.cpp
source/gameengine/VideoTexture/ImageBuff.cpp
source/gameengine/VideoTexture/ImageMix.cpp
source/gameengine/VideoTexture/ImageRender.cpp
source/gameengine/VideoTexture/ImageViewport.cpp
source/gameengine/VideoTexture/Texture.cpp
source/gameengine/VideoTexture/VideoFFmpeg.cpp
source/gameengine/VideoTexture/blendVideoTex.cpp

index e393b6d9af4cb7d10e3b279f2ef25b99610218a4..0239027f2cb569de6c10a375cb400bceaeee5369 100644 (file)
@@ -268,6 +268,7 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat
                        // 'normal' object
                        glMultMatrixd(oglmatrix);
                }
+               glMultMatrixd(oglmatrix);
        }
 }
 
index 3ad55f5ee1232972040f5bbbfab2aeabab166564..ee97e325a8eb3779ba0a1fdcfc2d72ce488d7371 100644 (file)
@@ -942,8 +942,13 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
 /* ------------------------------------------------------------------------- */
 
 PyTypeObject BL_ActionActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "BL_ActionActuator",
                sizeof(PyObjectPlus_Proxy),
                0,
index 60d26b9a99f4811becfd5626efdd45d97cb777c9..5fea568dcb28ae1634ae36223f3787b4b1d060ca 100644 (file)
@@ -418,8 +418,13 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 /* Integration hooks ------------------------------------------------------- */
 
 PyTypeObject BL_ShapeActionActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "BL_ShapeActionActuator",
                sizeof(PyObjectPlus_Proxy),
                0,
index 834dff7af89b404379650776383a619894e78264..d45a9375dc7c6bf85e977cfbaac09d421ede14f7 100644 (file)
@@ -658,10 +658,29 @@ static PyMethodDef        CParserMethods[] =
        { NULL,NULL}    // Sentinel
 };
 
+
+#if (PY_VERSION_HEX >= 0x03000000)
+static struct PyModuleDef Expression_module_def = {
+       {}, /* m_base */
+       "Expression",  /* m_name */
+       0,  /* m_doc */
+       0,  /* m_size */
+       CParserMethods,  /* m_methods */
+       0,  /* m_reload */
+       0,  /* m_traverse */
+       0,  /* m_clear */
+       0,  /* m_free */
+};
+#endif
+
 extern "C" {
        void initExpressionModule(void)
        {
+#if (PY_VERSION_HEX >= 0x03000000)
+               PyModule_Create(&Expression_module_def);
+#else
                Py_InitModule("Expression",CParserMethods);
+#endif
        }
 }
 
index 3596128f12dadd6c26f536970825d049e6ee9b76..fc6b929914674bdbad229287f620407ed2fc2a56 100644 (file)
@@ -212,9 +212,15 @@ static  PySequenceMethods listvalue_as_sequence = {
        listvalue_buffer_concat, /*sq_concat*/
        NULL, /*sq_repeat*/
        listvalue_buffer_item, /*sq_item*/
+#if (PY_VERSION_HEX >= 0x03000000) // TODO, slicing in py3?
+       NULL,
+       NULL,
+       NULL,
+#else
        listvalue_buffer_slice, /*sq_slice*/
-       NULL, /*sq_ass_item*/
-       NULL /*sq_ass_slice*/
+       (ssizeobjargproc)NULL, /*sq_ass_item*/
+       NULL, /*sq_ass_slice*/
+#endif
 };
 
 
@@ -229,8 +235,13 @@ static  PyMappingMethods instance_as_mapping = {
 
 
 PyTypeObject CListValue::Type = {
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                              /*ob_size*/
+#endif
        "CListValue",                   /*tp_name*/
        sizeof(PyObjectPlus_Proxy), /*tp_basicsize*/
        0,                              /*tp_itemsize*/
index 8bd34cdc73bbe12292b2da878c0760a75913e208..e6b49332273e5dfe1fe379d3a9c34b0a5797cdaf 100644 (file)
 
 
 PyTypeObject PyObjectPlus::Type = {
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                              /*ob_size*/
+#endif
        "PyObjectPlus",                 /*tp_name*/
        sizeof(PyObjectPlus_Proxy),             /*tp_basicsize*/
        0,                              /*tp_itemsize*/
index 088b5cb98a4e915254c435330c1b08629142459b..fbd86cc40229dc32fea4b2de78db34d2ce54f463 100644 (file)
@@ -36,8 +36,13 @@ double CValue::m_sZeroVec[3] = {0.0,0.0,0.0};
 #ifndef NO_EXP_PYTHON_EMBEDDING
 
 PyTypeObject CValue::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "CValue",
        sizeof(PyObjectPlus_Proxy),
        0,
@@ -751,10 +756,28 @@ PyObject* CValue::PyMake(PyObject* ignored,PyObject* args)
 }
 */
 
+#if (PY_VERSION_HEX >= 0x03000000)
+static struct PyModuleDef CValue_module_def = {
+       {}, /* m_base */
+       "CValue",  /* m_name */
+       0,  /* m_doc */
+       0,  /* m_size */
+       CValueMethods,  /* m_methods */
+       0,  /* m_reload */
+       0,  /* m_traverse */
+       0,  /* m_clear */
+       0,  /* m_free */
+};
+#endif
+
 extern "C" {
        void initCValue(void)
        {
+#if (PY_VERSION_HEX >= 0x03000000)
+               PyModule_Create(&CValue_module_def);
+#else
                Py_InitModule("CValue",CValueMethods);
+#endif
        }
 }
 
index ed83458741408170207ed90f38b5bee15c18ca3a..fb72eefb4a4072d320a4907856a74ce76d5d843d 100644 (file)
@@ -108,8 +108,13 @@ void SCA_2DFilterActuator::SetShaderText(STR_String text)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_2DFilterActuator::Type = {
-        PyObject_HEAD_INIT(NULL)
-        0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
         "SCA_2DFilterActuator",
         sizeof(PyObjectPlus_Proxy),
         0,
index ed2372200e9f6f6454d0a043519cc100be98b97e..1b151cbe615d61096652445364b16ae8003bb71f 100644 (file)
@@ -107,8 +107,13 @@ CValue* SCA_ANDController::GetReplica()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_ANDController::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_ANDController",
        sizeof(PyObjectPlus_Proxy),
        0,
index 928060d7394b38b5aab032425c3ec7ff6c858304..464797fd776b8422ae168cfdce28b29ddbb376f5 100644 (file)
@@ -122,8 +122,13 @@ void SCA_ActuatorSensor::Update()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_ActuatorSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_ActuatorSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 941f3b55b446c0360b7a4371bb4f4beb6468cdb9..19d19b6e0be08ec537b75bf58886ae50ac127e55 100644 (file)
@@ -105,8 +105,13 @@ bool SCA_AlwaysSensor::Evaluate(CValue* event)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_AlwaysSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_AlwaysSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 15e805a657c1bafae4ceb8694ba52d2481faaa18..4752d0eb3452258c900a2cfc6193cfd5eb7f572c 100644 (file)
@@ -131,8 +131,13 @@ bool SCA_DelaySensor::Evaluate(CValue* event)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_DelaySensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_DelaySensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 8439dbac26809a7e1b157e14139aa45589e9faf2..84babda1d7a68e2cb512f40d3c7b2a16729b3838 100644 (file)
@@ -209,8 +209,13 @@ CValue* SCA_ILogicBrick::GetEvent()
 /* python stuff */
 
 PyTypeObject SCA_ILogicBrick::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_ILogicBrick",
        sizeof(PyObjectPlus_Proxy),
        0,
index 8e599e6411ac534bb2ed9174707badc996407ffe..b3c4708978dc8bff612132bd9b9ef27ebc3828e4 100644 (file)
@@ -375,8 +375,13 @@ void SCA_IObject::SetState(unsigned int state)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_IObject::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_IObject",
        sizeof(PyObjectPlus_Proxy),
        0,
index b556c14831ebc37bca1a4224642d6c0f54df1c1d..4d69216ed0bbb0cf1a79b3e6300b7dee75868467 100644 (file)
@@ -393,8 +393,13 @@ KX_PYMETHODDEF_DOC_NOARGS(SCA_ISensor, reset,
 /* ----------------------------------------------- */
 
 PyTypeObject SCA_ISensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_ISensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index b9d991772594ed2b60b84b5a5f53d6ee0a8df0f1..34d63a4ee2bb79b0ff0206f73e4f496b2bb2209c 100644 (file)
@@ -266,8 +266,13 @@ bool SCA_JoystickSensor::isValid(SCA_JoystickSensor::KX_JOYSENSORMODE m)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_JoystickSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "SCA_JoystickSensor",
                sizeof(PyObjectPlus_Proxy),
                0,
index 5dcdb2227137e17c2aed3d9542b6f2801f213c7b..821d2155d2a9736f67a0578ca9a9a2788d8f1fbe 100644 (file)
@@ -612,8 +612,13 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
 /* ------------------------------------------------------------------------- */
 
 PyTypeObject SCA_KeyboardSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_KeyboardSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 65942327e6847035476921cce376492b99cef1d4..46be6ad9e166e5131a1a4b8bc40e53620fffd5bd 100644 (file)
@@ -296,8 +296,13 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
 /* ------------------------------------------------------------------------- */
 
 PyTypeObject SCA_MouseSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_MouseSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index ab5c39dc0397c8d697e9b38492887784270c40df..4643a42a4be6ce08512330f82a93f9621be5fb26 100644 (file)
@@ -107,8 +107,13 @@ CValue* SCA_NANDController::GetReplica()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_NANDController::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_NANDController",
        sizeof(PyObjectPlus_Proxy),
        0,
index 918e6a348ae716509a549b7e284b176cd218e01a..a0e9fcb239c7dd3d34bf3336e87c5afd98e53faf 100644 (file)
@@ -107,8 +107,13 @@ CValue* SCA_NORController::GetReplica()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_NORController::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_NORController",
        sizeof(PyObjectPlus_Proxy),
        0,
index 034c3ee29cdd501898ef90966ce4d45339b84ce4..87e6d19d008f99b0e3f9226f75d757b68628ce03 100644 (file)
@@ -99,8 +99,13 @@ void SCA_ORController::Trigger(SCA_LogicManager* logicmgr)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_ORController::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_ORController",
        sizeof(PyObjectPlus_Proxy),
        0,
index f3ca63066c9368360ec216d61a289b65e18a9efd..33dc83506f38eaf1e9f846f87e45bc9f0f16a593 100644 (file)
@@ -228,8 +228,13 @@ void SCA_PropertyActuator::Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_PropertyActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_PropertyActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 7953698c6ef82a81665a0a2b283e9fcb9031a12b..c78283db423a654c91b3ce7a65b908fc72365d9a 100644 (file)
@@ -306,8 +306,13 @@ int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_PropertySensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_PropertySensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index b9f8dde89bfa9e8deb3f60cc48f1219e0fa91684..33207950697f1fe999fbe5f06f23e1741d22614e 100644 (file)
@@ -223,8 +223,13 @@ const char* SCA_PythonController::sPyAddActiveActuator__doc__= "addActiveActuato
 const char SCA_PythonController::GetActuators_doc[] = "getActuator";
 
 PyTypeObject SCA_PythonController::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "SCA_PythonController",
                sizeof(PyObjectPlus_Proxy),
                0,
index 91110425f7f959ac780ff4fc2794149c942e1f2d..2db871c77cfd2b0cdaf2f024629161e5652e4fb8 100644 (file)
@@ -310,8 +310,13 @@ void SCA_RandomActuator::enforceConstraints() {
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_RandomActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_RandomActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 70a23124929f3a174a38094b0c7df767b9f8e534..5c109bac0241eb3eac83ca2804bf918ee2ab7c62 100644 (file)
@@ -127,8 +127,13 @@ bool SCA_RandomSensor::Evaluate(CValue* event)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_RandomSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_RandomSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 13d50100d6cca506bf198af3dd9afd2f0613dcfc..947e8b7a68a7a28f76b6a0f4299840163e3595c6 100644 (file)
@@ -111,8 +111,13 @@ CValue* SCA_XNORController::GetReplica()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_XNORController::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_XNORController",
        sizeof(PyObjectPlus_Proxy),
        0,
index 6613742a080bfb6e784cfda3d713cf6af286578b..d9e41c2b27e3e41601bc4cacb2e3cc2206382fff 100644 (file)
@@ -111,8 +111,13 @@ CValue* SCA_XORController::GetReplica()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject SCA_XORController::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_XORController",
        sizeof(PyObjectPlus_Proxy),
        0,
index 2b3612ec3ae7e85d08acf0e17d173e2afd83ee57..c5c517c8a65390e35114a1d93e770f9c171338ec 100644 (file)
@@ -776,8 +776,13 @@ PyAttributeDef BL_Shader::Attributes[] = {
 };
 
 PyTypeObject BL_Shader::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "BL_Shader",
                sizeof(PyObjectPlus_Proxy),
                0,
index 712f64d5f8fcd52c39e7da046183a028a12ecb0f..7f21c490e6761c022b7f5026344c310e5dc07919 100644 (file)
@@ -102,8 +102,13 @@ CValue* KX_NetworkMessageActuator::GetReplica()
 
 /* Integration hooks -------------------------------------------------- */
 PyTypeObject KX_NetworkMessageActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_NetworkMessageActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index d770465e1ea0f079923ced701321c70e056c3133..82e2437064b983df357ab14bbf3e4484f415cef0 100644 (file)
@@ -166,8 +166,13 @@ bool KX_NetworkMessageSensor::IsPositiveTrigger()
 
 /* Integration hooks --------------------------------------------------- */
 PyTypeObject KX_NetworkMessageSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_NetworkMessageSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 70907db608aced36f91647b8437ea6381dd5976d..5f08739ea14ae09d173f6e6a182dae050741a331 100644 (file)
@@ -788,8 +788,13 @@ PyAttributeDef KX_BlenderMaterial::Attributes[] = {
 };
 
 PyTypeObject KX_BlenderMaterial::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_BlenderMaterial",
                sizeof(PyObjectPlus_Proxy),
                0,
index a0b2c73901fb20b7674d861d31669662aeb8a6a4..7f8505afa3d904842578348f6581315267f3ee36 100644 (file)
@@ -155,8 +155,13 @@ bool KX_CDActuator::Update()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_CDActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_SoundActuator",
                sizeof(PyObjectPlus_Proxy),
                0,
index bc2c2fc33b0cfb78c1ff7136274b58169c2f7b07..3ea01cca5cad40021573421df6d00060ec65a508 100644 (file)
@@ -512,8 +512,13 @@ PyAttributeDef KX_Camera::Attributes[] = {
 };
 
 PyTypeObject KX_Camera::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_Camera",
                sizeof(PyObjectPlus_Proxy),
                0,
index 38a68752958c6ccbee4b193cc563ccebcd2e5d08..e701a680511b9d1facafaf983e6d5d1a0232c963 100644 (file)
@@ -369,8 +369,13 @@ bool KX_CameraActuator::string2axischoice(const char *axisString)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_CameraActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_CameraActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 34102132db80cb6164eb68c61fa6a30941bab1a7..c9cb8e1b942ac111af256be21e0c6bc091aab7fa 100644 (file)
@@ -566,8 +566,13 @@ bool KX_ConstraintActuator::IsValidMode(KX_ConstraintActuator::KX_CONSTRAINTTYPE
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_ConstraintActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_ConstraintActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index cab42f08d2acfa67a68cf93e222b331d0d56bdfb..c63f9e57ed22d86b731cbfcea86ea500636e1e58 100644 (file)
@@ -56,8 +56,13 @@ PyObject* KX_ConstraintWrapper::PyGetConstraintId(PyObject* args, PyObject* kwds
 
 //python specific stuff
 PyTypeObject KX_ConstraintWrapper::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_ConstraintWrapper",
                sizeof(PyObjectPlus_Proxy),
                0,
index a46318d0468e78c4b7ce56a70d8e4f9e186943bd..48d7dcd84a29e8b7f09418c0b0c81e4aac52cd3f 100644 (file)
@@ -206,8 +206,13 @@ bool KX_GameActuator::Update()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_GameActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_GameActuator",
                sizeof(PyObjectPlus_Proxy),
                0,
index ed162238e8a69e98a5e1f0ea87e9874d5bd9dc58..20113afaae29e9399a6107679a93d6dafbe40f20 100644 (file)
@@ -1322,8 +1322,13 @@ PyMappingMethods KX_GameObject::Mapping = {
 };
 
 PyTypeObject KX_GameObject::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_GameObject",
                sizeof(PyObjectPlus_Proxy),
                0,
index df80085d9f2688fc6ae349e2f3afa8b2b2653888..efe01993b08947992dda47c782d2cf9bc45d9652 100644 (file)
@@ -413,8 +413,13 @@ int KX_IpoActuator::string2mode(char* modename) {
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_IpoActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_IpoActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 498eb7262b597c6049f95ecfe9b0bda39026d4c2..0f90bfd8a02a34ddd3f3acd68754259f81879e58 100644 (file)
@@ -179,8 +179,13 @@ PyObject* KX_LightObject::py_getattro_dict() {
 
 
 PyTypeObject KX_LightObject::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_LightObject",
                sizeof(PyObjectPlus_Proxy),
                0,
index 009364a3d7b1f21dbaa4a2a41b10e6ffca73159e..eede3a0e832140d3cfff83cf7267c199f0f5a0da 100644 (file)
 #include "PyObjectPlus.h" 
 
 PyTypeObject KX_MeshProxy::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_MeshProxy",
        sizeof(PyObjectPlus_Proxy),
        0,
index d141aa482c8c8209c87fc4784b898ef2724b80a4..9106902ca0ed8f5b1d45fa35d30a2f28f7f0afaf 100644 (file)
@@ -335,8 +335,13 @@ const MT_Vector3& KX_MouseFocusSensor::HitNormal() const
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_MouseFocusSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_MouseFocusSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 2f1a3af78fa31af01086ea49745fadfe6162854a..e7f05555b64b7485df58f9648ba61f5f8fa6fd32 100644 (file)
@@ -269,8 +269,13 @@ bool       KX_NearSensor::NewHandleCollision(void* obj1,void* obj2,const PHY_CollData
 /* ------------------------------------------------------------------------- */
 
 PyTypeObject KX_NearSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_NearSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 86ae082523f3d91f4801ed46d9eb5def782953ac..e3d7a0f4b7127c9f93f630d563bb05016853812a 100644 (file)
@@ -274,8 +274,13 @@ bool KX_ObjectActuator::isValid(KX_ObjectActuator::KX_OBJECT_ACT_VEC_TYPE type)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_ObjectActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_ObjectActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index ffd7185f2354246778ee2bc300be61c535d02f73..37d2e50cdb67b877336bfb12e42e10e0e58808d0 100644 (file)
@@ -137,8 +137,13 @@ bool KX_ParentActuator::Update()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_ParentActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_ParentActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index c0c15b5599c0586f46a03643537814cc6f3b99eb..c968e50957e7c4602f108432598e87dde115653a 100644 (file)
@@ -113,8 +113,13 @@ PyAttributeDef KX_PhysicsObjectWrapper::Attributes[] = {
 
 //python specific stuff
 PyTypeObject KX_PhysicsObjectWrapper::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_PhysicsObjectWrapper",
                sizeof(PyObjectPlus_Proxy),
                0,
index 33e215387b78227e7ee25cd4dc980f3e01946c0d..ca38117a9e73142604fb451d62d5c1a871907b0a 100644 (file)
 #include "KX_PyMath.h"
 
 PyTypeObject KX_PolyProxy::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_PolyProxy",
        sizeof(PyObjectPlus_Proxy),
        0,
index a39ff4866896e268e6b21bcd3c1f42de41df57cc..918c251599eddf860eaed9d9f734e2af47018866 100644 (file)
@@ -234,8 +234,13 @@ PyAttributeDef KX_PolygonMaterial::Attributes[] = {
 };
 
 PyTypeObject KX_PolygonMaterial::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_PolygonMaterial",
                sizeof(PyObjectPlus_Proxy),
                0,
index 2c65c184a9c0a29552ba5569795e4870a6403c8a..e801e9c58587cfb29f65028335882b0a10c1e4c8 100644 (file)
@@ -565,6 +565,19 @@ static struct PyMethodDef physicsconstraints_methods[] = {
 };
 
 
+#if (PY_VERSION_HEX >= 0x03000000)
+static struct PyModuleDef PhysicsConstraints_module_def = {
+       {}, /* m_base */
+       "PhysicsConstraints",  /* m_name */
+       PhysicsConstraints_module_documentation,  /* m_doc */
+       0,  /* m_size */
+       physicsconstraints_methods,  /* m_methods */
+       0,  /* m_reload */
+       0,  /* m_traverse */
+       0,  /* m_clear */
+       0,  /* m_free */
+};
+#endif
 
 PyObject*      initPythonConstraintBinding()
 {
@@ -573,10 +586,13 @@ PyObject* initPythonConstraintBinding()
   PyObject* m;
   PyObject* d;
 
-
+#if (PY_VERSION_HEX >= 0x03000000)
+  m = PyModule_Create(&PhysicsConstraints_module_def);
+#else
   m = Py_InitModule4("PhysicsConstraints", physicsconstraints_methods,
                     PhysicsConstraints_module_documentation,
                     (PyObject*)NULL,PYTHON_API_VERSION);
+#endif
 
   // Add some symbolic constants to the module
   d = PyModule_GetDict(m);
index f82110c2bd25ccd92e8c86ee9374163d1c3a16d4..22e092e8277964f944c4b1ed8b5f6a72ea40a5e0 100644 (file)
@@ -1073,7 +1073,19 @@ static char Rasterizer_module_documentation[] =
 "This is the Python API for the game engine of Rasterizer"
 ;
 
-
+#if (PY_VERSION_HEX >= 0x03000000)
+static struct PyModuleDef GameLogic_module_def = {
+       {}, /* m_base */
+       "GameLogic",  /* m_name */
+       GameLogic_module_documentation,  /* m_doc */
+       0,  /* m_size */
+       game_methods,  /* m_methods */
+       0,  /* m_reload */
+       0,  /* m_traverse */
+       0,  /* m_clear */
+       0,  /* m_free */
+};
+#endif
 
 PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack to get gravity hook
 {
@@ -1087,9 +1099,14 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
        gUseVisibilityTemp=false;
 
        // Create the module and add the functions
+       
+#if (PY_VERSION_HEX >= 0x03000000)
+       m = PyModule_Create(&GameLogic_module_def);
+#else
        m = Py_InitModule4("GameLogic", game_methods,
                                           GameLogic_module_documentation,
                                           (PyObject*)NULL,PYTHON_API_VERSION);
+#endif
 
        // Add some symbolic constants to the module
        d = PyModule_GetDict(m);
@@ -1498,15 +1515,18 @@ void setSandbox(TPythonSecurityLevel level)
  */
 PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, Main *maggie, int argc, char** argv)
 {
+#if (PY_VERSION_HEX < 0x03000000)
        STR_String pname = progname;
        Py_SetProgramName(pname.Ptr());
+#endif
        Py_NoSiteFlag=1;
        Py_FrozenFlag=1;
        Py_Initialize();
        
+#if (PY_VERSION_HEX < 0x03000000)      
        if(argv) /* browser plugins dont currently set this */
                PySys_SetArgv(argc, argv);
-       
+#endif
        //importBlenderModules()
        
        setSandbox(level);
@@ -1530,8 +1550,10 @@ void exitGamePlayerPythonScripting()
  */
 PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level, Main *maggie)
 {
+#if (PY_VERSION_HEX < 0x03000000)
        STR_String pname = progname;
        Py_SetProgramName(pname.Ptr());
+#endif
        Py_NoSiteFlag=1;
        Py_FrozenFlag=1;
 
@@ -1587,6 +1609,19 @@ void exitGamePythonScripting()
 }
 
 
+#if (PY_VERSION_HEX >= 0x03000000)
+static struct PyModuleDef Rasterizer_module_def = {
+       {}, /* m_base */
+       "Rasterizer",  /* m_name */
+       Rasterizer_module_documentation,  /* m_doc */
+       0,  /* m_size */
+       rasterizer_methods,  /* m_methods */
+       0,  /* m_reload */
+       0,  /* m_traverse */
+       0,  /* m_clear */
+       0,  /* m_free */
+};
+#endif
 
 PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
 {
@@ -1599,9 +1634,13 @@ PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
   PyObject* item;
 
   // Create the module and add the functions
+#if (PY_VERSION_HEX >= 0x03000000)
+  m = PyModule_Create(&Rasterizer_module_def);
+#else
   m = Py_InitModule4("Rasterizer", rasterizer_methods,
                     Rasterizer_module_documentation,
                     (PyObject*)NULL,PYTHON_API_VERSION);
+#endif
 
   // Add some symbolic constants to the module
   d = PyModule_GetDict(m);
@@ -1651,7 +1690,12 @@ static PyObject* gPyEventToString(PyObject*, PyObject* value)
        dict = PyModule_GetDict(mod);
        
        while (PyDict_Next(dict, &pos, &key, &val)) {
+#if (PY_VERSION_HEX >= 0x03000000)
+               if (PyObject_RichCompareBool(value, val, Py_EQ)) {
+#else
                if (PyObject_Compare(value, val)==0) {
+#endif
+                       
                        ret = key;
                        break;
                }
@@ -1693,6 +1737,19 @@ static struct PyMethodDef gamekeys_methods[] = {
 };
 
 
+#if (PY_VERSION_HEX >= 0x03000000)
+static struct PyModuleDef GameKeys_module_def = {
+       {}, /* m_base */
+       "GameKeys",  /* m_name */
+       GameKeys_module_documentation,  /* m_doc */
+       0,  /* m_size */
+       gamekeys_methods,  /* m_methods */
+       0,  /* m_reload */
+       0,  /* m_traverse */
+       0,  /* m_clear */
+       0,  /* m_free */
+};
+#endif
 
 PyObject* initGameKeys()
 {
@@ -1701,9 +1758,13 @@ PyObject* initGameKeys()
        PyObject* item;
 
        // Create the module and add the functions
+#if (PY_VERSION_HEX >= 0x03000000)
+       m = PyModule_Create(&GameKeys_module_def);
+#else
        m = Py_InitModule4("GameKeys", gamekeys_methods,
                                           GameKeys_module_documentation,
                                           (PyObject*)NULL,PYTHON_API_VERSION);
+#endif
 
        // Add some symbolic constants to the module
        d = PyModule_GetDict(m);
index bf4b0f67e034564b03b19d5b1ee897da7dec98fd..1959dd5204659500cb3bf5f75fa5c64e7214e86c 100644 (file)
@@ -232,8 +232,13 @@ PyObject* KX_RadarSensor::PyGetConeHeight() {
 /* Python Integration Hooks                                                  */
 /* ------------------------------------------------------------------------- */
 PyTypeObject KX_RadarSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_RadarSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index ea9356a49d12ac506cb20432a21bc487f49b1574..43d8806fc68f51b2797202f1594e8d7cd95e9a18 100644 (file)
@@ -320,8 +320,13 @@ bool KX_RaySensor::Evaluate(CValue* event)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_RaySensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_RaySensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index dd9d63f5cd94c482815308aa8e777dfa77107970..2fd786e44e3605ebd1808b24eab9cfa02dadf154 100644 (file)
@@ -166,8 +166,13 @@ void KX_SCA_AddObjectActuator::Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_SCA_AddObjectActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_SCA_AddObjectActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 4bc42686d78cac6d0af05684f205527f76de9b0c..af5631b44032c2c4a898829740e0b09e58de7ece 100644 (file)
        PyTypeObject 
 
 KX_SCA_DynamicActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_SCA_DynamicActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index a0b411dd3a9a1cf62b84756f9439dafd8b576e6d..728254e7f48bc2d133494b6289ce324400dfd47a 100644 (file)
@@ -92,8 +92,13 @@ CValue* KX_SCA_EndObjectActuator::GetReplica()
 /* ------------------------------------------------------------------------- */
 
 PyTypeObject KX_SCA_EndObjectActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_SCA_EndObjectActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 8b87253d0a3140e2aa4dcfbeba047b5ce5baa70f..730d1ed49e64bce5abaf9c9c01a1bd81da38fa00 100644 (file)
        PyTypeObject 
 
 KX_SCA_ReplaceMeshActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_SCA_ReplaceMeshActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 1c1cc881d1701cd663bff9bd485d340901896a78..fd24403772287d6df71e2ac5e473927d4eb3cb3b 100644 (file)
@@ -1595,8 +1595,13 @@ double KX_Scene::getSuspendedDelta()
 //Python
 
 PyTypeObject KX_Scene::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_Scene",
                sizeof(PyObjectPlus_Proxy),
                0,
index 4447ff48766c3215a5e065c23905e6e8bca02697..1cce93fbcc5a3eaa847562c2b605e2f22b4e5a00 100644 (file)
@@ -223,8 +223,13 @@ KX_Scene* KX_SceneActuator::FindScene(char * sceneName)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_SceneActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_SceneActuator",
                sizeof(PyObjectPlus_Proxy),
                0,
index db3d92ffd795194e5ee78d46351c300f24ffb1cd..15eb354ee791d1323707d1b0931b81de1c069072 100644 (file)
@@ -232,8 +232,13 @@ void KX_SoundActuator::setSoundObject(class SND_SoundObject* soundobject)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_SoundActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_SoundActuator",
                sizeof(PyObjectPlus_Proxy),
                0,
index 71ffa16cb5496343d8e3764e578a5920e45bf048..2cbb42b3311b6a39389951aecf1f2cf18bd840cf 100644 (file)
@@ -107,8 +107,13 @@ KX_StateActuator::Update()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_StateActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_StateActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 2addfc31ff3abff135e64ee2e1737658e60002f2..f000c16041a79eefdfef4e77a90e05241c73e801 100644 (file)
@@ -246,8 +246,13 @@ bool       KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_Coll
 /* ------------------------------------------------------------------------- */
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_TouchSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_TouchSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
index 808bf0a55b56a330a16b4367921fec30211e1946..672b9e739bafe25d96bf52779a3ee73a4a53d336 100644 (file)
@@ -425,8 +425,13 @@ bool KX_TrackToActuator::Update(double curtime, bool frame)
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_TrackToActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_TrackToActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 5a0ec3515f6b7332b40fa38319b1fc94814d7987..e43a5caa50af21eaa0975d72441fd7c8df19a050 100644 (file)
@@ -273,8 +273,13 @@ PyObject* KX_VehicleWrapper::PyGetConstraintType(PyObject* args)
 
 //python specific stuff
 PyTypeObject KX_VehicleWrapper::Type = {
-       PyObject_HEAD_INIT(NULL)
-               0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
                "KX_VehicleWrapper",
                sizeof(PyObjectPlus_Proxy),
                0,
index 629fadff86a12a46b89eedc374e95787c9bceb62..93ff35b5a9dc1082dbcde52e3ba007e2e674ad2b 100644 (file)
 #include "KX_PyMath.h"
 
 PyTypeObject KX_VertexProxy::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_VertexProxy",
        sizeof(PyObjectPlus_Proxy),
        0,
index ed12a88ad6ad6afc0c83fd515132f5569e5987ef..46a1db9378a192fe748b6cb1ae38d333b7f12d2c 100644 (file)
@@ -92,8 +92,13 @@ KX_VisibilityActuator::Update()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_VisibilityActuator::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "KX_VisibilityActuator",
        sizeof(PyObjectPlus_Proxy),
        0,
index 43d7566102a550792825a5f6e330f0e247c4631b..6b23105a2782a828e15d21cd47b3d6dac552b9c5 100644 (file)
@@ -135,8 +135,13 @@ static PyGetSetDef filterBSGetSets[] =
 // define python type
 PyTypeObject FilterBlueScreenType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.FilterBlueScreen",   /*tp_name*/
        sizeof(PyFilter),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index 22ee729b200f7bb3fc8767146cea3ff1e5f476e3..5ff1f7f11cec276f9c59c561474e250db9fc5bcd 100644 (file)
@@ -41,8 +41,13 @@ static PyGetSetDef filterGrayGetSets[] =
 // define python type
 PyTypeObject FilterGrayType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.FilterGray",   /*tp_name*/
        sizeof(PyFilter),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
@@ -173,8 +178,13 @@ static PyGetSetDef filterColorGetSets[] =
 // define python type
 PyTypeObject FilterColorType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.FilterColor",   /*tp_name*/
        sizeof(PyFilter),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
@@ -307,8 +317,13 @@ static PyGetSetDef filterLevelGetSets[] =
 // define python type
 PyTypeObject FilterLevelType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.FilterLevel",   /*tp_name*/
        sizeof(PyFilter),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index a7266967efb34a2b8fac0e8c6670e8a47d8a2a40..9a2b1e90d5a4c9836964ddcb7baa70583c42fb3a 100644 (file)
@@ -124,8 +124,13 @@ static PyGetSetDef filterNormalGetSets[] =
 // define python type
 PyTypeObject FilterNormalType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.FilterNormal",   /*tp_name*/
        sizeof(PyFilter),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index f3676e93a6d6665ec6aa849c176e7cd6a5d4bfbd..4c75e14bbac1fc7b21a640cd0a3f7a74744f7928 100644 (file)
@@ -36,8 +36,13 @@ http://www.gnu.org/copyleft/lesser.txt.
 // define python type
 PyTypeObject FilterRGB24Type =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.FilterRGB24",   /*tp_name*/
        sizeof(PyFilter),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
@@ -82,8 +87,13 @@ PyTypeObject FilterRGB24Type =
 // define python type
 PyTypeObject FilterRGBA32Type =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.FilterRGBA32",   /*tp_name*/
        sizeof(PyFilter),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
@@ -128,8 +138,13 @@ PyTypeObject FilterRGBA32Type =
 // define python type
 PyTypeObject FilterBGR24Type =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.FilterBGR24",   /*tp_name*/
        sizeof(PyFilter),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index 19ad17ac64326cd09dad2eb6e2707d0752266160..c8e62aff240847f766a8d154f8af5329c6141b28 100644 (file)
@@ -123,8 +123,13 @@ static PyGetSetDef imageBuffGetSets[] =
 // define python type
 PyTypeObject ImageBuffType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.ImageBuff",   /*tp_name*/
        sizeof(PyImage),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index b07b362818cf968511a9062c280bdb4af18331af..2418ba254e42ebc341d7d4857ee36cff8d36f8a6 100644 (file)
@@ -162,8 +162,13 @@ static PyGetSetDef imageMixGetSets[] =
 // define python type
 PyTypeObject ImageMixType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.ImageMix",   /*tp_name*/
        sizeof(PyImage),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index f1df47af373e8ea6e61f9b52968695293f48a00f..1e3a84c1efbce20181834e5f5970eedf3cdc4b70 100644 (file)
@@ -379,8 +379,13 @@ static PyGetSetDef imageRenderGetSets[] =
 // define python type
 PyTypeObject ImageRenderType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.ImageRender",   /*tp_name*/
        sizeof(PyImage),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
@@ -713,8 +718,13 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
 // define python type
 PyTypeObject ImageMirrorType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.ImageMirror",   /*tp_name*/
        sizeof(PyImage),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index 4c2c81e2208b599407dc5907dfff6fdb4fd1f1fd..b808b06eb2b73dac4d30b87f0f769caf8031f8d1 100644 (file)
@@ -289,8 +289,13 @@ static PyGetSetDef imageViewportGetSets[] =
 // define python type
 PyTypeObject ImageViewportType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.ImageViewport",   /*tp_name*/
        sizeof(PyImage),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index fa941f9260ed080d5ca325a22e9f0eaff64812b0..f1fcbee304150942667249cdb14b58bc46125294 100644 (file)
@@ -435,8 +435,13 @@ static PyGetSetDef textureGetSets[] =
 // class Texture declaration
 PyTypeObject TextureType =
 {
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.Texture",   /*tp_name*/
        sizeof(Texture),           /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index 5265b0ecb93efa11cc7849d9e27d43e7b6e08ba8..08c02628f05694889f1299ad19b5e788a190666d 100644 (file)
@@ -1123,8 +1123,13 @@ static PyGetSetDef videoGetSets[] =
 // python type declaration
 PyTypeObject VideoFFmpegType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.VideoFFmpeg",   /*tp_name*/
        sizeof(PyImage),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
@@ -1241,8 +1246,13 @@ static PyGetSetDef imageGetSets[] =
 // python type declaration
 PyTypeObject ImageFFmpegType =
 { 
-       PyObject_HEAD_INIT(NULL)
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
        0,                         /*ob_size*/
+#endif
        "VideoTexture.ImageFFmpeg",   /*tp_name*/
        sizeof(PyImage),          /*tp_basicsize*/
        0,                         /*tp_itemsize*/
index c11e7fffecd8a96c3356f67dd8004558dbd09724..8b2a9dc2a5d4309faa2daad8d0d944057b89a3af 100644 (file)
@@ -159,8 +159,25 @@ static void registerAllTypes(void)
        pyFilterTypes.add(&FilterBGR24Type, "FilterBGR24");
 }
 
+
+#if (PY_VERSION_HEX >= 0x03000000)
+static struct PyModuleDef VideoTexture_module_def = {
+       {}, /* m_base */
+       "VideoTexture",  /* m_name */
+       "Module that allows to play video files on textures in GameBlender.",  /* m_doc */
+       0,  /* m_size */
+       moduleMethods,  /* m_methods */
+       0,  /* m_reload */
+       0,  /* m_traverse */
+       0,  /* m_clear */
+       0,  /* m_free */
+};
+#endif
+
 PyObject* initVideoTexture(void) 
 {
+       PyObject * m;
+       
        // initialize GL extensions
        //bgl::InitExtensions(0);
 
@@ -175,9 +192,14 @@ PyObject* initVideoTexture(void)
        if (PyType_Ready(&TextureType) < 0) 
                return NULL;
 
-       PyObject * m = Py_InitModule4("VideoTexture", moduleMethods,
+#if (PY_VERSION_HEX >= 0x03000000)
+       m = PyModule_Create(&VideoTexture_module_def);
+#else
+       m = Py_InitModule4("VideoTexture", moduleMethods,
                "Module that allows to play video files on textures in GameBlender.",
                (PyObject*)NULL,PYTHON_API_VERSION);
+#endif
+       
        if (m == NULL) 
                return NULL;