bugfix [#21748] KX_Object scaling property not "writing" vector access .:. e.g. obj...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 14 Jun 2010 01:41:43 +0000 (01:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 14 Jun 2010 01:41:43 +0000 (01:41 +0000)
- made worldspace readonly
- mathutils 'set' callbacks can now set their own error

source/blender/python/generic/mathutils.c
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_ObjectActuator.cpp

index f17311f..95be795 100644 (file)
@@ -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;
 }
 
index abc597a..ecfacb8 100644 (file)
@@ -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 = {
index dff9555..df071d5 100644 (file)
@@ -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 = {