PyUnicode_From_STR_String utility function which passes STR_String to PyUnicode_FromS...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 6 Nov 2011 01:39:36 +0000 (01:39 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 6 Nov 2011 01:39:36 +0000 (01:39 +0000)
Also made CValue::ConvertKeysToPython use faster list creation and improved some of the macro formatting.

81 files changed:
source/gameengine/Converter/BL_ActionActuator.h
source/gameengine/Converter/BL_ArmatureActuator.h
source/gameengine/Converter/BL_ArmatureConstraint.h
source/gameengine/Converter/BL_ArmatureObject.h
source/gameengine/Converter/BL_ShapeActionActuator.h
source/gameengine/Expressions/Expression.h
source/gameengine/Expressions/ListValue.h
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Expressions/Value.cpp
source/gameengine/Expressions/Value.h
source/gameengine/GameLogic/SCA_2DFilterActuator.h
source/gameengine/GameLogic/SCA_ANDController.h
source/gameengine/GameLogic/SCA_ActuatorSensor.h
source/gameengine/GameLogic/SCA_AlwaysSensor.h
source/gameengine/GameLogic/SCA_DelaySensor.h
source/gameengine/GameLogic/SCA_ExpressionController.h
source/gameengine/GameLogic/SCA_IController.h
source/gameengine/GameLogic/SCA_ILogicBrick.h
source/gameengine/GameLogic/SCA_IObject.h
source/gameengine/GameLogic/SCA_ISensor.h
source/gameengine/GameLogic/SCA_JoystickSensor.h
source/gameengine/GameLogic/SCA_KeyboardSensor.h
source/gameengine/GameLogic/SCA_MouseSensor.h
source/gameengine/GameLogic/SCA_NANDController.h
source/gameengine/GameLogic/SCA_NORController.h
source/gameengine/GameLogic/SCA_ORController.h
source/gameengine/GameLogic/SCA_PropertyActuator.h
source/gameengine/GameLogic/SCA_PropertySensor.h
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_PythonController.h
source/gameengine/GameLogic/SCA_PythonKeyboard.h
source/gameengine/GameLogic/SCA_PythonMouse.h
source/gameengine/GameLogic/SCA_RandomActuator.h
source/gameengine/GameLogic/SCA_RandomSensor.h
source/gameengine/GameLogic/SCA_XNORController.h
source/gameengine/GameLogic/SCA_XORController.h
source/gameengine/Ketsji/BL_Shader.h
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
source/gameengine/Ketsji/KX_ArmatureSensor.h
source/gameengine/Ketsji/KX_BlenderMaterial.h
source/gameengine/Ketsji/KX_Camera.h
source/gameengine/Ketsji/KX_CameraActuator.h
source/gameengine/Ketsji/KX_ConstraintActuator.h
source/gameengine/Ketsji/KX_ConstraintWrapper.h
source/gameengine/Ketsji/KX_FontObject.h
source/gameengine/Ketsji/KX_GameActuator.h
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IpoActuator.h
source/gameengine/Ketsji/KX_Light.h
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_MeshProxy.h
source/gameengine/Ketsji/KX_MouseFocusSensor.h
source/gameengine/Ketsji/KX_NavMeshObject.h
source/gameengine/Ketsji/KX_NearSensor.h
source/gameengine/Ketsji/KX_ObjectActuator.h
source/gameengine/Ketsji/KX_ParentActuator.h
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Ketsji/KX_PolyProxy.h
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.h
source/gameengine/Ketsji/KX_RadarSensor.h
source/gameengine/Ketsji/KX_RaySensor.h
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h
source/gameengine/Ketsji/KX_SceneActuator.h
source/gameengine/Ketsji/KX_SoundActuator.h
source/gameengine/Ketsji/KX_StateActuator.h
source/gameengine/Ketsji/KX_SteeringActuator.h
source/gameengine/Ketsji/KX_TouchSensor.h
source/gameengine/Ketsji/KX_TrackToActuator.h
source/gameengine/Ketsji/KX_VehicleWrapper.h
source/gameengine/Ketsji/KX_VertexProxy.h
source/gameengine/Ketsji/KX_VisibilityActuator.h

index 2fb774dad449f1db695c876107bb44641f47c7f4..29300281bb5ceaca4306e005b3ef9a6e116ee400 100644 (file)
@@ -40,7 +40,7 @@
 class BL_ActionActuator : public SCA_IActuator  
 {
 public:
-       Py_Header;
+       Py_Header
        BL_ActionActuator(SCA_IObject* gameobj,
                                                const STR_String& propname,
                                                const STR_String& framepropname,
@@ -70,8 +70,8 @@ public:
 
 #ifdef WITH_PYTHON
 
-       KX_PYMETHOD_O(BL_ActionActuator,GetChannel);
-       KX_PYMETHOD_DOC(BL_ActionActuator,setChannel);
+       KX_PYMETHOD_O(BL_ActionActuator,GetChannel)
+       KX_PYMETHOD_DOC(BL_ActionActuator,setChannel)
 
        static PyObject*        pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
index 8390444613c8b60a2ceefae08a1e8e1f9ace5755..344b76ec278ea13c50fcdb3ff534dc72aecb91f2 100644 (file)
@@ -46,7 +46,7 @@
 
 class  BL_ArmatureActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 public:
        BL_ArmatureActuator(SCA_IObject* gameobj,
                                                int type,
index 49a331e78a5be2180dfb715557329d27d15a3953..2abb36ff937d49fd7dcde503f16196d59c3ca8c0 100644 (file)
@@ -52,7 +52,7 @@ struct bPose;
  */
 class BL_ArmatureConstraint    : public PyObjectPlus
 {
-       Py_Header;
+       Py_Header
 
 private:
        struct bConstraint* m_constraint;
index 9847558f7082c75c42402293703e0d19bf53ee32..745ffac0cb2466a9618adafa232ba73e6eda0d9d 100644 (file)
@@ -51,7 +51,7 @@ class KX_BlenderSceneConverter;
 
 class BL_ArmatureObject : public KX_GameObject  
 {
-       Py_Header;
+       Py_Header
 public:
 
        double GetLastFrame ();
index c4251b3c503429e2525fa05b676921fce01c74c3..90f44acb672890e70c3b9505f2b50802690bcba1 100644 (file)
@@ -42,7 +42,7 @@ struct Key;
 class BL_ShapeActionActuator : public SCA_IActuator  
 {
 public:
-       Py_Header;
+       Py_Header
        BL_ShapeActionActuator(SCA_IObject* gameobj,
                                                const STR_String& propname,
                                                const STR_String& framepropname,
index 875bd758b68a26042122248bfe9d6438c77aefa7..b9232477c347200139f7892fba60f0bae99c789b 100644 (file)
 //extern int gRefCountExpr; // only for debugging purposes (detect mem.leaks)
 
 
-#define PLUGIN_DECLARE_SERIAL_EXPRESSION(class_name,base_class_name)                                                                   \
-public:                                                                                                                                                                                \
-       virtual base_class_name *       Copy()                                          { return new class_name; }              \
-       virtual bool EdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring);    \
-       virtual bool EdIdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring)  \
-{                              \
-       if (bIsStoring)                 \
-       {                                                       \
-               unsigned char exprID = GetExpressionID(); \
-               arch << exprID;                                 \
-       }                                               \
-       return true; \
-}                              \
+#define PLUGIN_DECLARE_SERIAL_EXPRESSION(class_name, base_class_name)          \
+public:                                                                        \
+       virtual base_class_name * Copy() {                                         \
+               return new class_name;                                                 \
+       }                                                                          \
+       virtual bool EdSerialize(CompressorArchive& arch,                          \
+                                class CFactoryManager* facmgr,                    \
+                                bool bIsStoring);                                 \
+       virtual bool EdIdSerialize(CompressorArchive& arch,                        \
+                                  class CFactoryManager* facmgr,                  \
+                                  bool bIsStoring)                                \
+       {                                                                          \
+               if (bIsStoring)                                                        \
+               {                                                                      \
+                       unsigned char exprID = GetExpressionID();                          \
+                       arch << exprID;                                                    \
+               }                                                                      \
+               return true;                                                           \
+       }                                                                          \
 
 
 
index 76451215f82e3c5b0ed3c58dde841f8adb97c0d3..26c11cccc7ae00ee2d09bcd1397eec8ac72f439d 100644 (file)
@@ -23,7 +23,7 @@
 
 class CListValue : public CPropValue  
 {
-       Py_Header;
+       Py_Header
        //PLUGIN_DECLARE_SERIAL (CListValue,CValue)
 
 public:
@@ -58,7 +58,7 @@ public:
        void Resize(int num);
        void SetValue(int i,CValue* val);
        CValue* GetValue(int i){        assertd(i < m_pValueArray.size());      return m_pValueArray[i];}
-       int GetCount() { return m_pValueArray.size();};
+       int GetCount() { return m_pValueArray.size(); }
        virtual const STR_String & GetText();
 
        bool CheckEqual(CValue* first,CValue* second);
index 87f776a726e885e2dc7da27b308154e059068dbf..f263bf15f02ba5910b1a6975ba7aca6659f8ee4a 100644 (file)
@@ -470,7 +470,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
                case KX_PYATTRIBUTE_TYPE_STRING:
                        {
                                STR_String *val = reinterpret_cast<STR_String*>(ptr);
-                               return PyUnicode_FromString(*val);
+                               return PyUnicode_From_STR_String(*val);
                        }
                case KX_PYATTRIBUTE_TYPE_CHAR:
                        {
@@ -1171,6 +1171,11 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
        return self->m_proxy;
 }
 
+PyObject *PyUnicode_From_STR_String(const STR_String& str)
+{
+       return PyUnicode_FromStringAndSize(str.ReadPtr(), str.Length());
+}
+
 ///////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////
 /* deprecation warning management */
index f7bd1b91466c6dec8960c23e874b9f1ee7621a5e..3e1c54b0cc741041eb2d670171d6d7d4d7fd3e85 100644 (file)
  *  \ingroup expressions
  */
 
+#ifndef _PY_OBJECT_PLUS_H
+#define _PY_OBJECT_PLUS_H
+
 /* for now keep weakrefs optional */
 #define USE_WEAKREFS
 
-#ifndef _adr_py_lib_h_                         // only process once,
-#define _adr_py_lib_h_                         // even if multiply included
 
 #ifndef __cplusplus                            // c++ only
 #error Must be compiled with C++
 #include "SG_QList.h"
 #include <stddef.h>
 
-/*------------------------------
- * Python defines
-------------------------------*/
-
 #ifdef WITH_PYTHON
 #ifdef USE_MATHUTILS
 extern "C" {
@@ -110,7 +107,7 @@ typedef struct PyObjectPlus_Proxy {
 #define BGE_PROXY_PYOWNS(_self) (((PyObjectPlus_Proxy *)_self)->py_owns)
 #define BGE_PROXY_PYREF(_self) (((PyObjectPlus_Proxy *)_self)->py_ref)
 #ifdef USE_WEAKREFS
-       #define BGE_PROXY_WKREF(_self) (((PyObjectPlus_Proxy *)_self)->in_weakreflist)
+#  define BGE_PROXY_WKREF(_self) (((PyObjectPlus_Proxy *)_self)->in_weakreflist)
 #endif
 
 /* Note, sometimes we dont care what BGE type this is as long as its a proxy */
@@ -124,45 +121,61 @@ typedef struct PyObjectPlus_Proxy {
 // PyC++ class
 // AttributesPtr correspond to attributes of proxy generic pointer 
 // each PyC++ class must be registered in KX_PythonInitTypes.cpp
-#define __Py_Header \
- public: \
-  static PyTypeObject   Type; \
-  static PyMethodDef    Methods[]; \
-  static PyAttributeDef Attributes[]; \
-  virtual PyTypeObject *GetType(void) {return &Type;}; \
-  virtual PyObject *GetProxy() {return GetProxyPlus_Ext(this, &Type, NULL);}; \
-  virtual PyObject *NewProxy(bool py_owns) {return NewProxyPlus_Ext(this, &Type, NULL, py_owns);}; \
+#define __Py_Header                                                           \
+public:                                                                       \
+       static PyTypeObject   Type;                                               \
+       static PyMethodDef    Methods[];                                          \
+       static PyAttributeDef Attributes[];                                       \
+       virtual PyTypeObject *GetType(void) {                                     \
+               return &Type;                                                         \
+       }                                                                         \
+       virtual PyObject *GetProxy() {                                            \
+               return GetProxyPlus_Ext(this, &Type, NULL);                           \
+       }                                                                         \
+       virtual PyObject *NewProxy(bool py_owns) {                                \
+               return NewProxyPlus_Ext(this, &Type, NULL, py_owns);                  \
+       }                                                                         \
 
 // leave above line empty (macro)!
 // use this macro for class that use generic pointer in proxy
 // GetProxy() and NewProxy() must be defined to set the correct pointer in the proxy
-#define __Py_HeaderPtr \
- public: \
-  static PyTypeObject   Type; \
-  static PyMethodDef    Methods[]; \
-  static PyAttributeDef Attributes[]; \
-  static PyAttributeDef AttributesPtr[]; \
-  virtual PyTypeObject *GetType(void) {return &Type;}; \
-  virtual PyObject *GetProxy(); \
-  virtual PyObject *NewProxy(bool py_owns); \
+#define __Py_HeaderPtr                                                        \
+public:                                                                       \
+       static PyTypeObject   Type;                                               \
+       static PyMethodDef    Methods[];                                          \
+       static PyAttributeDef Attributes[];                                       \
+       static PyAttributeDef AttributesPtr[];                                    \
+       virtual PyTypeObject *GetType(void) {                                     \
+               return &Type;                                                         \
+       }                                                                         \
+       virtual PyObject *GetProxy();                                             \
+       virtual PyObject *NewProxy(bool py_owns);                                 \
 
 // leave above line empty (macro)!
 #ifdef WITH_CXX_GUARDEDALLOC
-#define Py_Header __Py_Header \
-  void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, Type.tp_name); } \
-  void operator delete(void *mem) { MEM_freeN(mem); } \
+#define Py_Header __Py_Header                                                 \
+       void *operator new(size_t num_bytes) {                                    \
+               return MEM_mallocN(num_bytes, Type.tp_name);                          \
+       }                                                                         \
+       void operator delete(void *mem) {                                         \
+               MEM_freeN(mem);                                                       \
+       }                                                                         \
 
 #else
-#define Py_Header __Py_Header
+#  define Py_Header __Py_Header
 #endif
 
 #ifdef WITH_CXX_GUARDEDALLOC
-#define Py_HeaderPtr __Py_HeaderPtr \
-  void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, Type.tp_name); } \
-  void operator delete( void *mem ) { MEM_freeN(mem); } \
+#define Py_HeaderPtr __Py_HeaderPtr                                           \
+       void *operator new(size_t num_bytes) {                                    \
+               return MEM_mallocN(num_bytes, Type.tp_name);                          \
+       }                                                                         \
+       void operator delete( void *mem ) {                                       \
+               MEM_freeN(mem);                                                       \
+       }                                                                         \
 
 #else
-#define Py_HeaderPtr __Py_HeaderPtr
+#  define Py_HeaderPtr __Py_HeaderPtr
 #endif
 
 /*
@@ -180,65 +193,109 @@ typedef struct PyObjectPlus_Proxy {
  * These macros are helpfull when embedding Python routines. The second
  * macro is one that also requires a documentation string
  */
-#define KX_PYMETHOD(class_name, method_name)                   \
-       PyObject* Py##method_name(PyObject* args, PyObject* kwds); \
-       static PyObject* sPy##method_name( PyObject* self, PyObject* args, PyObject* kwds) { \
-               if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
-               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds);         \
-       }; \
-
-#define KX_PYMETHOD_VARARGS(class_name, method_name)                   \
-       PyObject* Py##method_name(PyObject* args); \
-       static PyObject* sPy##method_name( PyObject* self, PyObject* args) { \
-               if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
-               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args);               \
-       }; \
-
-#define KX_PYMETHOD_NOARGS(class_name, method_name)                    \
-       PyObject* Py##method_name(); \
-       static PyObject* sPy##method_name( PyObject* self) { \
-               if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
-               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name();           \
-       }; \
-       
-#define KX_PYMETHOD_O(class_name, method_name)                 \
-       PyObject* Py##method_name(PyObject* value); \
-       static PyObject* sPy##method_name( PyObject* self, PyObject* value) { \
-               if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(value) - " BGE_PROXY_ERROR_MSG); return NULL; } \
-               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value);              \
-       }; \
-
-#define KX_PYMETHOD_DOC(class_name, method_name)                       \
-       PyObject* Py##method_name(PyObject* args, PyObject* kwds); \
-       static PyObject* sPy##method_name( PyObject* self, PyObject* args, PyObject* kwds) { \
-               if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \
-               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds);         \
-       }; \
-       static const char method_name##_doc[]; \
-
-#define KX_PYMETHOD_DOC_VARARGS(class_name, method_name)                       \
-       PyObject* Py##method_name(PyObject* args); \
-       static PyObject* sPy##method_name( PyObject* self, PyObject* args) { \
-               if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \
-               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args);               \
-       }; \
-       static const char method_name##_doc[]; \
-
-#define KX_PYMETHOD_DOC_O(class_name, method_name)                     \
-       PyObject* Py##method_name(PyObject* value); \
-       static PyObject* sPy##method_name( PyObject* self, PyObject* value) { \
-               if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(value) - " BGE_PROXY_ERROR_MSG); return NULL; } \
-               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value);              \
-       }; \
-       static const char method_name##_doc[]; \
-
-#define KX_PYMETHOD_DOC_NOARGS(class_name, method_name)                        \
-       PyObject* Py##method_name(); \
-       static PyObject* sPy##method_name( PyObject* self) { \
-               if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
-               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name();           \
-       }; \
-       static const char method_name##_doc[]; \
+#define KX_PYMETHOD(class_name, method_name)                                   \
+       PyObject* Py##method_name(PyObject* args, PyObject* kwds);                 \
+       static PyObject*                                                           \
+       sPy##method_name(PyObject* self, PyObject* args, PyObject* kwds) {         \
+               if(BGE_PROXY_REF(self)==NULL) {                                        \
+                       PyErr_SetString(PyExc_RuntimeError,                                \
+                                       #class_name "." #method_name "() - "               \
+                                       BGE_PROXY_ERROR_MSG);                              \
+                       return NULL;                                                       \
+               }                                                                      \
+               return((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \
+       }                                                                          \
+
+#define KX_PYMETHOD_VARARGS(class_name, method_name)                           \
+       PyObject* Py##method_name(PyObject* args);                                 \
+       static PyObject*                                                           \
+       sPy##method_name(PyObject* self, PyObject* args) {                         \
+               if(BGE_PROXY_REF(self)==NULL) {                                        \
+                       PyErr_SetString(PyExc_RuntimeError,                                \
+                                       #class_name "." #method_name "() - "               \
+                                       BGE_PROXY_ERROR_MSG); return NULL;                 \
+               }                                                                      \
+               return((class_name*)BGE_PROXY_REF(self))->Py##method_name(args);       \
+       }                                                                          \
+
+#define KX_PYMETHOD_NOARGS(class_name, method_name)                            \
+       PyObject* Py##method_name();                                               \
+       static PyObject*                                                           \
+       sPy##method_name(PyObject* self) {                                         \
+               if(BGE_PROXY_REF(self)==NULL) {                                        \
+                       PyErr_SetString(PyExc_RuntimeError,                                \
+                                       #class_name "." #method_name "() - "               \
+                                       BGE_PROXY_ERROR_MSG); return NULL;                 \
+               }                                                                      \
+               return((class_name*)BGE_PROXY_REF(self))->Py##method_name();           \
+       }                                                                          \
+
+#define KX_PYMETHOD_O(class_name, method_name)                                 \
+       PyObject* Py##method_name(PyObject* value);                                \
+       static PyObject*                                                           \
+       sPy##method_name(PyObject* self, PyObject* value) {                        \
+               if(BGE_PROXY_REF(self)==NULL) {                                        \
+                       PyErr_SetString(PyExc_RuntimeError,                                \
+                                       #class_name "." #method_name "(value) - "          \
+                                       BGE_PROXY_ERROR_MSG); return NULL;                 \
+               }                                                                      \
+               return((class_name*)BGE_PROXY_REF(self))->Py##method_name(value);      \
+       }                                                                          \
+
+#define KX_PYMETHOD_DOC(class_name, method_name)                               \
+       PyObject* Py##method_name(PyObject* args, PyObject* kwds);                 \
+       static PyObject*                                                           \
+       sPy##method_name(PyObject* self, PyObject* args, PyObject* kwds) {         \
+               if(BGE_PROXY_REF(self)==NULL) {                                        \
+                       PyErr_SetString(PyExc_RuntimeError,                                \
+                                       #class_name "." #method_name "(...) - "            \
+                                       BGE_PROXY_ERROR_MSG); return NULL;                 \
+               }                                                                      \
+               return((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \
+       }                                                                          \
+       static const char method_name##_doc[];                                     \
+
+#define KX_PYMETHOD_DOC_VARARGS(class_name, method_name)                       \
+       PyObject* Py##method_name(PyObject* args);                                 \
+       static PyObject*                                                           \
+       sPy##method_name(PyObject* self, PyObject* args) {                         \
+               if(BGE_PROXY_REF(self)==NULL) {                                        \
+                       PyErr_SetString(PyExc_RuntimeError,                                \
+                                       #class_name "." #method_name "(...) - "            \
+                                       BGE_PROXY_ERROR_MSG);                              \
+                       return NULL;                                                       \
+               }                                                                      \
+               return((class_name*)BGE_PROXY_REF(self))->Py##method_name(args);       \
+       }                                                                          \
+       static const char method_name##_doc[];                                     \
+
+#define KX_PYMETHOD_DOC_O(class_name, method_name)                             \
+       PyObject* Py##method_name(PyObject* value);                                \
+       static PyObject*                                                           \
+       sPy##method_name(PyObject* self, PyObject* value) {                        \
+               if(BGE_PROXY_REF(self)==NULL) {                                        \
+                       PyErr_SetString(PyExc_RuntimeError,                                \
+                                       #class_name "." #method_name "(value) - "          \
+                                       BGE_PROXY_ERROR_MSG);                              \
+                       return NULL;                                                       \
+               }                                                                      \
+               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value);     \
+       }                                                                          \
+       static const char method_name##_doc[];                                     \
+
+#define KX_PYMETHOD_DOC_NOARGS(class_name, method_name)                        \
+       PyObject* Py##method_name();                                               \
+       static PyObject*                                                           \
+       sPy##method_name(PyObject* self) {                                         \
+               if(BGE_PROXY_REF(self)==NULL) {                                        \
+                       PyErr_SetString(PyExc_RuntimeError,                                \
+                                       #class_name "." #method_name "() - "               \
+                                       BGE_PROXY_ERROR_MSG);                              \
+                       return NULL;                                                       \
+               }                                                                      \
+               return ((class_name*)BGE_PROXY_REF(self))->Py##method_name();          \
+       }                                                                          \
+       static const char method_name##_doc[];                                     \
 
 
 /* The line above should remain empty */
@@ -290,7 +347,7 @@ enum KX_PYATTRIBUTE_TYPE {
        KX_PYATTRIBUTE_TYPE_FUNCTION,
        KX_PYATTRIBUTE_TYPE_VECTOR,
        KX_PYATTRIBUTE_TYPE_FLAG,
-       KX_PYATTRIBUTE_TYPE_CHAR,
+       KX_PYATTRIBUTE_TYPE_CHAR
 };
 
 enum KX_PYATTRIBUTE_ACCESS {
@@ -479,23 +536,31 @@ typedef PyTypeObject * PyParentObject;                            // Define the PyParent Object
 #else // WITH_PYTHON
 
 #ifdef WITH_CXX_GUARDEDALLOC
-#define Py_Header \
- public: \
-       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlus"); } \
-       void operator delete( void *mem ) { MEM_freeN(mem); } \
+#define Py_Header                                                             \
+public:                                                                       \
+       void *operator new(size_t num_bytes) {                                    \
+               return MEM_mallocN(num_bytes, "GE:PyObjectPlus");                     \
+       }                                                                         \
+       void operator delete( void *mem ) {                                       \
+               MEM_freeN(mem);                                                       \
+       }                                                                         \
 
-#define Py_HeaderPtr \
- public: \
-       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlusPtr"); } \
-       void operator delete( void *mem ) { MEM_freeN(mem); } \
+#define Py_HeaderPtr                                                          \
+public:                                                                       \
+       void *operator new(size_t num_bytes) {                                    \
+               return MEM_mallocN(num_bytes, "GE:PyObjectPlusPtr");                  \
+       }                                                                         \
+       void operator delete( void *mem ) {                                       \
+       MEM_freeN(mem);                                                           \
+       }                                                                         \
 
 #else // WITH_CXX_GUARDEDALLOC
 
 #define Py_Header \
- public: \
+public: \
 
 #define Py_HeaderPtr \
- public: \
+public: \
 
 #endif // WITH_CXX_GUARDEDALLOC
 
@@ -515,7 +580,7 @@ typedef PyTypeObject * PyParentObject;                              // Define the PyParent Object
 // possibility to use them at SCA_ILogicBrick, CValue and PyObjectPlus level.
 class PyObjectPlus : public SG_QList
 {                              // The PyObjectPlus abstract class
-       Py_Header;                                                      // Always start with Py_Header
+       Py_Header                                                       // Always start with Py_Header
        
 public:
        PyObjectPlus();
@@ -580,6 +645,8 @@ public:
 
 #ifdef WITH_PYTHON
 PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
+
+PyObject *PyUnicode_From_STR_String(const STR_String& str);
 #endif
 
-#endif //  _adr_py_lib_h_
+#endif //  _PY_OBJECT_PLUS_H
index 41c0850a779e2f4ffa0572a9345c5acae071c027..91fdbb0dabc1925e8f20e58393ec66ad92020c77 100644 (file)
@@ -532,7 +532,7 @@ PyAttributeDef CValue::Attributes[] = {
 
 PyObject * CValue::pyattr_get_name(void * self_v, const KX_PYATTRIBUTE_DEF * attrdef) {
        CValue * self = static_cast<CValue *> (self_v);
-       return PyUnicode_FromString(self->GetName());
+       return PyUnicode_From_STR_String(self->GetName());
 }
 
 CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
@@ -596,22 +596,24 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
 
 }
 
-PyObject*      CValue::ConvertKeysToPython( void )
+PyObject* CValue::ConvertKeysToPython(void)
 {
-       PyObject *pylist = PyList_New( 0 );
-       PyObject *pystr;
-       
        if (m_pNamedPropertyArray)
        {
+               PyObject *pylist= PyList_New(m_pNamedPropertyArray->size());
+               Py_ssize_t i= 0;
+
                std::map<STR_String,CValue*>::iterator it;
                for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++)
                {
-                       pystr = PyUnicode_FromString( (*it).first );
-                       PyList_Append(pylist, pystr);
-                       Py_DECREF( pystr );
+                       PyList_SET_ITEM(pylist, i++, PyUnicode_From_STR_String((*it).first));
                }
+
+               return pylist;
+       }
+       else {
+               return PyList_New(0);
        }
-       return pylist;
 }
 
 #endif // WITH_PYTHON
index 955e688ad7bc22a591f4a23565990dab46616848..f9697a55d3f8fb4ae002d2fddc6d49e82cbee379 100644 (file)
@@ -200,7 +200,7 @@ public:
 class CValue  : public PyObjectPlus
 
 {
-Py_Header;
+Py_Header
 public:
        enum AllocationTYPE {
                STACKVALUE              = 0,
@@ -319,7 +319,7 @@ public:
 
        virtual const STR_String &      GetText() = 0;
        virtual double          GetNumber() = 0;
-       double*                         ZeroVector() { return m_sZeroVec; };
+       double*                         ZeroVector() { return m_sZeroVec; }
        virtual double*         GetVector3(bool bGetTransformedVec = false);
 
        virtual STR_String&     GetName() = 0;                                                                                  // Retrieve the name of the value
@@ -348,11 +348,11 @@ public:
        virtual bool            IsSelected()                                                                                    { return m_ValFlags.Selected; }
        inline bool                     IsReleaseRequested()                                                                    { return m_ValFlags.ReleaseRequested; }
        virtual bool            IsVisible()                                                                                             { return m_ValFlags.Visible;}
-       virtual void            SetCustomFlag1(bool bCustomFlag)                                                { m_ValFlags.CustomFlag1 = bCustomFlag;};
-       virtual bool            IsCustomFlag1()                                                                                 { return m_ValFlags.CustomFlag1;};
+       virtual void            SetCustomFlag1(bool bCustomFlag)                                                { m_ValFlags.CustomFlag1 = bCustomFlag;}
+       virtual bool            IsCustomFlag1()                                                                                 { return m_ValFlags.CustomFlag1;}
 
-       virtual void            SetCustomFlag2(bool bCustomFlag)                                                { m_ValFlags.CustomFlag2 = bCustomFlag;};
-       virtual bool            IsCustomFlag2()                                                                                 { return m_ValFlags.CustomFlag2;};
+       virtual void            SetCustomFlag2(bool bCustomFlag)                                                { m_ValFlags.CustomFlag2 = bCustomFlag;}
+       virtual bool            IsCustomFlag2()                                                                                 { return m_ValFlags.CustomFlag2;}
 
 protected:                                                                                                                                             
        virtual void            DisableRefCount();                                                                              // Disable reference counting for this value
@@ -379,18 +379,23 @@ private:
 // of object. So, for *any* CValue-derived object this should be set to CValue,
 // for *any* CExpression-derived object this should be set to CExpression.
 //
-#define PLUGIN_DECLARE_SERIAL(class_name, root_base_class_name)                                                                                        \
-public:                                                                                                                                                                                                        \
-       virtual root_base_class_name *  Copy()                                  { return new class_name; }                                      \
-       virtual bool EdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring);    \
-       virtual bool EdIdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring)       \
-{                                                                                                                                                                                                              \
-       if (bIsStoring)                                                                                                                                                                         \
-               arch.StoreString(#class_name);                                                                                                                                  \
-                                                                                                                                                                                                               \
-       return false;                                                                                                                                                                           \
-}                                                                                                                                                                                                              \
-       
+#define PLUGIN_DECLARE_SERIAL(class_name, root_base_class_name)                \
+public:                                                                        \
+       virtual root_base_class_name *Copy() {                                     \
+               return new class_name;                                                 \
+       }                                                                          \
+       virtual bool EdSerialize(CompressorArchive& arch,                          \
+                                class CFactoryManager* facmgr,                    \
+                                bool bIsStoring);                                 \
+       virtual bool EdIdSerialize(CompressorArchive& arch,                        \
+                                  class CFactoryManager* facmgr,                  \
+                                  bool bIsStoring)                                \
+       {                                                                          \
+               if (bIsStoring)                                                        \
+                       arch.StoreString(#class_name);                                     \
+               return false;                                                          \
+       }                                                                          \
+
 
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
@@ -424,7 +429,7 @@ public:
                //if (namefromprop.Length() > 0)
                //      return namefromprop;
                return m_strNewName;
-       };                                              // name of Value
+       }                                               // name of Value
        
 protected:
        STR_String                                      m_strNewName;                               // Identification
index ec4c4a1cbcfa57583cbbfd10ec4120d9cddda3bb..42446b7a2b1ec77ad8d6a6d499692e5b6ddf0e72 100644 (file)
@@ -37,7 +37,7 @@
 
 class SCA_2DFilterActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 
 private:
        vector<STR_String> m_propNames;
index e39dea547a2ddbf1bad5b76c421e5fe90f33c66e..363bca630aa1e7be49960221857ad0fbbbaf3f34 100644 (file)
@@ -39,7 +39,7 @@
 
 class SCA_ANDController : public SCA_IController
 {
-       Py_Header;
+       Py_Header
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
        SCA_ANDController(SCA_IObject* gameobj);
index 9b5793787a2ab80a721f5c8ef374932d95e9b89b..e7a7525bb40a97242235f1f21fd6ebb102be35de 100644 (file)
@@ -40,7 +40,7 @@
 
 class SCA_ActuatorSensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
        STR_String              m_checkactname;
        bool                    m_lastresult;
        bool                    m_midresult;
index 41e9a9612c6bcc2b041922dc74c1fc826043802a..8748793d9a329bf3087eea8f7fb83abfd4527512 100644 (file)
@@ -38,7 +38,7 @@
 
 class SCA_AlwaysSensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
        bool                    m_alwaysresult;
 public:
        SCA_AlwaysSensor(class SCA_EventManager* eventmgr,
index fea713502b417ae590e328e70e1914016eb4dfae..ccb8f00c548d45376fe0c9870996d9a5e9b68a78 100644 (file)
@@ -38,7 +38,7 @@
 
 class SCA_DelaySensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
        bool                    m_lastResult;
        bool                    m_repeat;
        int                             m_delay; 
index 4e549c08ed12b5e0fe84b93d10bbe4c0e9afd130..93a3f08c95fb55e6e618155015147568039d2edc 100644 (file)
@@ -39,7 +39,7 @@
 
 class SCA_ExpressionController : public SCA_IController
 {
-//     Py_Header;
+//     Py_Header
        STR_String                      m_exprText;
        CExpression*            m_exprCache;
 
index 795e02dcf7896162d0d0014e4d79da8510116232..5481f2ae8e489203f5eb226207adf86a132a72a2 100644 (file)
@@ -42,7 +42,7 @@
  */
 class SCA_IController : public SCA_ILogicBrick
 {
-       Py_Header;
+       Py_Header
 protected:
        std::vector<class SCA_ISensor*>         m_linkedsensors;
        std::vector<class SCA_IActuator*>       m_linkedactuators;
index 4016c557bf31a33d84fdf1971467390ceb94207c..87b37a8ef393bbb4473d8eeb2755c122661555cc 100644 (file)
@@ -43,7 +43,7 @@ class SCA_IScene;
 
 class SCA_ILogicBrick : public CValue
 {
-       Py_Header;
+       Py_Header
 protected:
        SCA_IObject*            m_gameobj;
        int                                     m_Execute_Priority;
index 1d16d4f0af7c1085f9b27e3ab88af0f1c5a2787b..b0a03de124289e7518a429b06a6d13c129715f6a 100644 (file)
@@ -54,7 +54,7 @@ typedef std::vector<SCA_IObject *>             SCA_ObjectList;
 class SCA_IObject :    public CValue
 {
        
-       Py_Header;
+       Py_Header
        
 protected:
        friend class KX_StateActuator;
index 970faf7d29a0efb23a480961f059afeb9ee27933..ef082095c0dd73438fe461ca81817b100df6fc42 100644 (file)
@@ -47,7 +47,7 @@
  */
 class SCA_ISensor : public SCA_ILogicBrick
 {
-       Py_Header;
+       Py_Header
 protected:
        class SCA_EventManager* m_eventmgr;
 
index b4ed2c06d2f85042996300f97bced1d0f3b75721..db34ce4cc15178594671370c9c796e4607c9a83f 100644 (file)
@@ -38,7 +38,7 @@
 
 class SCA_JoystickSensor :public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
        
        /**
         * Axis 1-JOYAXIS_MAX, MUST be followed by m_axisf
@@ -128,8 +128,8 @@ public:
        /* --------------------------------------------------------------------- */
 
        /* Joystick Index */
-       KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButtonActiveList);
-       KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,GetButtonStatus);
+       KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButtonActiveList)
+       KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,GetButtonStatus)
 
        static PyObject*        pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static PyObject*        pyattr_get_axis_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
index 37a42cdcbe6c149a79fa306be1af5f0d4fb6619c..e7283978ae14523968aaaa031fd74c466db26746 100644 (file)
@@ -44,7 +44,7 @@
  * exclusive.  */
 class SCA_KeyboardSensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
 
        /**
         * the key this sensor is sensing for
index ecfa776112ae34efd9135870f4daca29be329cc1..4bac9c10e130bd3cef8228715edc4e31c3cb012b 100644 (file)
@@ -39,7 +39,7 @@
 
 class SCA_MouseSensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
        
        /**
         * Use SCA_IInputDevice values to encode the mouse mode for now.
index 8eb26127a51d506e2b53f24d119c5b4be9ac1e20..723d2a5fe0d6fe15f9cd7c3365b57f0d0bb2f942 100644 (file)
@@ -36,7 +36,7 @@
 
 class SCA_NANDController : public SCA_IController
 {
-       Py_Header;
+       Py_Header
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
        SCA_NANDController(SCA_IObject* gameobj);
index 6580ad7bc8c413fb463f90e0ac64c5de1cf90d36..26d7e92592337693b15fbc29292424714f2d6b98 100644 (file)
@@ -36,7 +36,7 @@
 
 class SCA_NORController : public SCA_IController
 {
-       Py_Header;
+       Py_Header
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
        SCA_NORController(SCA_IObject* gameobj);
index 4edd34f63029e51c913644b779f611a63d5dcc83..53debf894a36343293464dc249e3c459baa33062 100644 (file)
@@ -36,7 +36,7 @@
 
 class SCA_ORController : public SCA_IController
 {
-       Py_Header;
+       Py_Header
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
        SCA_ORController(SCA_IObject* gameobj);
index f4a43a7e21ca1d5e7044f8da4d245c37aef167b7..17419e34c2a705144ba39a8aa506e5cda1e9fd86 100644 (file)
@@ -36,7 +36,7 @@
 
 class SCA_PropertyActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
        
        enum KX_ACT_PROP_MODE {
                KX_ACT_PROP_NODEF = 0,
index c1fe53205469d63d60defd9b3dd0ded6cff11742..bf7b1e879f712c79e54bc07e103816aa1a9e2370 100644 (file)
@@ -37,7 +37,7 @@
 
 class SCA_PropertySensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
        //class CExpression*    m_rightexpr;
        int                             m_checktype;
        STR_String              m_checkpropval;
index d69358928e6e91de51c72132fa9f25fe734b3ac7..8a87a734a1c4e839c964adc3979acb3197f86346 100644 (file)
@@ -164,7 +164,7 @@ void SCA_PythonController::SetNamespace(PyObject*   pythondictionary)
        
        /* Without __file__ set the sys.argv[0] is used for the filename
         * which ends up with lines from the blender binary being printed in the console */
-       PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_FromString(m_scriptName.Ptr()));
+       PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_From_STR_String(m_scriptName));
        
 }
 #endif
@@ -490,7 +490,7 @@ PyObject* SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRI
        // static_cast<void *>(dynamic_cast<Derived *>(obj)) - static_cast<void *>(obj)
 
        SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
-       return PyUnicode_FromString(self->m_scriptText);
+       return PyUnicode_From_STR_String(self->m_scriptText);
 }
 
 
index 0d22c3478614ac55d90484f5040b76fe7957c9fd..521a676bf4a86238c4cdf421653fe2f6a5933275 100644 (file)
@@ -42,7 +42,7 @@
 class SCA_IObject;
 class SCA_PythonController : public SCA_IController
 {
-       Py_Header;
+       Py_Header
 #ifdef WITH_PYTHON
        struct _object *                m_bytecode; /* SCA_PYEXEC_SCRIPT only */
        PyObject*                               m_function; /* SCA_PYEXEC_MODULE only */
index 9c761e054f2c54dda0db56479e5be0ddfffe82f8..7ecf76d1581c8b07d3e345f73b81dcea35707ee3 100644 (file)
@@ -31,7 +31,7 @@
 
 class SCA_PythonKeyboard : public PyObjectPlus
 {
-       Py_Header;
+       Py_Header
 private:
        class SCA_IInputDevice *m_keyboard;
 #ifdef WITH_PYTHON
index dfdf00bc6e9e4b16e1a9fdecce0536fd8aded226..4ad655dce8fd2e3cce151b22d5b2a5b9fd1f7af2 100644 (file)
@@ -31,7 +31,7 @@
 
 class SCA_PythonMouse : public PyObjectPlus
 {
-       Py_Header;
+       Py_Header
 private:
        class SCA_IInputDevice *m_mouse;
        class RAS_ICanvas *m_canvas;
index 66d22d5952bede39b4923ccd66c787762565cc94..c439b445a5bae1e749bd8fd1505d22b54b92dacd 100644 (file)
@@ -38,7 +38,7 @@
 
 class SCA_RandomActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
        /** Property to assign to */
        STR_String m_propname;
        
index f0ae2fd2bde6a3d87cedbf63c8d0b955e64c126a..cec8bcdb445a816ccf1b55bc3af5ff02cea16184 100644 (file)
@@ -39,7 +39,7 @@
 
 class SCA_RandomSensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
 
        unsigned int m_currentDraw;
        int m_iteration;
index de0af2ba9d554be6f64dbadc3bfb353adb56c49d..c2cdad2cdf46b92544de52a9d9a93044bcc2bd9f 100644 (file)
@@ -36,7 +36,7 @@
 
 class SCA_XNORController : public SCA_IController
 {
-       Py_Header;
+       Py_Header
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
        SCA_XNORController(SCA_IObject* gameobj);
index 96098082165ffea0b668c56cbcc3f5e6fe57e2ed..1f38a510046d54ea7c32f7b2e8140843c5bb5c8e 100644 (file)
@@ -36,7 +36,7 @@
 
 class SCA_XORController : public SCA_IController
 {
-       Py_Header;
+       Py_Header
        //virtual void Trigger(class SCA_LogicManager* logicmgr);
 public:
        SCA_XORController(SCA_IObject* gameobj);
index 41802a0a19f6eb89af1263b56f4ae9eb932dd7e5..32872592cc53a62a614fcce3f0bd23247df56267 100644 (file)
@@ -116,7 +116,7 @@ public:
  */
 class BL_Shader : public PyObjectPlus
 {
-       Py_Header;
+       Py_Header
 private:
        typedef std::vector<BL_Uniform*>        BL_UniformVec;
        typedef std::vector<BL_DefUniform*>     BL_UniformVecDef;
index a7db2ed16604e6774de071bee5095922da3e65dd..f344735605504a50259e0e0db1c512c4f2006f89 100644 (file)
@@ -39,7 +39,7 @@
 
 class KX_NetworkMessageActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
        bool m_lastEvent;
        class NG_NetworkScene* m_networkscene;  // needed for replication
        STR_String m_toPropName;
index 7ec8f26f8ce60d50758cf339bc0402db778f6820..75800d9b9fa32cb75b5d04904767a6500cb377e1 100644 (file)
@@ -40,7 +40,7 @@ class NG_NetworkScene;
 class KX_NetworkMessageSensor : public SCA_ISensor
 {
        // note: Py_Header MUST BE the first listed here
-       Py_Header;
+       Py_Header
        NG_NetworkScene        *m_NetworkScene;
 
        // The subject we filter on.
index 1b0168266a341a057f64103379bcc74738c40908..683a54f65de29f52dda81e2519ce39a3de9eaebf 100644 (file)
@@ -40,7 +40,7 @@ struct bConstraint;
 
 class KX_ArmatureSensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
        //class CExpression*    m_rightexpr;
 
 protected:
index 236bd6afdc85545d380317de27bea9b10722fa72..2736516bf33573c58b7f7db42c600209aa22f063 100644 (file)
@@ -32,7 +32,7 @@ class KX_Scene;
 
 class KX_BlenderMaterial :  public PyObjectPlus, public RAS_IPolyMaterial
 {
-       Py_Header;
+       Py_Header
 public:
        // --------------------------------
        KX_BlenderMaterial();
index 236e914b9e5eccb4a700c55a3161455a4fb6f4e1..e9c4e99aa3b025f938790d37d0ab9566077e8ef3 100644 (file)
@@ -50,7 +50,7 @@ bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok
 
 class KX_Camera : public KX_GameObject
 {
-       Py_Header;
+       Py_Header
 protected:
        friend class KX_Scene;
        /** Camera parameters (clips distances, focal length). These
index c06904ea56b6d65a0d56403b42e53ea4a8747bbb..a6344ae380a7583a647000576933bb0bd84d16b2 100644 (file)
@@ -49,7 +49,7 @@
 
 class KX_CameraActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 private :
        /** Object that will be tracked. */
        SCA_IObject *m_ob;
index ebaeed9aafed2501ffb2afd407a68c08fb6a0438..b513b141f3e4da666d542f9c705cc6eaab3bc5d6 100644 (file)
@@ -42,7 +42,7 @@ class KX_GameObject;
 
 class KX_ConstraintActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 protected:     
        // Damp time (int),
        int m_posDampTime;
index 8f559881a2e89c0c9a1c5d1c08e150d57cdb748c..980221bd4b35736ff9cae13032a0c26367563015 100644 (file)
@@ -37,7 +37,7 @@
 
 class  KX_ConstraintWrapper : public PyObjectPlus
 {
-       Py_Header;
+       Py_Header
 public:
        KX_ConstraintWrapper(PHY_ConstraintType ctype,int constraintId,class PHY_IPhysicsEnvironment* physenv);
        virtual ~KX_ConstraintWrapper ();
index 15d455b73132b9b0cae376ebacbd0b4208d39b1a..8fc7a9e9f285e1627ba2fed0762765f93a3bbc63 100644 (file)
@@ -38,7 +38,7 @@
 class KX_FontObject : public KX_GameObject
 {
 public:
-       Py_Header;
+       Py_Header
        KX_FontObject(  void* sgReplicationInfo,
                                        SG_Callbacks callbacks,
                                        RAS_IRenderTools* rendertools,
index 1c05d152d391bcf6040b08136b41380d216a1b45..ebc6712a2ddf802cf927caae9d0d15402f31784b 100644 (file)
@@ -40,7 +40,7 @@
 
 class KX_GameActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 protected:
        int                                                     m_mode;
        bool                                            m_restart;
index d3ed9991c3146fb8e3b6323f9516501b2a6014fe..c240a7fcf84a6dd3de774935d471f5d743a186f5 100644 (file)
@@ -1880,7 +1880,7 @@ PyTypeObject KX_GameObject::Type = {
 PyObject* KX_GameObject::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
-       return PyUnicode_FromString(self->GetName().ReadPtr());
+       return PyUnicode_From_STR_String(self->GetName());
 }
 
 PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -2683,7 +2683,7 @@ PyObject* KX_GameObject::PyGetPhysicsId()
 
 PyObject* KX_GameObject::PyGetPropertyNames()
 {
-       PyObject *list=  ConvertKeysToPython();
+       PyObject *list= ConvertKeysToPython();
        
        if(m_attr_dict) {
                PyObject *key, *value;
index 69bc394cbfc94c5db8e2c920720c37ec6f84bbe4..245a92a96de7d051df216b7d8899ee562e7d2492 100644 (file)
@@ -80,7 +80,7 @@ void KX_GameObject_Mathutils_Callback_Init(void);
  */
 class KX_GameObject : public SCA_IObject
 {
-       Py_Header;
+       Py_Header
 protected:
 
        bool                                                            m_bDyna;
index 5ee008ac5e320022b273f29ad8d617a078c7b059..fa26bbaa6e120cb7e99559bc5bd3894dd396e971 100644 (file)
@@ -37,7 +37,7 @@
 
 class KX_IpoActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 private:
        /** Computes the IPO start time from the current time
            and the current frame. */
index cd472311bcf65e624c8295191c57023c045b343d..bb081e6a44449ba411d7381b62ff4f3f6c780a15 100644 (file)
@@ -44,7 +44,7 @@ class MT_Transform;
 
 class KX_LightObject : public KX_GameObject
 {
-       Py_Header;
+       Py_Header
 protected:
        RAS_LightObject         m_lightobj;
        class RAS_IRenderTools* m_rendertools;  //needed for registering and replication of lightobj
index 754ad511669c7fafbe5030b68e2b3f6e7158f59c..fec1d9d296ca1d84b47d2d882ce06926e422ca4c 100644 (file)
@@ -129,7 +129,7 @@ PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds)
                return NULL;
        }
 
-       return PyUnicode_FromString(matname.Ptr());
+       return PyUnicode_From_STR_String(matname);
 
 }
 
@@ -147,7 +147,7 @@ PyObject* KX_MeshProxy::PyGetTextureName(PyObject* args, PyObject* kwds)
                return NULL;
        }
 
-       return PyUnicode_FromString(matname.Ptr());
+       return PyUnicode_From_STR_String(matname);
                
 }
 
index d5292b5108df40cbae5a36e4eec0be94ae3672b9..f59418a5de26cfea9af1fc8854f47fdc9d8115d5 100644 (file)
@@ -41,7 +41,7 @@ bool ConvertPythonToMesh(PyObject * value, class RAS_MeshObject **object, bool p
 
 class KX_MeshProxy     : public CValue
 {
-       Py_Header;
+       Py_Header
 
        class RAS_MeshObject*   m_meshobj;
 public:
index 5fb576eec2891f807c405843d23d2a7dc757549a..277af87f9f2517750f8e760effca242f2c09b8e3 100644 (file)
@@ -47,7 +47,7 @@ class KX_RayCast;
 class KX_MouseFocusSensor : public SCA_MouseSensor
 {
 
-       Py_Header;
+       Py_Header
        
  public:
        
index 287b2b24fa910e1b6b900989ab6511448f63eea8..ad128a0891d31c9d919edaa018150f889d644811 100644 (file)
@@ -36,7 +36,7 @@ class MT_Transform;
 
 class KX_NavMeshObject: public KX_GameObject
 {
-       Py_Header;
+       Py_Header
 
 protected:
        dtStatNavMesh* m_navMesh;
index 1caea59867aa10386d5c6c1fa2d5b19793c09e34..26adcb993b8db8af3c952d1337c9914e5c517524 100644 (file)
@@ -41,7 +41,7 @@ struct PHY_CollData;
 
 class KX_NearSensor : public KX_TouchSensor
 {
-       Py_Header;
+       Py_Header
 protected:
        float   m_Margin;
        float  m_ResetMargin;
index fc6fcb66e28522f4495cd8d613f5e3db04e6b2d5..aa0f844eb88df3628f698ddd795ed06ce0b65c53 100644 (file)
@@ -80,7 +80,7 @@ struct KX_LocalFlags {
 
 class KX_ObjectActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 
        MT_Vector3              m_force;
        MT_Vector3              m_torque;
index 8531675723ac29956d4fe65c0ecd89b94483505c..484b137c2f5c7a7ba58bddf3585cff045f9e69ee 100644 (file)
@@ -41,7 +41,7 @@
 
 class KX_ParentActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
        
        /** Mode */
        int m_mode;
index 0e4c2e71f3ecaa0899c4416850b046bc1fe5d91b..4f03c8fbfb1a5a20f68b12ed0811e8d65c5109bd 100644 (file)
@@ -37,7 +37,7 @@
 
 class  KX_PhysicsObjectWrapper : public PyObjectPlus
 {
-       Py_Header;
+       Py_Header
 public:
        KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv);
        virtual ~KX_PhysicsObjectWrapper();
index 82a93e76cf34194824c8fa0382815c5dd3cf519c..caef8ba5e2e1e888daa889191d72864ae35d65e3 100644 (file)
@@ -216,13 +216,13 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isCollider,
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialName,
 "getMaterialName() : returns the polygon material name, \"NoMaterial\" if no material\n")
 {
-       return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
+       return PyUnicode_From_STR_String(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getTextureName,
 "getTexturelName() : returns the polygon texture name, \"NULL\" if no texture\n")
 {
-       return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
+       return PyUnicode_From_STR_String(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
 }
 
 KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
index d8046b3fec66bee343c2f69979aeb121098875a8..44945e58c2a7e242996430c9fc6915a45662db9f 100644 (file)
@@ -38,7 +38,7 @@
 
 class KX_PolyProxy     : public CValue
 {
-       Py_Header;
+       Py_Header
 protected:
        class RAS_Polygon*              m_polygon;
        class RAS_MeshObject*   m_mesh;
index 3147d6ba4c9dd971ccb8b7b94cf45a1f0a776a36..29127ec11a080e5c33d08c18f594f3025a679ec3 100644 (file)
@@ -346,13 +346,13 @@ KX_PYMETHODDEF_DOC(KX_PolygonMaterial, activate, "activate(rasty, cachingInfo)")
 PyObject* KX_PolygonMaterial::pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
-       return PyUnicode_FromString(self->m_texturename.ReadPtr());
+       return PyUnicode_From_STR_String(self->m_texturename);
 }
 
 PyObject* KX_PolygonMaterial::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
-       return PyUnicode_FromString(self->m_materialname.ReadPtr());
+       return PyUnicode_From_STR_String(self->m_materialname);
 }
 
 /* this does not seem useful */
index 78876c6040941fb1b09c8ee8423dc231e7b53f6a..f20a90f7debd0375856dff92a2c3fdbc1088c30c 100644 (file)
@@ -55,7 +55,7 @@ struct Image;
  */
 class KX_PolygonMaterial : public PyObjectPlus, public RAS_IPolyMaterial
 {
-       Py_Header;
+       Py_Header
 private:
        /** Blender texture face structure. */
        MTFace*                 m_tface;
index 422313fcfefc9674a7c6b81818e5248bd1c10e8a..ee803d9bdb9e994709aaadd93ac3ecefe02b54ec 100644 (file)
@@ -41,7 +41,7 @@
 class KX_RadarSensor : public KX_NearSensor
 {
  protected:
-       Py_Header;
+       Py_Header
                
        float           m_coneradius;
 
index d797666d6ab37edf5a42db554a0ddb2e694b8414..4c0009a5a4c408c19e915255f147123fb7a9f781 100644 (file)
@@ -43,7 +43,7 @@ class KX_RayCast;
 
 class KX_RaySensor : public SCA_ISensor
 {
-       Py_Header;
+       Py_Header
        STR_String              m_propertyname;
        bool                    m_bFindMaterial;
        bool                    m_bXRay;
index 4bb84663e9ec98c37997b730140dec7504e86761..ec5cf305c3eb07be84f671614272c45a9ab96e46 100644 (file)
@@ -45,7 +45,7 @@ class SCA_IScene;
 
 class KX_SCA_AddObjectActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 
        /// Time field: lifetime of the new object
        int     m_timeProp;
index eaad67ad0eadb6b3739b6ea040663044ec20d8b3..5fefbb8cca531ce8bcf0ad21c1416862696ecd76 100644 (file)
@@ -42,7 +42,7 @@
 
 class KX_SCA_DynamicActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 
        // dynamics operation to apply to the game object
        short m_dyn_operation;
index a6bbf258398430e3a23ec9537ebea154605e1d28..7a325257e591b9d15a1c517c806e34bcbad22980 100644 (file)
@@ -41,7 +41,7 @@ class SCA_IScene;
 
 class KX_SCA_EndObjectActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
        SCA_IScene*             m_scene;
 
  public:
index 1e0e2155e62a5a1df0ca1fe0aa6e33e9008a867a..3e07ec2665c627b63be63c9a5b30df7972932a21 100644 (file)
@@ -44,7 +44,7 @@
 
 class KX_SCA_ReplaceMeshActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 
        // mesh reference (mesh to replace)
        RAS_MeshObject* m_mesh;
index f1e0fdc8a5011f0ce44286ea6caeb73351e189df..9b8f7f27d80b058fa9caa770036e2398909fd964 100644 (file)
@@ -2117,7 +2117,7 @@ PySequenceMethods KX_Scene::Sequence = {
 PyObject* KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_Scene* self= static_cast<KX_Scene*>(self_v);
-       return PyUnicode_FromString(self->GetName().ReadPtr());
+       return PyUnicode_From_STR_String(self->GetName());
 }
 
 PyObject* KX_Scene::pyattr_get_objects(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
index 67508f5741baa3188619ee31aa48ef2883f6a4b3..c8070736b7f930b6be413aabdb6a83a0e36d5d8f 100644 (file)
@@ -101,7 +101,7 @@ class KX_ObstacleSimulation;
  * */
 class KX_Scene : public PyObjectPlus, public SCA_IScene
 {
-       Py_Header;
+       Py_Header
 
 #ifdef WITH_PYTHON
        PyObject*       m_attr_dict;
index 30f325a775e27a265149b50180cab915f18c9813..9064146a1d4e625f5775a6b141fcc94e9fcf3042 100644 (file)
@@ -38,7 +38,7 @@
 
 class KX_SceneActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
        
        int                                                     m_mode;
        // (restart) has become a toggle internally... not in the interface though
index 174bcc8f990a26937d3621c78519c0da8e0349a4..b9119677f4f26f372ad8f295c4509c0244d25e8f 100644 (file)
@@ -57,7 +57,7 @@ typedef struct KX_3DSoundSettings
 
 class KX_SoundActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
        bool                                    m_isplaying;
        AUD_Reference<AUD_IFactory>                             m_sound;
        float                                   m_volume;
index 3d1dc64d8912637ccc54234567fbd66f10617237..aa17b68746342592c6e8bf59e616540518b839cc 100644 (file)
@@ -44,7 +44,7 @@
  */
 class KX_StateActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 
        /** Make visible? */
        enum {
index 38be7bce57badba14fc18b0e110ad10b034452e3..a0ae8e0d1d99bc9b08782c07bd8bbe7e1a077b75 100644 (file)
@@ -47,7 +47,7 @@ const int MAX_PATH_LENGTH  = 128;
 
 class KX_SteeringActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 
        /** Target object */
        KX_GameObject *m_target;
index a111bf31cf6bfbab0b6a375339113f343dd53b8b..1fae766aa1377ba24fc8cdad680270465db8b753 100644 (file)
@@ -51,7 +51,7 @@ class KX_TouchEventManager;
 class KX_TouchSensor : public SCA_ISensor
 {
 protected:
-       Py_Header;
+       Py_Header
 
        /**
         * The sensor should only look for objects with this property.
index 9d267bfe89ac95a5f7a31aa7ea1f1fdd00f1d708..30e276c00215c884883ec7f80ce0733f93c00968 100644 (file)
@@ -40,7 +40,7 @@
 
 class KX_TrackToActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
        // Object reference. Actually, we use the object's 'life'
        SCA_IObject*    m_object;
        // 3d toggle
index f750912c95b41dee874bd05b79341ec7a8f41aea..f6e360d34a86076dfcaedc3ad96ac6a918cce877 100644 (file)
@@ -16,7 +16,7 @@ class PHY_IMotionState;
 ///Python interface to physics vehicles (primarily 4-wheel cars and 2wheel bikes)
 class  KX_VehicleWrapper : public PyObjectPlus
 {
-       Py_Header;
+       Py_Header
 
        std::vector<PHY_IMotionState*> m_motionStates;
 
index 4ae662faa122c8946492d691627323593cf4a4f4..905a4e0f4ab833408493634319097901d0c2ec8e 100644 (file)
@@ -38,7 +38,7 @@
 
 class KX_VertexProxy   : public CValue
 {
-       Py_Header;
+       Py_Header
 protected:
 
        class RAS_TexVert*      m_vertex;
index 0ffe1de648068a82b21a8dd457572011c03f2139..f5c45ecbd99afe9ecaef2c06424763c399074ba7 100644 (file)
@@ -37,7 +37,7 @@
 
 class KX_VisibilityActuator : public SCA_IActuator
 {
-       Py_Header;
+       Py_Header
 
        /** Make visible? */
        bool m_visible;