[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19980] trunk/blender/source/gameengine: ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing)

Campbell Barton ideasman42 at gmail.com
Wed Apr 29 18:54:49 CEST 2009


Revision: 19980
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19980
Author:   campbellbarton
Date:     2009-04-29 18:54:45 +0200 (Wed, 29 Apr 2009)

Log Message:
-----------
ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing)
.
No changes for py2.x.

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

Modified: trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
===================================================================
--- trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -268,6 +268,7 @@
 			// 'normal' object
 			glMultMatrixd(oglmatrix);
 		}
+		glMultMatrixd(oglmatrix);
 	}
 }
 

Modified: trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -942,8 +942,13 @@
 /* ------------------------------------------------------------------------- */
 
 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,

Modified: trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -418,8 +418,13 @@
 /* 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,

Modified: trunk/blender/source/gameengine/Expressions/InputParser.cpp
===================================================================
--- trunk/blender/source/gameengine/Expressions/InputParser.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/Expressions/InputParser.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -658,10 +658,29 @@
 	{ 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
 	}
 }
 

Modified: trunk/blender/source/gameengine/Expressions/ListValue.cpp
===================================================================
--- trunk/blender/source/gameengine/Expressions/ListValue.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/Expressions/ListValue.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -212,9 +212,15 @@
 	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 @@
 
 
 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*/

Modified: trunk/blender/source/gameengine/Expressions/PyObjectPlus.cpp
===================================================================
--- trunk/blender/source/gameengine/Expressions/PyObjectPlus.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/Expressions/PyObjectPlus.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -56,8 +56,13 @@
 
 
 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*/

Modified: trunk/blender/source/gameengine/Expressions/Value.cpp
===================================================================
--- trunk/blender/source/gameengine/Expressions/Value.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/Expressions/Value.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -36,8 +36,13 @@
 #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 @@
 }
 */
 
+#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
 	}
 }
 

Modified: trunk/blender/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -108,8 +108,13 @@
 
 /* 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,

Modified: trunk/blender/source/gameengine/GameLogic/SCA_ANDController.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_ANDController.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/GameLogic/SCA_ANDController.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -107,8 +107,13 @@
 
 /* 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,

Modified: trunk/blender/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -122,8 +122,13 @@
 
 /* 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,

Modified: trunk/blender/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -105,8 +105,13 @@
 
 /* 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,

Modified: trunk/blender/source/gameengine/GameLogic/SCA_DelaySensor.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_DelaySensor.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/GameLogic/SCA_DelaySensor.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -131,8 +131,13 @@
 
 /* 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,

Modified: trunk/blender/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_ILogicBrick.cpp	2009-04-29 16:48:00 UTC (rev 19979)
+++ trunk/blender/source/gameengine/GameLogic/SCA_ILogicBrick.cpp	2009-04-29 16:54:45 UTC (rev 19980)
@@ -209,8 +209,13 @@
 /* python stuff */
 
 PyTypeObject SCA_ILogicBrick::Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list