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 /source/gameengine/Expressions/Value.cpp
parentbb1f24ac443bcc386cf2cc3765609aaf9bf51db1 (diff)
BGE Py API using python3 c/api calls. include bpy_compat.h to support py2.x
Diffstat (limited to 'source/gameengine/Expressions/Value.cpp')
-rw-r--r--source/gameengine/Expressions/Value.cpp14
1 files changed, 8 insertions, 6 deletions
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 );
}