diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-31 21:44:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-31 21:44:38 +0400 |
commit | 8e882d0d6118d39d5533eff2d196be4bca4be889 (patch) | |
tree | 40813c58705166ede6755b0bfed323b73e600506 /source/gameengine/Ketsji/KX_GameObject.cpp | |
parent | 759d31d320a5f5acc06444bb49ee58948de2d997 (diff) |
Bug in KX_GameObject.get() and ListValue.get(), wasn't checking if the CValue derived objects could be converted to a PyObject.
so where foo is an int prop,
gameOb.get("foo") == 0, would end up returning a CValue int proxy.
This is more a problem for KX_GameObject since ListValues with python access mostly don't contain ints, strings, floats.
This also wont break games from 2.48 since the .get() function wasn't available.
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 04b1276569e..7f417b325c8 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -2758,8 +2758,13 @@ PyObject* KX_GameObject::Pyget(PyObject *args) if(PyString_Check(key)) { CValue *item = GetProperty(PyString_AsString(key)); - if (item) - return item->GetProxy(); + if (item) { + ret = item->ConvertValueToPython(); + if(ret) + return ret; + else + return item->GetProxy(); + } } if (m_attr_dict && (ret=PyDict_GetItem(m_attr_dict, key))) { |