diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-06-14 05:41:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-06-14 05:41:43 +0400 |
commit | 374d3a66858a28ede6ad12fcd5a6a9efc7407935 (patch) | |
tree | 8dd14edcbac80ae41e1faf8cc18a8758cfeda9b3 | |
parent | a262847298e9d9f4426f991b4e6c3f9fa89163f8 (diff) |
bugfix [#21748] KX_Object scaling property not "writing" vector access .:. e.g. obj.scaling[2] = 2.0
- made worldspace readonly
- mathutils 'set' callbacks can now set their own error
-rw-r--r-- | source/blender/python/generic/mathutils.c | 12 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 7 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_ObjectActuator.cpp | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c index f17311f4a6a..95be795dd4e 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/generic/mathutils.c @@ -649,7 +649,8 @@ int _BaseMathObject_ReadCallback(BaseMathObject *self) if(cb->get(self, self->cb_subtype)) return 1; - PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); + if(!PyErr_Occurred()) + PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); return 0; } @@ -659,7 +660,8 @@ int _BaseMathObject_WriteCallback(BaseMathObject *self) if(cb->set(self, self->cb_subtype)) return 1; - PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); + if(!PyErr_Occurred()) + PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); return 0; } @@ -669,7 +671,8 @@ int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index) if(cb->get_index(self, self->cb_subtype, index)) return 1; - PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); + if(!PyErr_Occurred()) + PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); return 0; } @@ -679,7 +682,8 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index) if(cb->set_index(self, self->cb_subtype, index)) return 1; - PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); + if(!PyErr_Occurred()) + PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name); return 0; } diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index abc597a9eae..ecfacb8f9bb 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1329,7 +1329,8 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype) self->NodeUpdateGS(0.f); break; case MATHUTILS_VEC_CB_SCALE_GLOBAL: - break; + PyErr_SetString(PyExc_AttributeError, "KX_GameObject.worldScale is read-only"); + return 0; case MATHUTILS_VEC_CB_INERTIA_LOCAL: /* read only */ break; @@ -1370,9 +1371,7 @@ static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype, return 0; bmo->data[index]= f; - mathutils_kxgameob_vector_set(bmo, subtype); - - return 1; + return mathutils_kxgameob_vector_set(bmo, subtype); } Mathutils_Callback mathutils_kxgameob_vector_cb = { diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index dff95551d70..df071d50aa2 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -445,9 +445,7 @@ static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, i return 0; bmo->data[index]= f; - mathutils_obactu_vector_set(bmo, subtype); - - return 1; + return mathutils_obactu_vector_set(bmo, subtype); } Mathutils_Callback mathutils_obactu_vector_cb = { |