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 e393b6d..0239027 100644 (file)
@@ -268,6 +268,7 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat
                        // 'normal' object
                        glMultMatrixd(oglmatrix);
                }
+               glMultMatrixd(oglmatrix);
        }
 }
 
index 3ad55f5..ee97e32 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 60d26b9..5fea568 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 834dff7..d45a937 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 3596128..fc6b929 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 8bd34cd..e6b4933 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 088b5cb..fbd86cc 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 ed83458..fb72eef 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 ed23722..1b151cb 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 928060d..464797f 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 941f3b5..19d19b6 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 15e805a..4752d0e 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 8439dba..84babda 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 8e599e6..b3c4708 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 b556c14..4d69216 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 b9d9917..34d63a4 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 5dcdb22..821d215 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 6594232..46be6ad 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 ab5c39d..4643a42 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 918e6a3..a0e9fcb 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 034c3ee..87e6d19 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 f3ca630..33dc835 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 7953698..c78283d 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 b9f8dde..3320795 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 9111042..2db871c 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 70a2312..5c109ba 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 13d5010..947e8b7 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 6613742..d9e41c2 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 2b3612e..c5c517c 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 712f64d..7f21c49 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 d770465..82e2437 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 70907db..5f08739 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 a0b2c73..7f8505a 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 bc2c2fc..3ea01cc 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 38a6875..e701a68 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 3410213..c9cb8e1 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 cab42f0..c63f9e5 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 a46318d..48d7dcd 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 ed16223..20113af 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 df80085..efe0199 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 498eb72..0f90bfd 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 009364a..eede3a0 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 d141aa4..9106902 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 2f1a3af..e7f0555 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 86ae082..e3d7a0f 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 ffd7185..37d2e50 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 c0c15b5..c968e50 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 33e2153..ca38117 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 a39ff48..918c251 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 2c65c18..e801e9c 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 f82110c..22e092e 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 bf4b0f6..1959dd5 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 ea9356a..43d8806 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 dd9d63f..2fd786e 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 4bc4268..af5631b 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 a0b411d..728254e 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 8b87253..730d1ed 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 1c1cc88..fd24403 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 4447ff4..1cce93f 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 db3d92f..15eb354 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 71ffa16..2cbb42b 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 2addfc3..f000c16 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 808bf0a..672b9e7 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 5a0ec35..e43a5ca 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 629fadf..93ff35b 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 ed12a88..46a1db9 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 43d7566..6b23105 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 22ee729..5ff1f7f 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 a726696..9a2b1e9 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 f3676e9..4c75e14 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 19ad17a..c8e62af 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 b07b362..2418ba2 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 f1df47a..1e3a84c 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 4c2c81e..b808b06 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 fa941f9..f1fcbee 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 5265b0e..08c0262 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 c11e7ff..8b2a9dc 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;