Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-06-29 06:25:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-29 06:25:54 +0400
commitc50bbe5ae726edfb265bd54cb7ce0e547e3f4b31 (patch)
tree2fcb879d619b0794a7632575f64e5825949de4cf
parentbb1f24ac443bcc386cf2cc3765609aaf9bf51db1 (diff)
BGE Py API using python3 c/api calls. include bpy_compat.h to support py2.x
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp12
-rw-r--r--source/gameengine/Converter/BL_ShapeActionActuator.cpp8
-rw-r--r--source/gameengine/Expressions/BoolValue.cpp2
-rw-r--r--source/gameengine/Expressions/IntValue.cpp2
-rw-r--r--source/gameengine/Expressions/ListValue.cpp22
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp44
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h16
-rw-r--r--source/gameengine/Expressions/StringValue.h2
-rw-r--r--source/gameengine/Expressions/Value.cpp14
-rw-r--r--source/gameengine/Expressions/Value.h2
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorSensor.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_DelaySensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_IController.cpp8
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp10
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp34
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp24
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.cpp10
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyActuator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PropertySensor.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp16
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp12
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp10
-rw-r--r--source/gameengine/Ketsji/BL_Shader.cpp8
-rw-r--r--source/gameengine/Ketsji/BL_Shader.h2
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h2
-rw-r--r--source/gameengine/Ketsji/KX_CDActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp20
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintActuator.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp30
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h2
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp20
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_ParentActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.cpp36
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.h2
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp38
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_Scene.h2
-rw-r--r--source/gameengine/Ketsji/KX_SceneActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp14
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_VehicleWrapper.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp10
-rw-r--r--source/gameengine/VideoTexture/FilterBlueScreen.cpp20
-rw-r--r--source/gameengine/VideoTexture/FilterColor.cpp8
-rw-r--r--source/gameengine/VideoTexture/FilterNormal.cpp4
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp16
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.cpp16
-rw-r--r--source/gameengine/VideoTexture/VideoBase.cpp4
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp4
-rw-r--r--source/gameengine/VideoTexture/blendVideoTex.cpp2
66 files changed, 317 insertions, 325 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 1787909b064..d9e65c53fac 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -446,7 +446,7 @@ PyObject* BL_ActionActuator::PyGetAction(PyObject* args,
ShowDeprecationWarning("getAction()", "the action property");
if (m_action){
- return PyString_FromString(m_action->id.name+2);
+ return PyUnicode_FromString(m_action->id.name+2);
}
Py_RETURN_NONE;
}
@@ -796,7 +796,7 @@ PyObject* BL_ActionActuator::PySetFrameProperty(PyObject* args,
}
PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
- char *string= PyString_AsString(value);
+ char *string= _PyUnicode_AsString(value);
if (!string) {
PyErr_SetString(PyExc_TypeError, "expected a single string");
@@ -888,7 +888,7 @@ PyObject* BL_ActionActuator::PySetType(PyObject* args,
PyObject* BL_ActionActuator::PyGetContinue() {
ShowDeprecationWarning("getContinue()", "the continue property");
- return PyInt_FromLong((long)(m_end_reset==0));
+ return PyLong_FromSsize_t((long)(m_end_reset==0));
}
PyObject* BL_ActionActuator::PySetContinue(PyObject* value) {
@@ -1066,21 +1066,21 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
- return PyString_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
+ return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
}
int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
- if (!PyString_Check(value))
+ if (!PyUnicode_Check(value))
{
PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, expected the string name of the action");
return PY_SET_ATTR_FAIL;
}
bAction *action= NULL;
- STR_String val = PyString_AsString(value);
+ STR_String val = _PyUnicode_AsString(value);
if (val != "")
{
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
index b92e94b6e04..4c9a584d72b 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
@@ -486,7 +486,7 @@ const char BL_ShapeActionActuator::GetAction_doc[] =
PyObject* BL_ShapeActionActuator::PyGetAction() {
ShowDeprecationWarning("getAction()", "the action property");
if (m_action){
- return PyString_FromString(m_action->id.name+2);
+ return PyUnicode_FromString(m_action->id.name+2);
}
Py_RETURN_NONE;
}
@@ -845,21 +845,21 @@ PyObject* BL_ShapeActionActuator::PySetType(PyObject* args) {
PyObject* BL_ShapeActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ShapeActionActuator* self= static_cast<BL_ShapeActionActuator*>(self_v);
- return PyString_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
+ return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
}
int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ShapeActionActuator* self= static_cast<BL_ShapeActionActuator*>(self_v);
/* exact copy of BL_ActionActuator's function from here down */
- if (!PyString_Check(value))
+ if (!PyUnicode_Check(value))
{
PyErr_SetString(PyExc_ValueError, "actuator.action = val: Shape Action Actuator, expected the string name of the action");
return PY_SET_ATTR_FAIL;
}
bAction *action= NULL;
- STR_String val = PyString_AsString(value);
+ STR_String val = _PyUnicode_AsString(value);
if (val != "")
{
diff --git a/source/gameengine/Expressions/BoolValue.cpp b/source/gameengine/Expressions/BoolValue.cpp
index d90da8b3a92..1102b12fdc4 100644
--- a/source/gameengine/Expressions/BoolValue.cpp
+++ b/source/gameengine/Expressions/BoolValue.cpp
@@ -210,5 +210,5 @@ CValue* CBoolValue::GetReplica()
PyObject* CBoolValue::ConvertValueToPython()
{
- return PyInt_FromLong(m_bool != 0);
+ return PyBool_FromLong(m_bool != 0);
}
diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp
index 227518e9439..b782de4bef6 100644
--- a/source/gameengine/Expressions/IntValue.cpp
+++ b/source/gameengine/Expressions/IntValue.cpp
@@ -330,7 +330,7 @@ void CIntValue::SetValue(CValue* newval)
PyObject* CIntValue::ConvertValueToPython()
{
if((m_int > INT_MIN) && (m_int < INT_MAX))
- return PyInt_FromLong(m_int);
+ return PyLong_FromSsize_t(m_int);
else
return PyLong_FromLongLong(m_int);
}
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index 4cad4728521..34a357aa5f1 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -76,9 +76,9 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
return NULL;
}
- if (PyString_Check(pyindex))
+ if (PyUnicode_Check(pyindex))
{
- CValue *item = ((CListValue*) list)->FindValue(PyString_AsString(pyindex));
+ CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(pyindex));
if (item) {
PyObject* pyobj = item->ConvertValueToPython();
if(pyobj)
@@ -87,14 +87,14 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
return item->GetProxy();
}
}
- else if (PyInt_Check(pyindex))
+ else if (PyLong_Check(pyindex))
{
- int index = PyInt_AsLong(pyindex);
+ int index = PyLong_AsSsize_t(pyindex);
return listvalue_buffer_item(self, index); /* wont add a ref */
}
PyObject *pyindex_str = PyObject_Repr(pyindex); /* new ref */
- PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", PyString_AsString(pyindex_str));
+ PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", _PyUnicode_AsString(pyindex_str));
Py_DECREF(pyindex_str);
return NULL;
}
@@ -220,8 +220,8 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value)
return -1;
}
- if (PyString_Check(value)) {
- if (self->FindValue((const char *)PyString_AsString(value))) {
+ if (PyUnicode_Check(value)) {
+ if (self->FindValue((const char *)_PyUnicode_AsString(value))) {
return 1;
}
}
@@ -542,7 +542,7 @@ PyObject* CListValue::Pyindex(PyObject *value)
CValue* elem = GetValue(i);
if (checkobj==elem || CheckEqual(checkobj,elem))
{
- result = PyInt_FromLong(i);
+ result = PyLong_FromSsize_t(i);
break;
}
}
@@ -565,7 +565,7 @@ PyObject* CListValue::Pycount(PyObject* value)
if (checkobj==NULL) { /* in this case just return that there are no items in the list */
PyErr_Clear();
- return PyInt_FromLong(0);
+ return PyLong_FromSsize_t(0);
}
int numelem = GetCount();
@@ -579,7 +579,7 @@ PyObject* CListValue::Pycount(PyObject* value)
}
checkobj->Release();
- return PyInt_FromLong(numfound);
+ return PyLong_FromSsize_t(numfound);
}
/* Matches python dict.get(key, [default]) */
@@ -606,7 +606,7 @@ PyObject* CListValue::Pyget(PyObject *args)
/* Matches python dict.has_key() */
PyObject* CListValue::Pyhas_key(PyObject* value)
{
- if (PyString_Check(value) && FindValue((const char *)PyString_AsString(value)))
+ if (PyUnicode_Check(value) && FindValue((const char *)_PyUnicode_AsString(value)))
Py_RETURN_TRUE;
Py_RETURN_FALSE;
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 552e839d2b8..863390f209d 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -183,14 +183,14 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
{
bool *val = reinterpret_cast<bool*>(ptr);
ptr += sizeof(bool);
- PyList_SET_ITEM(resultlist,i,PyInt_FromLong(*val));
+ PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *val = reinterpret_cast<short int*>(ptr);
ptr += sizeof(short int);
- PyList_SET_ITEM(resultlist,i,PyInt_FromLong(*val));
+ PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_ENUM:
@@ -205,7 +205,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
{
int *val = reinterpret_cast<int*>(ptr);
ptr += sizeof(int);
- PyList_SET_ITEM(resultlist,i,PyInt_FromLong(*val));
+ PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_FLOAT:
@@ -229,12 +229,12 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
case KX_PYATTRIBUTE_TYPE_BOOL:
{
bool *val = reinterpret_cast<bool*>(ptr);
- return PyInt_FromLong(*val);
+ return PyLong_FromSsize_t(*val);
}
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *val = reinterpret_cast<short int*>(ptr);
- return PyInt_FromLong(*val);
+ return PyLong_FromSsize_t(*val);
}
case KX_PYATTRIBUTE_TYPE_ENUM:
// enum are like int, just make sure the field size is the same
@@ -246,7 +246,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
case KX_PYATTRIBUTE_TYPE_INT:
{
int *val = reinterpret_cast<int*>(ptr);
- return PyInt_FromLong(*val);
+ return PyLong_FromSsize_t(*val);
}
case KX_PYATTRIBUTE_TYPE_FLOAT:
{
@@ -271,7 +271,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 PyString_FromString(*val);
+ return PyUnicode_FromString(*val);
}
default:
return NULL;
@@ -352,9 +352,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
bool *var = reinterpret_cast<bool*>(ptr);
ptr += sizeof(bool);
- if (PyInt_Check(item))
+ if (PyLong_Check(item))
{
- *var = (PyInt_AsLong(item) != 0);
+ *var = (PyLong_AsSsize_t(item) != 0);
}
else if (PyBool_Check(item))
{
@@ -371,9 +371,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
short int *var = reinterpret_cast<short int*>(ptr);
ptr += sizeof(short int);
- if (PyInt_Check(item))
+ if (PyLong_Check(item))
{
- long val = PyInt_AsLong(item);
+ long val = PyLong_AsSsize_t(item);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -407,9 +407,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
int *var = reinterpret_cast<int*>(ptr);
ptr += sizeof(int);
- if (PyInt_Check(item))
+ if (PyLong_Check(item))
{
- long val = PyInt_AsLong(item);
+ long val = PyLong_AsSsize_t(item);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -542,9 +542,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_BOOL:
{
bool *var = reinterpret_cast<bool*>(ptr);
- if (PyInt_Check(value))
+ if (PyLong_Check(value))
{
- *var = (PyInt_AsLong(value) != 0);
+ *var = (PyLong_AsSsize_t(value) != 0);
}
else if (PyBool_Check(value))
{
@@ -560,9 +560,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *var = reinterpret_cast<short int*>(ptr);
- if (PyInt_Check(value))
+ if (PyLong_Check(value))
{
- long val = PyInt_AsLong(value);
+ long val = PyLong_AsSsize_t(value);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -595,9 +595,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_INT:
{
int *var = reinterpret_cast<int*>(ptr);
- if (PyInt_Check(value))
+ if (PyLong_Check(value))
{
- long val = PyInt_AsLong(value);
+ long val = PyLong_AsSsize_t(value);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -682,9 +682,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_STRING:
{
STR_String *var = reinterpret_cast<STR_String*>(ptr);
- if (PyString_Check(value))
+ if (PyUnicode_Check(value))
{
- char *val = PyString_AsString(value);
+ char *val = _PyUnicode_AsString(value);
if (attrdef->m_clamp)
{
if (strlen(val) < attrdef->m_imin)
@@ -859,7 +859,7 @@ void PyObjectPlus::ShowDeprecationWarning_func(const char* old_way,const char* n
co_filename= PyObject_GetAttrString(f_code, "co_filename");
if (co_filename) {
- printf("\t%s:%d\n", PyString_AsString(co_filename), (int)PyInt_AsLong(f_lineno));
+ printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno));
Py_DECREF(f_lineno);
Py_DECREF(f_code);
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 0fe3e9f083d..ee69e7d3b07 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -51,19 +51,9 @@ extern "C" {
}
#endif
-#if PY_VERSION_HEX > 0x03000000
-#define PyString_FromString PyUnicode_FromString
-#define PyString_FromFormat PyUnicode_FromFormat
-#define PyString_Check PyUnicode_Check
-#define PyString_Size PyUnicode_GetSize
-
-#define PyInt_FromLong PyLong_FromSsize_t
-#define PyInt_AsLong PyLong_AsSsize_t
-#define PyString_AsString _PyUnicode_AsString
-#define PyInt_Check PyLong_Check
-#define PyInt_AS_LONG PyLong_AsLong // TODO - check this one
-#endif
-
+extern "C" {
+#include "../../blender/python/intern/bpy_compat.h"
+}
/*
diff --git a/source/gameengine/Expressions/StringValue.h b/source/gameengine/Expressions/StringValue.h
index 52f8a580f4d..c580e8fd23a 100644
--- a/source/gameengine/Expressions/StringValue.h
+++ b/source/gameengine/Expressions/StringValue.h
@@ -40,7 +40,7 @@ public:
virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); };
virtual CValue* GetReplica();
virtual PyObject* ConvertValueToPython() {
- return PyString_FromString(m_strString.Ptr());
+ return PyUnicode_FromString(m_strString.Ptr());
}
private:
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index 45eb15ecd08..a9b44495495 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -74,7 +74,7 @@ PyObject* CValue::PyGetName()
{
ShowDeprecationWarning("getName()", "the name property");
- return PyString_FromString(this->GetName());
+ return PyUnicode_FromString(this->GetName());
}
/*#define CVALUE_DEBUG*/
@@ -555,7 +555,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 PyString_FromString(self->GetName());
+ return PyUnicode_FromString(self->GetName());
}
CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
@@ -599,21 +599,23 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
{
vallie = new CFloatValue( (float)PyFloat_AsDouble(pyobj) );
} else
+#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(pyobj))
{
vallie = new CIntValue( (cInt)PyInt_AS_LONG(pyobj) );
} else
+#endif
if (PyLong_Check(pyobj))
{
vallie = new CIntValue( (cInt)PyLong_AsLongLong(pyobj) );
} else
- if (PyString_Check(pyobj))
+ if (PyUnicode_Check(pyobj))
{
- vallie = new CStringValue(PyString_AsString(pyobj),"");
+ vallie = new CStringValue(_PyUnicode_AsString(pyobj),"");
} else
if (BGE_PROXY_CHECK_TYPE(pyobj)) /* Note, dont let these get assigned to GameObject props, must check elsewhere */
{
- if (BGE_PROXY_REF(pyobj) && PyObject_TypeCheck(BGE_PROXY_REF(pyobj), &CValue::Type))
+ if (BGE_PROXY_REF(pyobj) && PyObject_TypeCheck((PyObject *)BGE_PROXY_REF(pyobj), &CValue::Type))
{
vallie = (static_cast<CValue *>(BGE_PROXY_REF(pyobj)))->AddRef();
} else {
@@ -642,7 +644,7 @@ PyObject* CValue::ConvertKeysToPython( void )
std::map<STR_String,CValue*>::iterator it;
for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++)
{
- pystr = PyString_FromString( (*it).first );
+ pystr = PyUnicode_FromString( (*it).first );
PyList_Append(pylist, pystr);
Py_DECREF( pystr );
}
diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h
index 9da75b96e78..8c9f99b335e 100644
--- a/source/gameengine/Expressions/Value.h
+++ b/source/gameengine/Expressions/Value.h
@@ -219,7 +219,7 @@ public:
//static PyObject* PyMake(PyObject*,PyObject*);
virtual PyObject *py_repr(void)
{
- return PyString_FromString((const char*)GetText());
+ return PyUnicode_FromString((const char*)GetText());
}
virtual PyObject* ConvertValueToPython() {
diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
index b6a9471f23c..9d2642ba01a 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
@@ -181,7 +181,7 @@ const char SCA_ActuatorSensor::GetActuator_doc[] =
PyObject* SCA_ActuatorSensor::PyGetActuator()
{
ShowDeprecationWarning("getActuator()", "the actuator property");
- return PyString_FromString(m_checkactname);
+ return PyUnicode_FromString(m_checkactname);
}
/* 4. setActuator */
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
index afc9028d95d..db6a6af7928 100644
--- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp
@@ -245,7 +245,7 @@ const char SCA_DelaySensor::GetDelay_doc[] =
PyObject* SCA_DelaySensor::PyGetDelay()
{
ShowDeprecationWarning("getDelay()", "the delay property");
- return PyInt_FromLong(m_delay);
+ return PyLong_FromSsize_t(m_delay);
}
const char SCA_DelaySensor::GetDuration_doc[] =
@@ -254,7 +254,7 @@ const char SCA_DelaySensor::GetDuration_doc[] =
PyObject* SCA_DelaySensor::PyGetDuration()
{
ShowDeprecationWarning("getDuration()", "the duration property");
- return PyInt_FromLong(m_duration);
+ return PyLong_FromSsize_t(m_duration);
}
const char SCA_DelaySensor::GetRepeat_doc[] =
diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp
index 7880daf0eb4..4b7c462b6f7 100644
--- a/source/gameengine/GameLogic/SCA_IController.cpp
+++ b/source/gameengine/GameLogic/SCA_IController.cpp
@@ -263,7 +263,7 @@ PyObject* SCA_IController::PyGetSensor(PyObject* value)
{
ShowDeprecationWarning("getSensor(string)", "the sensors[string] property");
- char *scriptArg = PyString_AsString(value);
+ char *scriptArg = _PyUnicode_AsString(value);
if (scriptArg==NULL) {
PyErr_SetString(PyExc_TypeError, "controller.getSensor(string): Python Controller, expected a string (sensor name)");
return NULL;
@@ -287,7 +287,7 @@ PyObject* SCA_IController::PyGetActuator(PyObject* value)
{
ShowDeprecationWarning("getActuator(string)", "the actuators[string] property");
- char *scriptArg = PyString_AsString(value);
+ char *scriptArg = _PyUnicode_AsString(value);
if (scriptArg==NULL) {
PyErr_SetString(PyExc_TypeError, "controller.getActuator(string): Python Controller, expected a string (actuator name)");
return NULL;
@@ -322,13 +322,13 @@ PyObject* SCA_IController::PyGetSensors()
PyObject* SCA_IController::PyGetState()
{
ShowDeprecationWarning("getState()", "the state property");
- return PyInt_FromLong(m_statemask);
+ return PyLong_FromSsize_t(m_statemask);
}
PyObject* SCA_IController::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_IController* self= static_cast<SCA_IController*>(self_v);
- return PyInt_FromLong(self->m_statemask);
+ return PyLong_FromSsize_t(self->m_statemask);
}
PyObject* SCA_IController::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
index d747daec2b4..9d0b9b30ff6 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
@@ -275,7 +275,7 @@ PyObject* SCA_ILogicBrick::PySetExecutePriority(PyObject* args)
PyObject* SCA_ILogicBrick::PyGetExecutePriority()
{
ShowDeprecationWarning("getExecutePriority()", "the executePriority property");
- return PyInt_FromLong(m_Execute_Priority);
+ return PyLong_FromSsize_t(m_Execute_Priority);
}
@@ -305,5 +305,5 @@ bool SCA_ILogicBrick::PyArgToBool(int boolArg)
PyObject* SCA_ILogicBrick::BoolToPyArg(bool boolarg)
{
- return PyInt_FromLong(boolarg? KX_TRUE: KX_FALSE);
+ return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE);
}
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index de7030197b2..d68afebbc20 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -300,7 +300,7 @@ PyObject* SCA_ISensor::PyIsPositive()
{
ShowDeprecationWarning("isPositive()", "the read-only positive property");
int retval = GetState();
- return PyInt_FromLong(retval);
+ return PyLong_FromSsize_t(retval);
}
const char SCA_ISensor::IsTriggered_doc[] =
@@ -313,7 +313,7 @@ PyObject* SCA_ISensor::PyIsTriggered()
int retval = 0;
if (SCA_PythonController::m_sCurrentController)
retval = SCA_PythonController::m_sCurrentController->IsTriggered(this);
- return PyInt_FromLong(retval);
+ return PyLong_FromSsize_t(retval);
}
/**
@@ -354,7 +354,7 @@ const char SCA_ISensor::GetFrequency_doc[] =
PyObject* SCA_ISensor::PyGetFrequency()
{
ShowDeprecationWarning("getFrequency()", "the frequency property");
- return PyInt_FromLong(m_pulse_frequency);
+ return PyLong_FromSsize_t(m_pulse_frequency);
}
/**
@@ -553,13 +553,13 @@ PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_D
int retval = 0;
if (SCA_PythonController::m_sCurrentController)
retval = SCA_PythonController::m_sCurrentController->IsTriggered(self);
- return PyInt_FromLong(retval);
+ return PyLong_FromSsize_t(retval);
}
PyObject* SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
- return PyInt_FromLong(self->GetState());
+ return PyLong_FromSsize_t(self->GetState());
}
int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 645c73efaa4..f91ccff799c 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -329,7 +329,7 @@ const char SCA_JoystickSensor::GetIndex_doc[] =
"\tReturns the joystick index to use.\n";
PyObject* SCA_JoystickSensor::PyGetIndex( ) {
ShowDeprecationWarning("getIndex()", "the index property");
- return PyInt_FromLong(m_joyindex);
+ return PyLong_FromSsize_t(m_joyindex);
}
@@ -339,7 +339,7 @@ const char SCA_JoystickSensor::SetIndex_doc[] =
"\tSets the joystick index to use.\n";
PyObject* SCA_JoystickSensor::PySetIndex( PyObject* value ) {
ShowDeprecationWarning("setIndex()", "the index property");
- int index = PyInt_AsLong( value ); /* -1 on error, will raise an error in this case */
+ int index = PyLong_AsSsize_t( value ); /* -1 on error, will raise an error in this case */
if (index < 0 || index >= JOYINDEX_MAX) {
PyErr_SetString(PyExc_ValueError, "joystick index out of range or not an int");
return NULL;
@@ -390,7 +390,7 @@ PyObject* SCA_JoystickSensor::PyGetAxisValue( ) {
PyObject *list= PyList_New(axis_index);
while(axis_index--) {
- PyList_SET_ITEM(list, axis_index, PyInt_FromLong(joy->GetAxisPosition(axis_index)));
+ PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index)));
}
return list;
@@ -403,7 +403,7 @@ const char SCA_JoystickSensor::GetThreshold_doc[] =
"\tReturns the threshold of the axis.\n";
PyObject* SCA_JoystickSensor::PyGetThreshold( ) {
ShowDeprecationWarning("getThreshold()", "the threshold property");
- return PyInt_FromLong(m_precision);
+ return PyLong_FromSsize_t(m_precision);
}
@@ -427,7 +427,7 @@ const char SCA_JoystickSensor::GetButton_doc[] =
"\tReturns the current button this sensor is checking.\n";
PyObject* SCA_JoystickSensor::PyGetButton( ) {
ShowDeprecationWarning("getButton()", "the button property");
- return PyInt_FromLong(m_button);
+ return PyLong_FromSsize_t(m_button);
}
/* set button -------------------------------------------------------- */
@@ -436,7 +436,7 @@ const char SCA_JoystickSensor::SetButton_doc[] =
"\tSets the button the sensor reacts to.\n";
PyObject* SCA_JoystickSensor::PySetButton( PyObject* value ) {
ShowDeprecationWarning("setButton()", "the button property");
- int button = PyInt_AsLong(value);
+ int button = PyLong_AsSsize_t(value);
if(button==-1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_ValueError, "expected an int");
return NULL;
@@ -467,7 +467,7 @@ PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) {
if(joy) {
for (i=0; i < joy->GetNumberOfButtons(); i++) {
if (joy->aButtonPressIsPositive(i)) {
- value = PyInt_FromLong(i);
+ value = PyLong_FromSsize_t(i);
PyList_Append(ls, value);
Py_DECREF(value);
}
@@ -529,7 +529,7 @@ PyObject* SCA_JoystickSensor::PyNumberOfAxes( ) {
ShowDeprecationWarning("getNumAxes()", "the numAxis property");
SCA_Joystick *joy = m_pJoystickMgr->GetJoystickDevice(m_joyindex);
// when the joystick is null their is 0 exis still. dumb but scripters should use isConnected()
- return PyInt_FromLong( joy ? joy->GetNumberOfAxes() : 0 );
+ return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 );
}
@@ -539,7 +539,7 @@ const char SCA_JoystickSensor::NumberOfButtons_doc[] =
PyObject* SCA_JoystickSensor::PyNumberOfButtons( ) {
ShowDeprecationWarning("getNumButtons()", "the numButtons property");
SCA_Joystick *joy = m_pJoystickMgr->GetJoystickDevice(m_joyindex);
- return PyInt_FromLong( joy ? joy->GetNumberOfButtons() : 0 );
+ return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 );
}
@@ -549,7 +549,7 @@ const char SCA_JoystickSensor::NumberOfHats_doc[] =
PyObject* SCA_JoystickSensor::PyNumberOfHats( ) {
ShowDeprecationWarning("getNumHats()", "the numHats property");
SCA_Joystick *joy = m_pJoystickMgr->GetJoystickDevice(m_joyindex);
- return PyInt_FromLong( joy ? joy->GetNumberOfHats() : 0 );
+ return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 );
}
const char SCA_JoystickSensor::Connected_doc[] =
@@ -571,7 +571,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYAT
PyObject *list= PyList_New(axis_index);
while(axis_index--) {
- PyList_SET_ITEM(list, axis_index, PyInt_FromLong(joy->GetAxisPosition(axis_index)));
+ PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index)));
}
return list;
@@ -587,7 +587,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT
return NULL;
}
- return PyInt_FromLong(joy->GetAxisPosition(self->m_axis-1));
+ return PyLong_FromSsize_t(joy->GetAxisPosition(self->m_axis-1));
}
PyObject* SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -599,7 +599,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATT
PyObject *list= PyList_New(hat_index);
while(hat_index--) {
- PyList_SET_ITEM(list, hat_index, PyInt_FromLong(joy->GetHat(hat_index)));
+ PyList_SET_ITEM(list, hat_index, PyLong_FromSsize_t(joy->GetHat(hat_index)));
}
return list;
@@ -610,28 +610,28 @@ PyObject* SCA_JoystickSensor::pyattr_get_hat_single(void *self_v, const KX_PYATT
SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = self->m_pJoystickMgr->GetJoystickDevice(self->m_joyindex);
- return PyInt_FromLong(joy->GetHat(self->m_hat-1));
+ return PyLong_FromSsize_t(joy->GetHat(self->m_hat-1));
}
PyObject* SCA_JoystickSensor::pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = self->m_pJoystickMgr->GetJoystickDevice(self->m_joyindex);
- return PyInt_FromLong( joy ? joy->GetNumberOfAxes() : 0 );
+ return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 );
}
PyObject* SCA_JoystickSensor::pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = self->m_pJoystickMgr->GetJoystickDevice(self->m_joyindex);
- return PyInt_FromLong( joy ? joy->GetNumberOfButtons() : 0 );
+ return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 );
}
PyObject* SCA_JoystickSensor::pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = self->m_pJoystickMgr->GetJoystickDevice(self->m_joyindex);
- return PyInt_FromLong( joy ? joy->GetNumberOfHats() : 0 );
+ return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 );
}
PyObject* SCA_JoystickSensor::pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index 34ade17ffb7..cbf25f10291 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -417,7 +417,7 @@ const char SCA_KeyboardSensor::GetKey_doc[] =
PyObject* SCA_KeyboardSensor::PyGetKey()
{
ShowDeprecationWarning("getKey()", "the key property");
- return PyInt_FromLong(m_hotkey);
+ return PyLong_FromSsize_t(m_hotkey);
}
/** 2. SetKey: change the key to look at */
@@ -449,7 +449,7 @@ const char SCA_KeyboardSensor::GetHold1_doc[] =
PyObject* SCA_KeyboardSensor::PyGetHold1()
{
ShowDeprecationWarning("getHold1()", "the hold1 property");
- return PyInt_FromLong(m_qual);
+ return PyLong_FromSsize_t(m_qual);
}
/** 4. SetHold1: change the first bucky bit */
@@ -481,7 +481,7 @@ const char SCA_KeyboardSensor::GetHold2_doc[] =
PyObject* SCA_KeyboardSensor::PyGetHold2()
{
ShowDeprecationWarning("getHold2()", "the hold2 property");
- return PyInt_FromLong(m_qual2);
+ return PyLong_FromSsize_t(m_qual2);
}
/** 6. SetHold2: change the second bucky bit */
@@ -531,8 +531,8 @@ PyObject* SCA_KeyboardSensor::PyGetPressedKeys()
|| (inevent.m_status == SCA_InputEvent::KX_JUSTRELEASED))
{
PyObject* keypair = PyList_New(2);
- PyList_SET_ITEM(keypair,0,PyInt_FromLong(i));
- PyList_SET_ITEM(keypair,1,PyInt_FromLong(inevent.m_status));
+ PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
+ PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
PyList_SET_ITEM(resultlist,index,keypair);
index++;
@@ -571,8 +571,8 @@ PyObject* SCA_KeyboardSensor::PyGetCurrentlyPressedKeys()
|| (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED))
{
PyObject* keypair = PyList_New(2);
- PyList_SET_ITEM(keypair,0,PyInt_FromLong(i));
- PyList_SET_ITEM(keypair,1,PyInt_FromLong(inevent.m_status));
+ PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
+ PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
PyList_SET_ITEM(resultlist,index,keypair);
index++;
@@ -591,12 +591,12 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
"getKeyStatus(keycode)\n"
"\tGet the given key's status (KX_NO_INPUTSTATUS, KX_JUSTACTIVATED, KX_ACTIVE or KX_JUSTRELEASED).\n")
{
- if (!PyInt_Check(value)) {
+ if (!PyLong_Check(value)) {
PyErr_SetString(PyExc_ValueError, "sensor.getKeyStatus(int): Keyboard Sensor, expected an int");
return NULL;
}
- int keycode = PyInt_AsLong(value);
+ int keycode = PyLong_AsSsize_t(value);
if ((keycode < SCA_IInputDevice::KX_BEGINKEY)
|| (keycode > SCA_IInputDevice::KX_ENDKEY)){
@@ -606,7 +606,7 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
SCA_IInputDevice* inputdev = m_pKeyboardMgr->GetInputDevice();
const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) keycode);
- return PyInt_FromLong(inevent.m_status);
+ return PyLong_FromSsize_t(inevent.m_status);
}
/* ------------------------------------------------------------------------- */
@@ -683,8 +683,8 @@ PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
{
PyObject* keypair = PyList_New(2);
- PyList_SET_ITEM(keypair,0,PyInt_FromLong(i));
- PyList_SET_ITEM(keypair,1,PyInt_FromLong(inevent.m_status));
+ PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
+ PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
PyList_Append(resultlist,keypair);
}
}
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index 3a1e6191fdb..608aa043461 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -253,7 +253,7 @@ const char SCA_MouseSensor::GetXPosition_doc[] =
"\tpixels\n";
PyObject* SCA_MouseSensor::PyGetXPosition() {
ShowDeprecationWarning("getXPosition()", "the position property");
- return PyInt_FromLong(m_x);
+ return PyLong_FromSsize_t(m_x);
}
/* get y position ---------------------------------------------------------- */
@@ -264,7 +264,7 @@ const char SCA_MouseSensor::GetYPosition_doc[] =
"\tpixels\n";
PyObject* SCA_MouseSensor::PyGetYPosition() {
ShowDeprecationWarning("getYPosition()", "the position property");
- return PyInt_FromLong(m_y);
+ return PyLong_FromSsize_t(m_y);
}
//<----- Deprecated
@@ -272,9 +272,9 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
"getButtonStatus(button)\n"
"\tGet the given button's status (KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED).\n")
{
- if (PyInt_Check(value))
+ if (PyLong_Check(value))
{
- int button = PyInt_AsLong(value);
+ int button = PyLong_AsSsize_t(value);
if ((button < SCA_IInputDevice::KX_LEFTMOUSE)
|| (button > SCA_IInputDevice::KX_RIGHTMOUSE)){
@@ -284,7 +284,7 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
SCA_IInputDevice* mousedev = m_pMouseMgr->GetInputDevice();
const SCA_InputEvent& event = mousedev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) button);
- return PyInt_FromLong(event.m_status);
+ return PyLong_FromSsize_t(event.m_status);
}
Py_RETURN_NONE;
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
index 7eb088bef98..f3c0a76a9f2 100644
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
@@ -307,7 +307,7 @@ const char SCA_PropertyActuator::GetProperty_doc[] =
PyObject* SCA_PropertyActuator::PyGetProperty(PyObject* args, PyObject* kwds)
{
ShowDeprecationWarning("getProperty()", "the 'propName' property");
- return PyString_FromString(m_propname);
+ return PyUnicode_FromString(m_propname);
}
/* 3. setValue */
@@ -337,7 +337,7 @@ const char SCA_PropertyActuator::GetValue_doc[] =
PyObject* SCA_PropertyActuator::PyGetValue(PyObject* args, PyObject* kwds)
{
ShowDeprecationWarning("getValue()", "the value property");
- return PyString_FromString(m_exprtxt);
+ return PyUnicode_FromString(m_exprtxt);
}
/* eof */
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index b1571164774..ea928bb1c8f 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@ -356,7 +356,7 @@ const char SCA_PropertySensor::GetType_doc[] =
PyObject* SCA_PropertySensor::PyGetType()
{
ShowDeprecationWarning("getType()", "the mode property");
- return PyInt_FromLong(m_checktype);
+ return PyLong_FromSsize_t(m_checktype);
}
/* 2. setType */
@@ -390,7 +390,7 @@ const char SCA_PropertySensor::GetProperty_doc[] =
PyObject* SCA_PropertySensor::PyGetProperty()
{
ShowDeprecationWarning("getProperty()", "the 'propName' property");
- return PyString_FromString(m_checkpropname);
+ return PyUnicode_FromString(m_checkpropname);
}
/* 4. setProperty */
@@ -427,7 +427,7 @@ const char SCA_PropertySensor::GetValue_doc[] =
PyObject* SCA_PropertySensor::PyGetValue()
{
ShowDeprecationWarning("getValue()", "the value property");
- return PyString_FromString(m_checkpropval);
+ return PyUnicode_FromString(m_checkpropval);
}
/* 6. setValue */
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index fb12674ebed..7eecb6ccc98 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -148,7 +148,7 @@ void SCA_PythonController::SetDictionary(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__", PyString_FromString(m_scriptName.Ptr()));
+ PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_FromString(m_scriptName.Ptr()));
}
@@ -178,9 +178,9 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
std::vector<SCA_IActuator*> lacts = m_sCurrentController->GetLinkedActuators();
std::vector<SCA_IActuator*>::iterator it;
- if (PyString_Check(value)) {
+ if (PyUnicode_Check(value)) {
/* get the actuator from the name */
- char *name= PyString_AsString(value);
+ char *name= _PyUnicode_AsString(value);
for(it = lacts.begin(); it!= lacts.end(); ++it) {
if( name == (*it)->GetName() ) {
return *it;
@@ -198,7 +198,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
/* set the exception */
PyObject *value_str = PyObject_Repr(value); /* new ref */
- PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", PyString_AsString(value_str));
+ PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str));
Py_DECREF(value_str);
return false;
@@ -521,13 +521,13 @@ PyObject* SCA_PythonController::PyDeActivate(PyObject *value)
PyObject* SCA_PythonController::PyGetScript()
{
ShowDeprecationWarning("getScript()", "the script property");
- return PyString_FromString(m_scriptText);
+ return PyUnicode_FromString(m_scriptText);
}
/* 2. setScript */
PyObject* SCA_PythonController::PySetScript(PyObject* value)
{
- char *scriptArg = PyString_AsString(value);
+ char *scriptArg = _PyUnicode_AsString(value);
ShowDeprecationWarning("setScript()", "the script property");
@@ -550,7 +550,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 PyString_FromString(self->m_scriptText);
+ return PyUnicode_FromString(self->m_scriptText);
}
@@ -559,7 +559,7 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D
{
SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
- char *scriptArg = PyString_AsString(value);
+ char *scriptArg = _PyUnicode_AsString(value);
if (scriptArg==NULL) {
PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text");
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index a272306bd1d..0474cb4ab5f 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -380,14 +380,14 @@ PyAttributeDef SCA_RandomActuator::Attributes[] = {
PyObject* SCA_RandomActuator::pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
- return PyInt_FromLong(act->m_base->GetSeed());
+ return PyLong_FromSsize_t(act->m_base->GetSeed());
}
int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
- if (PyInt_Check(value)) {
- int ival = PyInt_AsLong(value);
+ if (PyLong_Check(value)) {
+ int ival = PyLong_AsSsize_t(value);
act->m_base->SetSeed(ival);
return PY_SET_ATTR_SUCCESS;
} else {
@@ -422,7 +422,7 @@ const char SCA_RandomActuator::GetSeed_doc[] =
PyObject* SCA_RandomActuator::PyGetSeed()
{
ShowDeprecationWarning("getSeed()", "the seed property");
- return PyInt_FromLong(m_base->GetSeed());
+ return PyLong_FromSsize_t(m_base->GetSeed());
}
/* 4. getPara1 */
@@ -456,7 +456,7 @@ const char SCA_RandomActuator::GetDistribution_doc[] =
PyObject* SCA_RandomActuator::PyGetDistribution()
{
ShowDeprecationWarning("getDistribution()", "the distribution property");
- return PyInt_FromLong(m_distribution);
+ return PyLong_FromSsize_t(m_distribution);
}
/* 9. setProperty */
@@ -491,7 +491,7 @@ const char SCA_RandomActuator::GetProperty_doc[] =
PyObject* SCA_RandomActuator::PyGetProperty()
{
ShowDeprecationWarning("getProperty()", "the 'propName' property");
- return PyString_FromString(m_propname);
+ return PyUnicode_FromString(m_propname);
}
/* 11. setBoolConst */
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index 8a6f42c9926..9d3501ab4ed 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -199,7 +199,7 @@ const char SCA_RandomSensor::GetSeed_doc[] =
"\tequal series.\n";
PyObject* SCA_RandomSensor::PyGetSeed() {
ShowDeprecationWarning("getSeed()", "the seed property");
- return PyInt_FromLong(m_basegenerator->GetSeed());
+ return PyLong_FromSsize_t(m_basegenerator->GetSeed());
}
/* 3. getLastDraw */
@@ -208,24 +208,24 @@ const char SCA_RandomSensor::GetLastDraw_doc[] =
"\tReturn the last value that was drawn.\n";
PyObject* SCA_RandomSensor::PyGetLastDraw() {
ShowDeprecationWarning("getLastDraw()", "the lastDraw property");
- return PyInt_FromLong(m_lastdraw);
+ return PyLong_FromSsize_t(m_lastdraw);
}
PyObject* SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);
- return PyInt_FromLong(self->m_basegenerator->GetSeed());
+ return PyLong_FromSsize_t(self->m_basegenerator->GetSeed());
}
int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);
- if (!PyInt_Check(value)) {
+ if (!PyLong_Check(value)) {
PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer");
return PY_SET_ATTR_FAIL;
}
- self->m_basegenerator->SetSeed(PyInt_AsLong(value));
+ self->m_basegenerator->SetSeed(PyLong_AsSsize_t(value));
return PY_SET_ATTR_SUCCESS;
}
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index b595aab578f..b6debb4c62c 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -834,17 +834,17 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" )
{
- return PyInt_FromLong( ( mShader !=0 && mOk ) );
+ return PyLong_FromSsize_t( ( mShader !=0 && mOk ) );
}
KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg ,"getVertexProg( )" )
{
- return PyString_FromString(vertProg?vertProg:"");
+ return PyUnicode_FromString(vertProg?vertProg:"");
}
KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" )
{
- return PyString_FromString(fragProg?fragProg:"");
+ return PyUnicode_FromString(fragProg?fragProg:"");
}
KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
@@ -1209,7 +1209,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2
for(unsigned int i=0; (i<list_size && i<4); i++)
{
PyObject *item = PySequence_GetItem(listPtr, i);
- array_data[i] = PyInt_AsLong(item);
+ array_data[i] = PyLong_AsSsize_t(item);
Py_DECREF(item);
}
diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h
index 517f3151909..42969996b3e 100644
--- a/source/gameengine/Ketsji/BL_Shader.h
+++ b/source/gameengine/Ketsji/BL_Shader.h
@@ -202,7 +202,7 @@ public:
void SetUniform(int uniform, const int val);
// Python interface
- virtual PyObject* py_repr(void) { return PyString_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); }
+ virtual PyObject* py_repr(void) { return PyUnicode_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); }
// -----------------------------------
KX_PYMETHOD_DOC( BL_Shader, setSource );
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
index da43893cee3..bfc49040794 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
@@ -251,7 +251,7 @@ const char KX_NetworkMessageSensor::SetSubjectFilterText_doc[] =
PyObject* KX_NetworkMessageSensor::PySetSubjectFilterText(PyObject* value)
{
ShowDeprecationWarning("setSubjectFilterText()", "subject");
- char* Subject = PyString_AsString(value);
+ char* Subject = _PyUnicode_AsString(value);
if (Subject==NULL) {
PyErr_SetString(PyExc_TypeError, "sensor.tsetSubjectFilterText(string): KX_NetworkMessageSensor, expected a string message");
return NULL;
@@ -269,7 +269,7 @@ const char KX_NetworkMessageSensor::GetFrameMessageCount_doc[] =
PyObject* KX_NetworkMessageSensor::PyGetFrameMessageCount()
{
ShowDeprecationWarning("getFrameMessageCount()", "frameMessageCount");
- return PyInt_FromLong(long(m_frame_message_count));
+ return PyLong_FromSsize_t(long(m_frame_message_count));
}
// 3. Get the message bodies
@@ -295,7 +295,7 @@ const char KX_NetworkMessageSensor::GetSubject_doc[] =
PyObject* KX_NetworkMessageSensor::PyGetSubject()
{
ShowDeprecationWarning("getSubject()", "subject");
- return PyString_FromString(m_subject ? m_subject : "");
+ return PyUnicode_FromString(m_subject ? m_subject : "");
}
// 5. Get the message subjects
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 9e3b718a87a..ea819cea5f2 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -892,7 +892,7 @@ void KX_BlenderMaterial::SetBlenderGLSLShader(int layer)
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getMaterialIndex, "getMaterialIndex()")
{
- return PyInt_FromLong( GetMaterialIndex() );
+ return PyLong_FromSsize_t( GetMaterialIndex() );
}
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getTexture, "getTexture( index )" )
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 6eb9647a595..1f5edc1d7d1 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -81,7 +81,7 @@ public:
);
// --------------------------------
- virtual PyObject* py_repr(void) { return PyString_FromString(mMaterial->matname.ReadPtr()); }
+ virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); }
KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader );
KX_PYMETHOD_DOC( KX_BlenderMaterial, getMaterialIndex );
diff --git a/source/gameengine/Ketsji/KX_CDActuator.cpp b/source/gameengine/Ketsji/KX_CDActuator.cpp
index 6e01bf0dded..d025dbfa469 100644
--- a/source/gameengine/Ketsji/KX_CDActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CDActuator.cpp
@@ -249,8 +249,8 @@ KX_PYMETHODDEF_DOC_O(KX_CDActuator, playTrack,
"playTrack(trackNumber)\n"
"\tPlays the track selected.\n")
{
- if (PyInt_Check(value)) {
- int track = PyInt_AsLong(value);
+ if (PyLong_Check(value)) {
+ int track = PyLong_AsSsize_t(value);
SND_CDObject::Instance()->SetPlaymode(SND_CD_TRACK);
SND_CDObject::Instance()->SetTrack(track);
SND_CDObject::Instance()->SetPlaystate(SND_MUST_PLAY);
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 4ccbf73b417..85fa579167b 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -586,7 +586,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
MT_Point3 center;
if (PyVecTo(pycenter, center))
{
- return PyInt_FromLong(SphereInsideFrustum(center, radius)); /* new ref */
+ return PyLong_FromSsize_t(SphereInsideFrustum(center, radius)); /* new ref */
}
}
@@ -637,7 +637,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum,
return NULL;
}
- return PyInt_FromLong(BoxInsideFrustum(box)); /* new ref */
+ return PyLong_FromSsize_t(BoxInsideFrustum(box)); /* new ref */
}
KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
@@ -659,7 +659,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
MT_Point3 point;
if (PyVecTo(value, point))
{
- return PyInt_FromLong(PointInsideFrustum(point)); /* new ref */
+ return PyLong_FromSsize_t(PointInsideFrustum(point)); /* new ref */
}
PyErr_SetString(PyExc_TypeError, "camera.pointInsideFrustum(point): KX_Camera, expected point argument.");
@@ -927,11 +927,11 @@ PyObject* KX_Camera::pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBU
PyObject* KX_Camera::pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyInt_FromLong(INSIDE); }
+{ return PyLong_FromSsize_t(INSIDE); }
PyObject* KX_Camera::pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyInt_FromLong(OUTSIDE); }
+{ return PyLong_FromSsize_t(OUTSIDE); }
PyObject* KX_Camera::pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyInt_FromLong(INTERSECT); }
+{ return PyLong_FromSsize_t(INTERSECT); }
bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok, const char *error_prefix)
@@ -953,14 +953,14 @@ bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok
}
}
- if (PyString_Check(value)) {
- STR_String value_str = PyString_AsString(value);
+ if (PyUnicode_Check(value)) {
+ STR_String value_str = _PyUnicode_AsString(value);
*object = KX_GetActiveScene()->FindCamera(value_str);
if (*object) {
return true;
} else {
- PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_Camera in this scene", error_prefix, PyString_AsString(value));
+ PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_Camera in this scene", error_prefix, _PyUnicode_AsString(value));
return false;
}
}
@@ -1117,7 +1117,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay,
PyTuple_SET_ITEM(argValue, 0, PyObjectFrom(vect));
PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(dist));
if (propName)
- PyTuple_SET_ITEM(argValue, 2, PyString_FromString(propName));
+ PyTuple_SET_ITEM(argValue, 2, PyUnicode_FromString(propName));
PyObject* ret= this->PyrayCastTo(argValue,NULL);
Py_DECREF(argValue);
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index b960ae25841..e2c3ecb1b3e 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -438,7 +438,7 @@ PyObject* KX_CameraActuator::PyGetObject(PyObject* args)
Py_RETURN_NONE;
if (ret_name_only)
- return PyString_FromString(m_ob->GetName().ReadPtr());
+ return PyUnicode_FromString(m_ob->GetName().ReadPtr());
else
return m_ob->GetProxy();
}
@@ -563,7 +563,7 @@ const char KX_CameraActuator::GetXY_doc[] =
PyObject* KX_CameraActuator::PyGetXY()
{
ShowDeprecationWarning("getXY()", "the xy property");
- return PyInt_FromLong(m_x);
+ return PyLong_FromSsize_t(m_x);
}
PyObject* KX_CameraActuator::pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
index 7e5a2e31907..8470c2c1f5f 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
@@ -672,7 +672,7 @@ const char KX_ConstraintActuator::GetDamp_doc[] =
"\tReturns the damping parameter.\n";
PyObject* KX_ConstraintActuator::PyGetDamp(){
ShowDeprecationWarning("getDamp()", "the damp property");
- return PyInt_FromLong(m_posDampTime);
+ return PyLong_FromSsize_t(m_posDampTime);
}
/* 2. setRotDamp */
@@ -699,7 +699,7 @@ const char KX_ConstraintActuator::GetRotDamp_doc[] =
"\tReturns the damping time for application of the constraint.\n";
PyObject* KX_ConstraintActuator::PyGetRotDamp(){
ShowDeprecationWarning("getRotDamp()", "the rotDamp property");
- return PyInt_FromLong(m_rotDampTime);
+ return PyLong_FromSsize_t(m_rotDampTime);
}
/* 2. setDirection */
@@ -772,7 +772,7 @@ const char KX_ConstraintActuator::GetOption_doc[] =
"\tReturns the option parameter.\n";
PyObject* KX_ConstraintActuator::PyGetOption(){
ShowDeprecationWarning("getOption()", "the option property");
- return PyInt_FromLong(m_option);
+ return PyLong_FromSsize_t(m_option);
}
/* 2. setTime */
@@ -801,7 +801,7 @@ const char KX_ConstraintActuator::GetTime_doc[] =
"\tReturns the time parameter.\n";
PyObject* KX_ConstraintActuator::PyGetTime(){
ShowDeprecationWarning("getTime()", "the time property");
- return PyInt_FromLong(m_activeTime);
+ return PyLong_FromSsize_t(m_activeTime);
}
/* 2. setProperty */
@@ -830,7 +830,7 @@ const char KX_ConstraintActuator::GetProperty_doc[] =
"\tReturns the property parameter.\n";
PyObject* KX_ConstraintActuator::PyGetProperty(){
ShowDeprecationWarning("getProperty()", "the 'property' property");
- return PyString_FromString(m_property.Ptr());
+ return PyUnicode_FromString(m_property.Ptr());
}
/* 4. setDistance */
@@ -959,7 +959,7 @@ const char KX_ConstraintActuator::GetLimit_doc[] =
"\tReturns the type of constraint.\n";
PyObject* KX_ConstraintActuator::PyGetLimit() {
ShowDeprecationWarning("setLimit()", "the limit property");
- return PyInt_FromLong(m_locrot);
+ return PyLong_FromSsize_t(m_locrot);
}
/* eof */
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index be23eff6ac0..955dd18d43e 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -51,7 +51,7 @@ KX_ConstraintWrapper::~KX_ConstraintWrapper()
PyObject* KX_ConstraintWrapper::PyGetConstraintId()
{
- return PyInt_FromLong(m_constraintId);
+ return PyLong_FromSsize_t(m_constraintId);
}
diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp
index 2a769cf6c66..029f1f07861 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.cpp
+++ b/source/gameengine/Ketsji/KX_GameActuator.cpp
@@ -258,7 +258,7 @@ const char KX_GameActuator::GetFile_doc[] =
PyObject* KX_GameActuator::PyGetFile(PyObject* args, PyObject* kwds)
{
ShowDeprecationWarning("getFile()", "the fileName property");
- return PyString_FromString(m_filename);
+ return PyUnicode_FromString(m_filename);
}
/* setFile */
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 30b3cb201a7..5798830e243 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1496,7 +1496,7 @@ PyObject* KX_GameObject::PyGetPosition()
static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
{
KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
- const char *attr_str= PyString_AsString(item);
+ const char *attr_str= _PyUnicode_AsString(item);
CValue* resultattr;
PyObject* pyconvert;
@@ -1530,7 +1530,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
{
KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
- const char *attr_str= PyString_AsString(key);
+ const char *attr_str= _PyUnicode_AsString(key);
if(attr_str==NULL)
PyErr_Clear();
@@ -1624,7 +1624,7 @@ static int Seq_Contains(PyObject *self_v, PyObject *value)
return -1;
}
- if(PyString_Check(value) && self->GetProperty(PyString_AsString(value)))
+ if(PyUnicode_Check(value) && self->GetProperty(_PyUnicode_AsString(value)))
return 1;
if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value))
@@ -1686,7 +1686,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 PyString_FromString(self->GetName().ReadPtr());
+ return PyUnicode_FromString(self->GetName().ReadPtr());
}
PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -1959,13 +1959,13 @@ PyObject* KX_GameObject::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
int state = 0;
state |= self->GetState();
- return PyInt_FromLong(state);
+ return PyLong_FromSsize_t(state);
}
int KX_GameObject::pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
- int state_i = PyInt_AsLong(value);
+ int state_i = PyLong_AsSsize_t(value);
unsigned int state = 0;
if (state_i == -1 && PyErr_Occurred()) {
@@ -2179,7 +2179,7 @@ PyObject* KX_GameObject::PySetOcclusion(PyObject* args)
PyObject* KX_GameObject::PyGetVisible()
{
ShowDeprecationWarning("getVisible()", "the visible property");
- return PyInt_FromLong(m_bVisible);
+ return PyLong_FromSsize_t(m_bVisible);
}
PyObject* KX_GameObject::PyGetState()
@@ -2187,13 +2187,13 @@ PyObject* KX_GameObject::PyGetState()
ShowDeprecationWarning("getState()", "the state property");
int state = 0;
state |= GetState();
- return PyInt_FromLong(state);
+ return PyLong_FromSsize_t(state);
}
PyObject* KX_GameObject::PySetState(PyObject* value)
{
ShowDeprecationWarning("setState()", "the state property");
- int state_i = PyInt_AsLong(value);
+ int state_i = PyLong_AsSsize_t(value);
unsigned int state = 0;
if (state_i == -1 && PyErr_Occurred()) {
@@ -2499,7 +2499,7 @@ PyObject* KX_GameObject::PyGetPhysicsId()
{
physid= (uint_ptr)ctrl->GetUserData();
}
- return PyInt_FromLong((long)physid);
+ return PyLong_FromSsize_t((long)physid);
}
PyObject* KX_GameObject::PyGetPropertyNames()
@@ -2875,8 +2875,8 @@ PyObject* KX_GameObject::Pyget(PyObject *args)
return NULL;
- if(PyString_Check(key)) {
- CValue *item = GetProperty(PyString_AsString(key));
+ if(PyUnicode_Check(key)) {
+ CValue *item = GetProperty(_PyUnicode_AsString(key));
if (item) {
ret = item->ConvertValueToPython();
if(ret)
@@ -2945,13 +2945,13 @@ bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py
}
}
- if (PyString_Check(value)) {
- *object = (KX_GameObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String( PyString_AsString(value) ));
+ if (PyUnicode_Check(value)) {
+ *object = (KX_GameObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String( _PyUnicode_AsString(value) ));
if (*object) {
return true;
} else {
- PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_GameObject in this scene", error_prefix, PyString_AsString(value));
+ PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_GameObject in this scene", error_prefix, _PyUnicode_AsString(value));
return false;
}
}
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 1abd4399295..947cc9959ff 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -809,7 +809,7 @@ public:
*/
virtual PyObject* py_repr(void)
{
- return PyString_FromString(GetName().ReadPtr());
+ return PyUnicode_FromString(GetName().ReadPtr());
}
KX_PYMETHOD_NOARGS(KX_GameObject,GetPosition);
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index 18e91250233..0edb6747f2f 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -673,7 +673,7 @@ const char KX_IpoActuator::GetType_doc[] =
"\tReturns the operation mode of the actuator.\n";
PyObject* KX_IpoActuator::PyGetType() {
ShowDeprecationWarning("getType()", "the mode property");
- return PyInt_FromLong(m_type);
+ return PyLong_FromSsize_t(m_type);
}
/* 10. setForceIpoActsLocal: */
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index c7d8ab4f0d1..08542ec1602 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -349,11 +349,11 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
const char* type = attrdef->m_name;
if(strcmp(type, "SPOT")) {
- retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_SPOT);
+ retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT);
} else if (strcmp(type, "SUN")) {
- retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_SUN);
+ retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN);
} else if (strcmp(type, "NORMAL")) {
- retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_NORMAL);
+ retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
}
return retvalue;
@@ -362,13 +362,13 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
PyObject* KX_LightObject::pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
- return PyInt_FromLong(self->m_lightobj.m_type);
+ return PyLong_FromSsize_t(self->m_lightobj.m_type);
}
int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value)
{
KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
- int val = PyInt_AsLong(value);
+ int val = PyLong_AsSsize_t(value);
if((val==-1 && PyErr_Occurred()) || val<0 || val>2) {
PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2");
return PY_SET_ATTR_FAIL;
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index 79aa887601a..2c0c31c96c4 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -132,14 +132,14 @@ PyObject* KX_MeshProxy::PyGetNumMaterials(PyObject* args, PyObject* kwds)
{
int num = m_meshobj->NumMaterials();
ShowDeprecationWarning("getNumMaterials()", "the numMaterials property");
- return PyInt_FromLong(num);
+ return PyLong_FromSsize_t(num);
}
PyObject* KX_MeshProxy::PyGetNumPolygons()
{
int num = m_meshobj->NumPolygons();
ShowDeprecationWarning("getNumPolygons()", "the numPolygons property");
- return PyInt_FromLong(num);
+ return PyLong_FromSsize_t(num);
}
PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds)
@@ -155,7 +155,7 @@ PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds)
return NULL;
}
- return PyString_FromString(matname.Ptr());
+ return PyUnicode_FromString(matname.Ptr());
}
@@ -173,7 +173,7 @@ PyObject* KX_MeshProxy::PyGetTextureName(PyObject* args, PyObject* kwds)
return NULL;
}
- return PyString_FromString(matname.Ptr());
+ return PyUnicode_FromString(matname.Ptr());
}
@@ -196,7 +196,7 @@ PyObject* KX_MeshProxy::PyGetVertexArrayLength(PyObject* args, PyObject* kwds)
length = m_meshobj->NumVertices(mat);
}
- return PyInt_FromLong(length);
+ return PyLong_FromSsize_t(length);
}
@@ -286,12 +286,12 @@ PyObject* KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
PyObject * KX_MeshProxy::pyattr_get_numMaterials(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef) {
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
- return PyInt_FromLong(self->m_meshobj->NumMaterials());
+ return PyLong_FromSsize_t(self->m_meshobj->NumMaterials());
}
PyObject * KX_MeshProxy::pyattr_get_numPolygons(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef) {
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
- return PyInt_FromLong(self->m_meshobj->NumPolygons());
+ return PyLong_FromSsize_t(self->m_meshobj->NumPolygons());
}
/* a close copy of ConvertPythonToGameObject but for meshes */
@@ -314,13 +314,13 @@ bool ConvertPythonToMesh(PyObject * value, RAS_MeshObject **object, bool py_none
}
}
- if (PyString_Check(value)) {
- *object = (RAS_MeshObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetMeshByName(STR_String( PyString_AsString(value) ));
+ if (PyUnicode_Check(value)) {
+ *object = (RAS_MeshObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetMeshByName(STR_String( _PyUnicode_AsString(value) ));
if (*object) {
return true;
} else {
- PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_MeshProxy in this scene", error_prefix, PyString_AsString(value));
+ PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_MeshProxy in this scene", error_prefix, _PyUnicode_AsString(value));
return false;
}
}
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index 15e82581bc6..b13c225a16f 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -556,7 +556,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitX(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.Torque = (PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.Torque = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
@@ -592,7 +592,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitY(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.DLoc = (PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.DLoc = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
@@ -628,7 +628,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitZ(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.DRot = (PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.DRot = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp
index a68bafc4d86..fb2fd614062 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp
@@ -257,7 +257,7 @@ PyObject* KX_ParentActuator::PyGetObject(PyObject* args)
Py_RETURN_NONE;
if (ret_name_only)
- return PyString_FromString(m_ob->GetName().ReadPtr());
+ return PyUnicode_FromString(m_ob->GetName().ReadPtr());
else
return m_ob->GetProxy();
}
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index babead25274..7fd667eeaf3 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -99,14 +99,14 @@ PyAttributeDef KX_PolyProxy::Attributes[] = {
#if 0
PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
{
- char *attr_str= PyString_AsString(attr);
+ char *attr_str= _PyUnicode_AsString(attr);
if (!strcmp(attr_str, "matname"))
{
- return PyString_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
+ return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
}
if (!strcmp(attr_str, "texture"))
{
- return PyString_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
+ return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
}
if (!strcmp(attr_str, "material"))
{
@@ -135,31 +135,31 @@ PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
// found it
break;
}
- return PyInt_FromLong(matid);
+ return PyLong_FromSsize_t(matid);
}
if (!strcmp(attr_str, "v1"))
{
- return PyInt_FromLong(m_polygon->GetVertexOffset(0));
+ return PyLong_FromSsize_t(m_polygon->GetVertexOffset(0));
}
if (!strcmp(attr_str, "v2"))
{
- return PyInt_FromLong(m_polygon->GetVertexOffset(1));
+ return PyLong_FromSsize_t(m_polygon->GetVertexOffset(1));
}
if (!strcmp(attr_str, "v3"))
{
- return PyInt_FromLong(m_polygon->GetVertexOffset(2));
+ return PyLong_FromSsize_t(m_polygon->GetVertexOffset(2));
}
if (!strcmp(attr_str, "v4"))
{
- return PyInt_FromLong(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffset(3):0));
+ return PyLong_FromSsize_t(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffset(3):0));
}
if (!strcmp(attr_str, "visible"))
{
- return PyInt_FromLong(m_polygon->IsVisible());
+ return PyLong_FromSsize_t(m_polygon->IsVisible());
}
if (!strcmp(attr_str, "collide"))
{
- return PyInt_FromLong(m_polygon->IsCollider());
+ return PyLong_FromSsize_t(m_polygon->IsCollider());
}
// py_getattro_up(CValue); // XXX -- todo, make all these attributes
}
@@ -200,37 +200,37 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex,
// found it
break;
}
- return PyInt_FromLong(matid);
+ return PyLong_FromSsize_t(matid);
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getNumVertex,
"getNumVertex() : returns the number of vertex of the polygon, 3 or 4\n")
{
- return PyInt_FromLong(m_polygon->VertexCount());
+ return PyLong_FromSsize_t(m_polygon->VertexCount());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isVisible,
"isVisible() : returns whether the polygon is visible or not\n")
{
- return PyInt_FromLong(m_polygon->IsVisible());
+ return PyLong_FromSsize_t(m_polygon->IsVisible());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isCollider,
"isCollider() : returns whether the polygon is receives collision or not\n")
{
- return PyInt_FromLong(m_polygon->IsCollider());
+ return PyLong_FromSsize_t(m_polygon->IsCollider());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialName,
"getMaterialName() : returns the polygon material name, \"NoMaterial\" if no material\n")
{
- return PyString_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
+ return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getTextureName,
"getTexturelName() : returns the polygon texture name, \"NULL\" if no texture\n")
{
- return PyString_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
+ return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
}
KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
@@ -251,9 +251,9 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
}
if (index < m_polygon->VertexCount())
{
- return PyInt_FromLong(m_polygon->GetVertexOffset(index));
+ return PyLong_FromSsize_t(m_polygon->GetVertexOffset(index));
}
- return PyInt_FromLong(0);
+ return PyLong_FromSsize_t(0);
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMesh,
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index 8d8492cc062..4d5e7ca565b 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -115,7 +115,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI
PyObject *ret = PyObject_CallMethod(m_pymaterial, "activate", "(NNO)", pyRasty, pyCachingInfo, (PyObject*) this->m_proxy);
if (ret)
{
- bool value = PyInt_AsLong(ret);
+ bool value = PyLong_AsSsize_t(ret);
Py_DECREF(ret);
dopass = value;
}
@@ -332,13 +332,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 PyString_FromString(self->m_texturename.ReadPtr());
+ return PyUnicode_FromString(self->m_texturename.ReadPtr());
}
PyObject* KX_PolygonMaterial::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
- return PyString_FromString(self->m_materialname.ReadPtr());
+ return PyUnicode_FromString(self->m_materialname.ReadPtr());
}
/* this does not seem useful */
@@ -355,7 +355,7 @@ PyObject* KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATT
if (self->m_tface && self->m_tface->tpage)
bindcode= self->m_tface->tpage->bindcode;
- return PyInt_FromLong(bindcode);
+ return PyLong_FromSsize_t(bindcode);
}
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h
index 481c429f658..266b4d7e789 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.h
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h
@@ -116,7 +116,7 @@ public:
KX_PYMETHOD_DOC(KX_PolygonMaterial, setCustomMaterial);
KX_PYMETHOD_DOC(KX_PolygonMaterial, loadProgram);
- virtual PyObject* py_repr(void) { return PyString_FromString(m_material ? ((ID *)m_material)->name+2 : ""); }
+ virtual PyObject* py_repr(void) { return PyUnicode_FromString(m_material ? ((ID *)m_material)->name+2 : ""); }
static PyObject* pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 4ec901a2f5e..94e8d1fd583 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -640,7 +640,7 @@ PyObject* initPythonConstraintBinding()
// Add some symbolic constants to the module
d = PyModule_GetDict(m);
- ErrorObject = PyString_FromString("PhysicsConstraints.error");
+ ErrorObject = PyUnicode_FromString("PhysicsConstraints.error");
PyDict_SetItemString(d, "error", ErrorObject);
Py_DECREF(ErrorObject);
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 736460d33db..eead7a51885 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -130,10 +130,10 @@ void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,cons
}
/* Macro for building the keyboard translation */
-//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyInt_FromLong(SCA_IInputDevice::KX_##name))
-#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyInt_FromLong(name)); Py_DECREF(item)
+//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromSsize_t(SCA_IInputDevice::KX_##name))
+#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name)); Py_DECREF(item)
/* For the defines for types from logic bricks, we do stuff explicitly... */
-#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyInt_FromLong(name2)); Py_DECREF(item)
+#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item)
// temporarily python stuff, will be put in another place later !
@@ -181,7 +181,7 @@ static PyObject* gPyExpandPath(PyObject*, PyObject* args)
BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE);
BLI_convertstringcode(expanded, gp_GamePythonPath);
- return PyString_FromString(expanded);
+ return PyUnicode_FromString(expanded);
}
static char gPySendMessage_doc[] =
@@ -306,7 +306,7 @@ static PyObject* gPySetMaxLogicFrame(PyObject*, PyObject* args)
static PyObject* gPyGetMaxLogicFrame(PyObject*)
{
- return PyInt_FromLong(KX_KetsjiEngine::GetMaxLogicFrame());
+ return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxLogicFrame());
}
static PyObject* gPySetMaxPhysicsFrame(PyObject*, PyObject* args)
@@ -321,7 +321,7 @@ static PyObject* gPySetMaxPhysicsFrame(PyObject*, PyObject* args)
static PyObject* gPyGetMaxPhysicsFrame(PyObject*)
{
- return PyInt_FromLong(KX_KetsjiEngine::GetMaxPhysicsFrame());
+ return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxPhysicsFrame());
}
static PyObject* gPySetPhysicsTicRate(PyObject*, PyObject* args)
@@ -386,7 +386,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
while ((dirp = readdir(dp)) != NULL) {
if (BLI_testextensie(dirp->d_name, ".blend")) {
- value = PyString_FromString(dirp->d_name);
+ value = PyUnicode_FromString(dirp->d_name);
PyList_Append(list, value);
Py_DECREF(value);
}
@@ -500,7 +500,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
static PyObject *gEvalExpression(PyObject*, PyObject* value)
{
- char* txt= PyString_AsString(value);
+ char* txt= _PyUnicode_AsString(value);
if (txt==NULL) {
PyErr_SetString(PyExc_TypeError, "Expression.calc(text): expects a single string argument");
@@ -558,14 +558,14 @@ static struct PyMethodDef game_methods[] = {
static PyObject* gPyGetWindowHeight(PyObject*, PyObject* args)
{
- return PyInt_FromLong((gp_Canvas ? gp_Canvas->GetHeight() : 0));
+ return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetHeight() : 0));
}
static PyObject* gPyGetWindowWidth(PyObject*, PyObject* args)
{
- return PyInt_FromLong((gp_Canvas ? gp_Canvas->GetWidth() : 0));
+ return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetWidth() : 0));
}
@@ -893,7 +893,7 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*,
}
enabled = ((G.fileflags & flag) != 0);
- return PyInt_FromLong(enabled);
+ return PyLong_FromSsize_t(enabled);
}
#define KX_TEXFACE_MATERIAL 0
@@ -937,7 +937,7 @@ static PyObject* gPyGetMaterialType(PyObject*)
else
flag = KX_TEXFACE_MATERIAL;
- return PyInt_FromLong(flag);
+ return PyLong_FromSsize_t(flag);
}
static PyObject* gPyDrawLine(PyObject*, PyObject* args)
@@ -1075,7 +1075,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item);
- ErrorObject = PyString_FromString("GameLogic.error");
+ ErrorObject = PyUnicode_FromString("GameLogic.error");
PyDict_SetItemString(d, "error", ErrorObject);
Py_DECREF(ErrorObject);
@@ -1362,7 +1362,7 @@ PyObject *KXpy_import(PyObject *self, PyObject *args)
/* check for builtin modules */
m = PyImport_AddModule("sys");
l = PyObject_GetAttrString(m, "builtin_module_names");
- n = PyString_FromString(name);
+ n = PyUnicode_FromString(name);
if (PySequence_Contains(l, n)) {
return PyImport_ImportModuleEx(name, globals, locals, fromlist);
@@ -1538,7 +1538,7 @@ static void initPySysObjects__append(PyObject *sys_path, char *filename)
BLI_split_dirfile_basic(filename, expanded, NULL); /* get the dir part of filename only */
BLI_convertstringcode(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
- item= PyString_FromString(expanded);
+ item= PyUnicode_FromString(expanded);
// printf("SysPath - '%s', '%s', '%s'\n", expanded, filename, gp_GamePythonPath);
@@ -1735,7 +1735,7 @@ PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
// Add some symbolic constants to the module
d = PyModule_GetDict(m);
- ErrorObject = PyString_FromString("Rasterizer.error");
+ ErrorObject = PyUnicode_FromString("Rasterizer.error");
PyDict_SetItemString(d, "error", ErrorObject);
Py_DECREF(ErrorObject);
@@ -1813,10 +1813,10 @@ static PyObject* gPyEventToCharacter(PyObject*, PyObject* args)
if(IsPrintable(event)) {
char ch[2] = {'\0', '\0'};
ch[0] = ToCharacter(event, (bool)shift);
- return PyString_FromString(ch);
+ return PyUnicode_FromString(ch);
}
else {
- return PyString_FromString("");
+ return PyUnicode_FromString("");
}
}
@@ -2044,7 +2044,7 @@ int saveGamePythonConfig( char **marshal_buffer)
char *marshal_cstring;
#if PY_VERSION_HEX < 0x03000000
- marshal_cstring = PyString_AsString(pyGlobalDictMarshal);
+ marshal_cstring = _PyUnicode_AsString(pyGlobalDictMarshal);
marshal_length= PyString_Size(pyGlobalDictMarshal);
#else // py3 uses byte arrays
marshal_cstring = PyBytes_AsString(pyGlobalDictMarshal);
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index 524d957a80c..5b4d77156db 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -221,11 +221,11 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key)
return NULL;
}
- if (PyInt_Check(key)) {
- return KX_PythonSeq_getIndex(self, PyInt_AS_LONG( key ));
+ if (PyLong_Check(key)) {
+ return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key ));
}
- else if ( PyString_Check(key) ) {
- char *name = PyString_AsString(key);
+ else if ( PyUnicode_Check(key) ) {
+ char *name = _PyUnicode_AsString(key);
PyObjectPlus *ret = KX_PythonSeq_subscript__internal(self, name);
if(ret) {
@@ -250,12 +250,12 @@ static int KX_PythonSeq_contains(PyObject *self, PyObject *key)
PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: "BGE_PROXY_ERROR_MSG);
return -1;
}
- if(!PyString_Check(key)) {
+ if(!PyUnicode_Check(key)) {
PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: key must be a string");
return -1;
}
- if(KX_PythonSeq_subscript__internal(self, PyString_AsString(key)))
+ if(KX_PythonSeq_subscript__internal(self, _PyUnicode_AsString(key)))
return 1;
return 0;
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index 2a4ae3a2abd..69214dbbbcf 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -298,7 +298,7 @@ const char KX_SCA_AddObjectActuator::SetTime_doc[] =
PyObject* KX_SCA_AddObjectActuator::PySetTime(PyObject* value)
{
ShowDeprecationWarning("setTime()", "the time property");
- int deltatime = PyInt_AsLong(value);
+ int deltatime = PyLong_AsSsize_t(value);
if (deltatime==-1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int");
return NULL;
@@ -321,7 +321,7 @@ const char KX_SCA_AddObjectActuator::GetTime_doc[] =
PyObject* KX_SCA_AddObjectActuator::PyGetTime()
{
ShowDeprecationWarning("getTime()", "the time property");
- return PyInt_FromLong(m_timeProp);
+ return PyLong_FromSsize_t(m_timeProp);
}
@@ -343,7 +343,7 @@ PyObject* KX_SCA_AddObjectActuator::PyGetObject(PyObject* args)
Py_RETURN_NONE;
if (ret_name_only)
- return PyString_FromString(m_OriginalObject->GetName().ReadPtr());
+ return PyUnicode_FromString(m_OriginalObject->GetName().ReadPtr());
else
return m_OriginalObject->GetProxy();
}
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
index 8626512fdf3..3cff9457c34 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
@@ -121,7 +121,7 @@ KX_PYMETHODDEF_DOC(KX_SCA_DynamicActuator, getOperation,
)
{
ShowDeprecationWarning("getOperation()", "the mode property");
- return PyInt_FromLong((long)m_dyn_operation);
+ return PyLong_FromSsize_t((long)m_dyn_operation);
}
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
index 873272a37f9..ee50008edae 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
@@ -140,7 +140,7 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, getMesh,
if (!m_mesh)
Py_RETURN_NONE;
- return PyString_FromString(const_cast<char *>(m_mesh->GetName().ReadPtr()));
+ return PyUnicode_FromString(const_cast<char *>(m_mesh->GetName().ReadPtr()));
}
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index f2bbc8e6fef..5f3ed690adc 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1653,7 +1653,7 @@ PyMethodDef KX_Scene::Methods[] = {
PyObject* KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_Scene* self= static_cast<KX_Scene*>(self_v);
- return PyString_FromString(self->GetName().ReadPtr());
+ return PyUnicode_FromString(self->GetName().ReadPtr());
}
PyObject* KX_Scene::pyattr_get_objects(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -1753,7 +1753,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getName,
)
{
ShowDeprecationWarning("getName()", "the name property");
- return PyString_FromString(GetName());
+ return PyUnicode_FromString(GetName());
}
KX_PYMETHODDEF_DOC(KX_Scene, addObject,
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h
index edc4297ff14..2792f1f5fe4 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -563,7 +563,7 @@ public:
static PyObject* pyattr_get_active_camera(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
- virtual PyObject* py_repr(void) { return PyString_FromString(GetName().ReadPtr()); }
+ virtual PyObject* py_repr(void) { return PyUnicode_FromString(GetName().ReadPtr()); }
/**
* Sets the time the scene was suspended
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp
index 16521f2ddcc..76869f82c1a 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp
@@ -332,7 +332,7 @@ const char KX_SceneActuator::GetUseRestart_doc[] =
PyObject* KX_SceneActuator::PyGetUseRestart()
{
ShowDeprecationWarning("getUseRestart()", "the useRestart property");
- return PyInt_FromLong(!(m_restart == 0));
+ return PyLong_FromSsize_t(!(m_restart == 0));
}
@@ -368,7 +368,7 @@ const char KX_SceneActuator::GetScene_doc[] =
PyObject* KX_SceneActuator::PyGetScene()
{
ShowDeprecationWarning("getScene()", "the scene property");
- return PyString_FromString(m_nextSceneName);
+ return PyUnicode_FromString(m_nextSceneName);
}
@@ -409,7 +409,7 @@ PyObject* KX_SceneActuator::PyGetCamera()
{
ShowDeprecationWarning("getCamera()", "the camera property");
if (m_camera) {
- return PyString_FromString(m_camera->GetName());
+ return PyUnicode_FromString(m_camera->GetName());
}
else {
Py_RETURN_NONE;
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index 28e46cc9fa2..0ad699fd811 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -338,7 +338,7 @@ PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYAT
KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
if (!actuator->m_soundObject)
{
- return PyString_FromString("");
+ return PyUnicode_FromString("");
}
STR_String objectname = actuator->m_soundObject->GetObjectName();
char* name = objectname.Ptr();
@@ -347,7 +347,7 @@ PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYAT
PyErr_SetString(PyExc_RuntimeError, "value = actuator.fileName: KX_SoundActuator, unable to get sound fileName");
return NULL;
} else
- return PyString_FromString(name);
+ return PyUnicode_FromString(name);
}
PyObject* KX_SoundActuator::pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
@@ -382,7 +382,7 @@ PyObject* KX_SoundActuator::pyattr_get_looping(void *self, const struct KX_PYATT
{
KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
int looping = (actuator->m_soundObject) ? actuator->m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
- PyObject* result = PyInt_FromLong(looping);
+ PyObject* result = PyLong_FromSsize_t(looping);
return result;
}
@@ -560,7 +560,7 @@ PyObject* KX_SoundActuator::PyGetFilename()
ShowDeprecationWarning("getFilename()", "the fileName property");
if (!m_soundObject)
{
- return PyString_FromString("");
+ return PyUnicode_FromString("");
}
STR_String objectname = m_soundObject->GetObjectName();
char* name = objectname.Ptr();
@@ -569,7 +569,7 @@ PyObject* KX_SoundActuator::PyGetFilename()
PyErr_SetString(PyExc_RuntimeError, "Unable to get sound fileName");
return NULL;
} else
- return PyString_FromString(name);
+ return PyUnicode_FromString(name);
}
PyObject* KX_SoundActuator::PySetGain(PyObject* args)
@@ -669,7 +669,7 @@ PyObject* KX_SoundActuator::PyGetLooping()
{
ShowDeprecationWarning("getLooping()", "the looping property");
int looping = (m_soundObject) ? m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
- PyObject* result = PyInt_FromLong(looping);
+ PyObject* result = PyLong_FromSsize_t(looping);
return result;
}
@@ -757,7 +757,7 @@ PyObject* KX_SoundActuator::PySetType(PyObject* args)
PyObject* KX_SoundActuator::PyGetType()
{
ShowDeprecationWarning("getType()", "the mode property");
- return PyInt_FromLong(m_type);
+ return PyLong_FromSsize_t(m_type);
}
// <-----
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index 8686de8f2ca..32c19df3542 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -357,7 +357,7 @@ const char KX_TouchSensor::SetProperty_doc[] =
PyObject* KX_TouchSensor::PySetProperty(PyObject* value)
{
ShowDeprecationWarning("setProperty()", "the propName property");
- char *nameArg= PyString_AsString(value);
+ char *nameArg= _PyUnicode_AsString(value);
if (nameArg==NULL) {
PyErr_SetString(PyExc_ValueError, "expected a ");
return NULL;
@@ -375,7 +375,7 @@ const char KX_TouchSensor::GetProperty_doc[] =
PyObject* KX_TouchSensor::PyGetProperty() {
ShowDeprecationWarning("getProperty()", "the propName property");
- return PyString_FromString(m_touchedpropname);
+ return PyUnicode_FromString(m_touchedpropname);
}
const char KX_TouchSensor::GetHitObject_doc[] =
@@ -416,7 +416,7 @@ const char KX_TouchSensor::GetTouchMaterial_doc[] =
PyObject* KX_TouchSensor::PyGetTouchMaterial()
{
ShowDeprecationWarning("getTouchMaterial()", "the useMaterial property");
- return PyInt_FromLong(m_bFindMaterial);
+ return PyLong_FromSsize_t(m_bFindMaterial);
}
/* 6. setTouchMaterial */
@@ -429,7 +429,7 @@ const char KX_TouchSensor::SetTouchMaterial_doc[] =
PyObject* KX_TouchSensor::PySetTouchMaterial(PyObject *value)
{
ShowDeprecationWarning("setTouchMaterial()", "the useMaterial property");
- int pulseArg = PyInt_AsLong(value);
+ int pulseArg = PyLong_AsSsize_t(value);
if(pulseArg ==-1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_ValueError, "expected a bool");
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index 12f0137977a..49737a6dfc2 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -552,7 +552,7 @@ PyObject* KX_TrackToActuator::PyGetObject(PyObject* args)
Py_RETURN_NONE;
if (ret_name_only)
- return PyString_FromString(m_object->GetName());
+ return PyUnicode_FromString(m_object->GetName());
else
return m_object->GetProxy();
}
@@ -589,7 +589,7 @@ const char KX_TrackToActuator::GetTime_doc[] =
PyObject* KX_TrackToActuator::PyGetTime()
{
ShowDeprecationWarning("getTime()", "the timer property");
- return PyInt_FromLong(m_time);
+ return PyLong_FromSsize_t(m_time);
}
@@ -601,7 +601,7 @@ const char KX_TrackToActuator::GetUse3D_doc[] =
PyObject* KX_TrackToActuator::PyGetUse3D()
{
ShowDeprecationWarning("setTime()", "the use3D property");
- return PyInt_FromLong(!(m_allow3D == 0));
+ return PyLong_FromSsize_t(!(m_allow3D == 0));
}
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index b742c9d145a..484c8f38b3f 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -127,13 +127,13 @@ PyObject* KX_VehicleWrapper::PyGetWheelOrientationQuaternion(PyObject* args)
PyObject* KX_VehicleWrapper::PyGetNumWheels(PyObject* args)
{
- return PyInt_FromLong(m_vehicle->GetNumWheels());
+ return PyLong_FromSsize_t(m_vehicle->GetNumWheels());
}
PyObject* KX_VehicleWrapper::PyGetConstraintId(PyObject* args)
{
- return PyInt_FromLong(m_vehicle->GetUserConstraintId());
+ return PyLong_FromSsize_t(m_vehicle->GetUserConstraintId());
}
@@ -264,7 +264,7 @@ PyObject* KX_VehicleWrapper::PySetSteeringValue(PyObject* args)
PyObject* KX_VehicleWrapper::PyGetConstraintType(PyObject* args)
{
- return PyInt_FromLong(m_vehicle->GetUserConstraintType());
+ return PyLong_FromSsize_t(m_vehicle->GetUserConstraintType());
}
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index e4192bf7d67..34a84f908a8 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -114,7 +114,7 @@ PyAttributeDef KX_VertexProxy::Attributes[] = {
PyObject*
KX_VertexProxy::py_getattro(PyObject *attr)
{
- char *attr_str= PyString_AsString(attr);
+ char *attr_str= _PyUnicode_AsString(attr);
if (attr_str[1]=='\0') { // Group single letters
// pos
if (attr_str[0]=='x')
@@ -169,7 +169,7 @@ KX_VertexProxy::py_getattro(PyObject *attr)
#if 0
int KX_VertexProxy::py_setattro(PyObject *attr, PyObject *pyvalue)
{
- char *attr_str= PyString_AsString(attr);
+ char *attr_str= _PyUnicode_AsString(attr);
if (PySequence_Check(pyvalue))
{
if (!strcmp(attr_str, "XYZ"))
@@ -384,13 +384,13 @@ PyObject* KX_VertexProxy::PySetNormal(PyObject* value)
PyObject* KX_VertexProxy::PyGetRGBA()
{
int *rgba = (int *) m_vertex->getRGBA();
- return PyInt_FromLong(*rgba);
+ return PyLong_FromSsize_t(*rgba);
}
PyObject* KX_VertexProxy::PySetRGBA(PyObject* value)
{
- if PyInt_Check(value) {
- int rgba = PyInt_AsLong(value);
+ if PyLong_Check(value) {
+ int rgba = PyLong_AsSsize_t(value);
m_vertex->SetRGBA(rgba);
m_mesh->SetMeshModified(true);
Py_RETURN_NONE;
diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.cpp b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
index 6b23105a278..6d26e5b6d35 100644
--- a/source/gameengine/VideoTexture/FilterBlueScreen.cpp
+++ b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
@@ -81,17 +81,17 @@ static int setColor (PyFilter * self, PyObject * value, void * closure)
{
// check validity of parameter
if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 3
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1))
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 2)))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 3 ints");
return -1;
}
// set color
- getFilter(self)->setColor((unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
- (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2))));
+ getFilter(self)->setColor((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
+ (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))));
// success
return 0;
}
@@ -108,15 +108,15 @@ static int setLimits (PyFilter * self, PyObject * value, void * closure)
{
// check validity of parameter
if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set limits
- getFilter(self)->setLimits((unsigned short)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned short)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1))));
+ getFilter(self)->setLimits((unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/FilterColor.cpp b/source/gameengine/VideoTexture/FilterColor.cpp
index 5ff1f7f11ce..eb86f520e02 100644
--- a/source/gameengine/VideoTexture/FilterColor.cpp
+++ b/source/gameengine/VideoTexture/FilterColor.cpp
@@ -147,10 +147,10 @@ static int setMatrix (PyFilter * self, PyObject * value, void * closure)
for (int c = 0; valid && c < 5; ++c)
{
// item must be int
- valid = PyInt_Check(PySequence_Fast_GET_ITEM(row, c));
+ valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
// if it is valid, save it in matrix
if (valid)
- mat[r][c] = short(PyInt_AsLong(PySequence_Fast_GET_ITEM(row, c)));
+ mat[r][c] = short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
}
}
// if parameter is not valid, report error
@@ -286,10 +286,10 @@ static int setLevels (PyFilter * self, PyObject * value, void * closure)
for (int c = 0; valid && c < 2; ++c)
{
// item must be int
- valid = PyInt_Check(PySequence_Fast_GET_ITEM(row, c));
+ valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
// if it is valid, save it in matrix
if (valid)
- lev[r][c] = (unsigned short)(PyInt_AsLong(PySequence_Fast_GET_ITEM(row, c)));
+ lev[r][c] = (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
}
}
// if parameter is not valid, report error
diff --git a/source/gameengine/VideoTexture/FilterNormal.cpp b/source/gameengine/VideoTexture/FilterNormal.cpp
index 9a2b1e90d5a..002be6c3189 100644
--- a/source/gameengine/VideoTexture/FilterNormal.cpp
+++ b/source/gameengine/VideoTexture/FilterNormal.cpp
@@ -72,13 +72,13 @@ static PyObject * getColor (PyFilter * self, void * closure)
static int setColor (PyFilter * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PyInt_Check(value))
+ if (value == NULL || !PyLong_Check(value))
{
PyErr_SetString(PyExc_TypeError, "filt.colorIdx = int: VideoTexture.FilterNormal, expected the value must be a int");
return -1;
}
// set color index
- getFilter(self)->setColor((unsigned short)(PyInt_AsLong(value)));
+ getFilter(self)->setColor((unsigned short)(PyLong_AsSsize_t(value)));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index c4fb1fefd9c..d8be08e0eb5 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -331,19 +331,19 @@ static int setBackground (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 4
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1))
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 2))
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 3)))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 3)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 4 integer between 0 and 255");
return -1;
}
// set background color
- getImageRender(self)->setBackground((unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
- (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2))),
- (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 3))));
+ getImageRender(self)->setBackground((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
+ (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))),
+ (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3))));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index d2c23e758f6..55b14396280 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -218,16 +218,16 @@ static int ImageViewport_setPosition (PyImage * self, PyObject * value, void * c
{
// check validity of parameter
if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set position
GLint pos [] = {
- GLint(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
- GLint(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
+ GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+ GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
};
getImageViewport(self)->setPosition(pos);
// success
@@ -246,16 +246,16 @@ int ImageViewport_setCaptureSize (PyImage * self, PyObject * value, void * closu
{
// check validity of parameter
if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+ || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set capture size
short size [] = {
- short(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
- short(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
+ short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+ short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
};
getImageViewport(self)->setCaptureSize(size);
// success
diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp
index 5d449a158d8..5de7a9e80a9 100644
--- a/source/gameengine/VideoTexture/VideoBase.cpp
+++ b/source/gameengine/VideoTexture/VideoBase.cpp
@@ -167,13 +167,13 @@ PyObject * Video_getRepeat (PyImage * self, void * closure)
int Video_setRepeat (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PyInt_Check(value))
+ if (value == NULL || !PyLong_Check(value))
{
PyErr_SetString(PyExc_TypeError, "The value must be an int");
return -1;
}
// set repeat
- getVideo(self)->setRepeat(int(PyInt_AsLong(value)));
+ getVideo(self)->setRepeat(int(PyLong_AsSsize_t(value)));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 1a5481488c0..cf4ea88c1b5 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -1095,13 +1095,13 @@ PyObject * VideoFFmpeg_getPreseek (PyImage *self, void * closure)
int VideoFFmpeg_setPreseek (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
- if (value == NULL || !PyInt_Check(value))
+ if (value == NULL || !PyLong_Check(value))
{
PyErr_SetString(PyExc_TypeError, "The value must be an integer");
return -1;
}
// set preseek
- getFFmpeg(self)->setPreseek(PyInt_AsLong(value));
+ getFFmpeg(self)->setPreseek(PyLong_AsSsize_t(value));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp
index dad52a426b6..22171f69321 100644
--- a/source/gameengine/VideoTexture/blendVideoTex.cpp
+++ b/source/gameengine/VideoTexture/blendVideoTex.cpp
@@ -67,7 +67,7 @@ static PyObject * getMaterialID (PyObject *self, PyObject *args)
// get last error description
static PyObject * getLastError (PyObject *self, PyObject *args)
{
- return PyString_FromString(Exception::m_lastError.c_str());
+ return PyUnicode_FromString(Exception::m_lastError.c_str());
}
// set log file