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:
-rw-r--r--release/scripts/ply_import.py2
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h2
-rw-r--r--source/gameengine/Expressions/Value.cpp9
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h14
5 files changed, 23 insertions, 6 deletions
diff --git a/release/scripts/ply_import.py b/release/scripts/ply_import.py
index 43129ec01e9..29e8ce48361 100644
--- a/release/scripts/ply_import.py
+++ b/release/scripts/ply_import.py
@@ -149,6 +149,7 @@ def read(filename):
'uint8': 'B',
'int16': 'h',
'uint16': 'H',
+ 'ushort': 'H',
'int': 'i',
'int32': 'i',
'uint': 'I',
@@ -156,6 +157,7 @@ def read(filename):
'float': 'f',
'float32': 'f',
'float64': 'd',
+ 'double': 'd',
'string': 's'}
obj_spec = object_spec()
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 45797fe7975..369c00782cc 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -141,7 +141,7 @@ typedef struct {
#define BGE_PROXY_PYOWNS(_self) (((PyObjectPlus_Proxy *)_self)->py_owns)
/* Note, sometimes we dont care what BGE type this is as long as its a proxy */
-#define BGE_PROXY_CHECK_TYPE(_self) ((_self)->ob_type->tp_dealloc == py_base_dealloc)
+#define BGE_PROXY_CHECK_TYPE(_self) ((_self)->ob_type->tp_dealloc == PyObjectPlus::py_base_dealloc)
// This must be the first line of each
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
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
index 66193a2f4b9..53d3be35f92 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
@@ -45,7 +45,7 @@ void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event)
/* See notes below in the event loop */
void SCA_Joystick::OnHatMotion(SDL_Event* sdl_event)
{
- if(sdl_event->jhat.hat >= JOYAXIS_MAX)
+ if(sdl_event->jhat.hat >= JOYHAT_MAX)
return;
m_hat_array[sdl_event->jhat.hat]= sdl_event->jhat.value;
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);