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
This commit is contained in:
Campbell Barton 2010-06-14 01:41:43 +00:00
parent a262847298
commit 374d3a6685
3 changed files with 12 additions and 11 deletions

@ -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;
}

@ -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 = {

@ -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 = {