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-05-31 21:44:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-05-31 21:44:38 +0400
commit8e882d0d6118d39d5533eff2d196be4bca4be889 (patch)
tree40813c58705166ede6755b0bfed323b73e600506 /source/gameengine/Expressions
parent759d31d320a5f5acc06444bb49ee58948de2d997 (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/Expressions')
-rw-r--r--source/gameengine/Expressions/ListValue.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index c741a6d8809..a0d73c75d60 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -77,8 +77,13 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
if (PyString_Check(pyindex))
{
CValue *item = ((CListValue*) list)->FindValue(PyString_AsString(pyindex));
- if (item)
- return item->GetProxy();
+ if (item) {
+ PyObject* pyobj = item->ConvertValueToPython();
+ if(pyobj)
+ return pyobj;
+ else
+ return item->GetProxy();
+ }
}
else if (PyInt_Check(pyindex))
{
@@ -575,9 +580,13 @@ PyObject* CListValue::Pyget(PyObject *args)
return NULL;
CValue *item = FindValue((const char *)key);
- if (item)
- return item->GetProxy();
-
+ if (item) {
+ PyObject* pyobj = item->ConvertValueToPython();
+ if (pyobj)
+ return pyobj;
+ else
+ return item->GetProxy();
+ }
Py_INCREF(def);
return def;
}