diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_PyMath.h')
-rw-r--r-- | source/gameengine/Ketsji/KX_PyMath.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index 00f7c5cad93..a7ce4bc6930 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -40,6 +40,7 @@ #include "MT_Matrix4x4.h" #include "KX_Python.h" +#include "PyObjectPlus.h" inline unsigned int Size(const MT_Matrix4x4&) { return 4; } inline unsigned int Size(const MT_Matrix3x3&) { return 3; } @@ -116,6 +117,19 @@ bool PyVecTo(PyObject* pyval, T& vec) return true; } + else if (BGE_PROXY_CHECK_TYPE(pyval)) + { /* note, include this check because PySequence_Check does too much introspection + * on the PyObject (like getting its __class__, on a BGE type this means searching up + * the parent list each time only to discover its not a sequence. + * GameObjects are often used as an alternative to vectors so this is a common case + * better to do a quick check for it, likely the error below will be ignored. + * + * This is not 'correct' since we have proxy type CListValues's which could + * contain floats/ints but there no cases of CValueLists being this way + */ + PyErr_Format(PyExc_AttributeError, "expected a sequence type"); + return false; + } else if (PySequence_Check(pyval)) { unsigned int numitems = PySequence_Size(pyval); |