converted my gen_utils.h fix to PyObjectPlus.h
authorKent Mein <mein@cs.umn.edu>
Sat, 6 Sep 2008 14:13:31 +0000 (14:13 +0000)
committerKent Mein <mein@cs.umn.edu>
Sat, 6 Sep 2008 14:13:31 +0000 (14:13 +0000)
Also added a fix for PyMarshal_WriteObjectToString

Now I just need to figure out linking of the gameengine on my imac.

Kent

25 files changed:
source/blender/python/api2_2x/gen_utils.h
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Converter/Makefile
source/gameengine/Expressions/Makefile
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/GameLogic/Makefile
source/gameengine/GameLogic/SCA_ILogicBrick.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/Ketsji/BL_Shader.cpp
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_ParentActuator.cpp
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Ketsji/KX_VehicleWrapper.cpp

index 1f2fd55cf1b9f83a9102648c24288424c3c9d2e9..f33dc69d703621518f3c7fdfb5e5fcddf45ebdf6 100644 (file)
@@ -45,6 +45,7 @@
    Py_RETURN_NONE
    Python 2.4 macro.  
    defined here until we switch to 2.4
+   also in PyObjectPlus.h for gameengine
 */
 #ifndef Py_RETURN_NONE
 #define Py_RETURN_NONE return Py_BuildValue("O", Py_None)
index 13c251887532a00b796e842c9e6a0b92da626564..119465c87267e3ea54ed6e4ccc105d24779583cb 100644 (file)
@@ -50,7 +50,7 @@
 #include "MT_Matrix4x4.h"
 #include "BKE_utildefines.h"
 #include "FloatValue.h"
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index 06a9db866d450da6a5b9abf0c7324997a86fb361..679b0df7ec685951bd9acf26b13ad6ebfd0a74b8 100644 (file)
@@ -49,8 +49,7 @@
 #include "BLI_arithb.h"
 #include "MT_Matrix4x4.h"
 #include "BKE_utildefines.h"
-
-#include "gen_utils.h" /* python stuff */
+#include "PyObjectPlus.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index 9bd8ae4fc7b307fe78b5ebcf45f1791fde00e8f3..4dd63e428bd59e3318cd8b137524b6c611990dba 100644 (file)
@@ -39,7 +39,6 @@ CPPFLAGS += -I$(OPENGL_HEADERS)
 CPPFLAGS += -I$(NAN_STRING)/include    
 CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include    
 CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I../../blender/python/api2_2x
 CPPFLAGS += -I$(NAN_FUZZICS)/include -I$(NAN_SUMO) -I$(NAN_MOTO)/include
 CPPFLAGS += -I$(NAN_SOLID)/include
 CPPFLAGS += -I$(NAN_BULLET2)/include
index f333de68be028957983336fd0d72718cff26d3c8..6736149bbcdb7426f0b37eb7923b28d4126a9985 100644 (file)
@@ -36,7 +36,6 @@ include nan_compile.mk
 CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
 
 CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I../../blender/python/api2_2x
 CPPFLAGS += -I../../blender/makesdna
 
 CPPFLAGS += -I$(NAN_STRING)/include
index 3dfa1b0da3dd500b5a0190156626453b7fa8e7ea..1eca527151a399de0a7a7365a6ec34dfa419cfc3 100644 (file)
@@ -50,7 +50,6 @@
 #include "stdlib.h"
 #include "PyObjectPlus.h"
 #include "STR_String.h"
-#include "gen_utils.h"
 /*------------------------------
  * PyObjectPlus Type           -- Every class, even the abstract one should have a Type
 ------------------------------*/
index 65cd4e890f73302099a7b23276513be981629976..ccc9af2ed79c505de00747eb0e120f9be14d6853 100644 (file)
  * Python defines
 ------------------------------*/
 
+/*
+   Py_RETURN_NONE
+   Python 2.4 macro.
+   defined here until we switch to 2.4
+   also in api2_2x/gen_utils.h 
+*/
+#ifndef Py_RETURN_NONE
+#define Py_RETURN_NONE  return Py_BuildValue("O", Py_None)
+#endif
+#ifndef Py_RETURN_FALSE
+#define Py_RETURN_FALSE  return PyBool_FromLong(0)
+#endif
+#ifndef Py_RETURN_TRUE
+#define Py_RETURN_TRUE  return PyBool_FromLong(1)
+#endif
+
+/*  for pre Py 2.5 */
+#if PY_VERSION_HEX < 0x02050000
+typedef int Py_ssize_t;
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#else
+/* Py 2.5 and later */
+#define  intargfunc  ssizeargfunc
+#define intintargfunc  ssizessizeargfunc
+#endif
+
                                                                // some basic python macros
 #define Py_Return { Py_INCREF(Py_None); return Py_None;}
 
index 564e9b16b55e1bda8123b5c5b5722ca3ea29b298..355ece6e8bd11a48611630d1a7b3cef65df2b378 100644 (file)
@@ -44,7 +44,6 @@ CPPFLAGS += -I$(NAN_STRING)/include
 CPPFLAGS += -I$(NAN_MOTO)/include
 CPPFLAGS += -I../../blender/makesdna
 CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I../../blender/python/api2_2x
 CPPFLAGS += $(NAN_SDLCFLAGS)
 
 CPPFLAGS += -I../../kernel/gen_system
index 1c446bc87c4086bac87df461abf6f81f7ab5cd10..abd049e9d646f62cdbbcaf9bebbf7471b53f32bf 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include "SCA_ILogicBrick.h"
-#include "gen_utils.h" /* python stuff */
+#include "PyObjectPlus.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index 2d42d64abe37866a2bcf6f31ee8e851a43f62c9a..403fbfe6f4c9674afe618aa633ba9d784743a955 100644 (file)
 #include "SCA_EventManager.h"
 #include "SCA_LogicManager.h"
 
+#include "PyObjectPlus.h"
+
 #include <iostream>
 
-#include "gen_utils.h" /* python stuff */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index 6ba4456bdddcdbb79448a6724e4e9f651e71ae92..6e9a0a7c6b6493bbf4c1bc5a79feaae1bc0c3fab 100644 (file)
 #include "SCA_LogicManager.h"
 #include "SCA_ISensor.h"
 #include "SCA_IActuator.h"
+#include "PyObjectPlus.h"
 #include "compile.h"
 #include "eval.h"
 #include <algorithm>
 
-#include "gen_utils.h" /* python stuff */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index a690beb9f384c0978dd42f7017c2b8becc6b2870..806216e05bb324ffe9ec7eb3871adab7876e5f61 100644 (file)
@@ -717,7 +717,11 @@ void GPG_Application::stopEngine()
                if (gameLogic) {
                        PyObject* pyGlobalDict = PyDict_GetItemString(PyModule_GetDict(gameLogic), "globalDict"); // Same as importing the module
                        if (pyGlobalDict) {
+#ifdef Py_MARSHAL_VERSION      
                                PyObject* pyGlobalDictMarshal = PyMarshal_WriteObjectToString(  pyGlobalDict, 2); // Py_MARSHAL_VERSION == 2 as of Py2.5
+#else
+                               PyObject* pyGlobalDictMarshal = PyMarshal_WriteObjectToString(  pyGlobalDict ); 
+#endif
                                if (pyGlobalDictMarshal) {
                                        m_pyGlobalDictString_Length = PyString_Size(pyGlobalDictMarshal);
                                        PyObject_Print(pyGlobalDictMarshal, stderr, 0);
index f4a4194edfe515ccaedec4c578ba0c76445c5aee..f28d3fa291270c8b4dd1e81c2f1ba3315d8e1a59 100644 (file)
@@ -15,8 +15,6 @@
 #include "RAS_MeshObject.h"
 #include "RAS_IRasterizer.h"
 
-#include "gen_utils.h" /* python stuff */
-
 #define spit(x) std::cout << x << std::endl;
 
 #define SORT_UNIFORMS 1
index 8f037a93f6a156e090713171268d4983b627f6b4..4948c0ea174d7d4b272d5c1b351435200af175d6 100644 (file)
@@ -35,7 +35,7 @@
 #include <math.h>
 #include "KX_GameObject.h"
 
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h" 
 
 STR_String KX_CameraActuator::X_AXIS_STRING = "x";
 STR_String KX_CameraActuator::Y_AXIS_STRING = "y";
index 9cb859be30dbb442b4d497a55d7a9ad0bba7e563..c9095ff34f669393118ecdbd0d702f30e2f96650 100644 (file)
@@ -27,7 +27,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 #include <Python.h>
-#include "gen_utils.h"
+#include "PyObjectPlus.h"
 #include "KX_ConstraintWrapper.h"
 #include "PHY_IPhysicsEnvironment.h"
 
index 0ca823e148fa7eccdddef06fdc60ecfb92a1ae2b..27a955b3105c951a8f77e6e350a8151c0b58c7c1 100644 (file)
@@ -65,7 +65,7 @@ typedef unsigned long uint_ptr;
 #include "SCA_IActuator.h"
 #include "SCA_ISensor.h"
 
-#include "gen_utils.h" /* python stuff */
+#include "PyObjectPlus.h" /* python stuff */
 
 // This file defines relationships between parents and children
 // in the game engine.
index e420a208ffdd4f1f633d83d73324ac95f77af291..5cc102248f2fcf83c112098d551440e20822aea4 100644 (file)
@@ -43,7 +43,7 @@
 #include "KX_PyMath.h"
 #include "KX_ConvertPhysicsObject.h"
 
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h" 
 
 PyTypeObject KX_MeshProxy::Type = {
        PyObject_HEAD_INIT(&PyType_Type)
index 58000062dcfc35ebdebb7b5887d115ec8f3f80e2..3ca121f63f8a0b72883fd6b263d77aa8709e96b9 100644 (file)
@@ -36,7 +36,7 @@
 #include "KX_GameObject.h"
 #include "KX_PythonInit.h"
 
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h" 
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index cd76e00a2e3a29e77d72f8e42699833ec852b6a7..da4f05ced7cee7a30bce0479c743a1422097ec4c 100644 (file)
@@ -27,7 +27,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 #include <Python.h>
-#include "gen_utils.h"
+#include "PyObjectPlus.h"
 
 #include "KX_PhysicsObjectWrapper.h"
 #include "PHY_IPhysicsEnvironment.h"
index 83695a9f4c3b5790d4009c298338ce39a74f152a..ac63e3fade596920ba25ebbfe28b19afa4cea49c 100644 (file)
@@ -34,7 +34,7 @@
 #include "PHY_IPhysicsController.h"
 #include "PHY_IVehicle.h"
 
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h" 
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index c89e4cbd831f027c48c0de591cc3d021d889294a..fe6294e76262080b64e40319c988419801dc7663 100644 (file)
@@ -68,7 +68,7 @@
 
 #include "KX_PyMath.h"
 
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h" 
 
 extern "C" {
        #include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
index 579ad94206bd0b034e7151f8847d64c73c539322..c4c190e9fa131e5903c44ef9cd2a145fb76eefd2 100644 (file)
@@ -39,7 +39,7 @@
 #include "KX_GameObject.h"
 #include "KX_IPhysicsController.h"
 
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h" 
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index 383347684cbe66a6b20f485edd89ac1e303ec48a..e1f11732085144325ee80552d629474967f8a817 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "KX_SCA_ReplaceMeshActuator.h"
 
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h" 
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index 962ca93c0188cb585bd18b40c0df0e7287f42e13..8b09cd4e953f267488dab8ff1e761094cd81b91e 100644 (file)
@@ -42,7 +42,7 @@
 #include <iostream>
 #include "KX_GameObject.h"
 
-#include "gen_utils.h" /* Python stuff */
+#include "PyObjectPlus.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index 9131afda5ddb0c985223e6a06ea419c3225fbb52..342e71c5093b1968e05ab08af16f59c378f10796 100644 (file)
@@ -1,7 +1,7 @@
 
 
 #include <Python.h>
-#include "gen_utils.h"
+#include "PyObjectPlus.h"
 
 #include "KX_VehicleWrapper.h"
 #include "PHY_IPhysicsEnvironment.h"