diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-06-03 08:12:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-06-03 08:12:59 +0400 |
commit | 903722299d19a061ec38ca9f17fccc8b389b95a7 (patch) | |
tree | 2797395cf33dadf58fd786dc03dc655c3d450567 /source/gameengine/Expressions/Value.cpp | |
parent | a9c29cd4154fcc3933d59eb06d4fe20790298e88 (diff) |
BGE PyAPI fixes
- CValue warning ShowDeprecationWarning("val = ob.attr", "val = ob['attr']"); had false positives because of python using getattr() internally. Only show the wanring now when a CValue is found.
- Py functions that accepted a vector and a GameObject were slowed down by PySequence_Check() first called on the GameObject, though this would fail it would try and get attributes from the game object - ending up in ~8 attribute lookups each time. Avoiding PySequence_Check() makes ob.getDistanceTo(otherOb) over twice as fast.
- Joystick hat events could crash the BGE for joysticks with more then 4 hats.
- PLY Import failed on PLY files from Carve, added some extra types.
Diffstat (limited to 'source/gameengine/Expressions/Value.cpp')
-rw-r--r-- | source/gameengine/Expressions/Value.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp index 7f4ed388442..e6ef9733da8 100644 --- a/source/gameengine/Expressions/Value.cpp +++ b/source/gameengine/Expressions/Value.cpp @@ -555,15 +555,16 @@ PyAttributeDef CValue::Attributes[] = { PyObject* CValue::py_getattro(PyObject *attr) -{ - ShowDeprecationWarning("val = ob.attr", "val = ob['attr']"); - +{ char *attr_str= PyString_AsString(attr); CValue* resultattr = GetProperty(attr_str); if (resultattr) { + /* only show the wanting here because python inspects for __class__ and KX_MeshProxy uses CValues name attr */ + ShowDeprecationWarning("val = ob.attr", "val = ob['attr']"); + PyObject* pyconvert = resultattr->ConvertValueToPython(); - + if (pyconvert) return pyconvert; else |