From cfa07e8d2bdc0a8db15082a692ce25c2fb010ae6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 3 Sep 2008 06:43:07 +0000 Subject: BGE Py api, deleting properties didnt raise an error when the property wasnt there. also added some exception messages and renamed joystick getConnected() to isConnected() --- source/gameengine/Ketsji/KX_GameObject.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/gameengine/Ketsji') diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index c1b228e8d26..cc2956813c1 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1036,11 +1036,15 @@ PyObject* KX_GameObject::_getattr(const STR_String& attr) int KX_GameObject::_setattr(const STR_String& attr, PyObject *value) // _setattr method { - if (attr == "mass") + if (attr == "mass") { + PyErr_SetString(PyExc_AttributeError, "attribute \"mass\" is read only"); return 1; + } - if (attr == "parent") + if (attr == "parent") { + PyErr_SetString(PyExc_AttributeError, "attribute \"mass\" is read only\nUse setParent()"); return 1; + } if (PyInt_Check(value)) { @@ -1106,7 +1110,7 @@ int KX_GameObject::_setattr(const STR_String& attr, PyObject *value) // _setattr } return 1; } - + PyErr_SetString(PyExc_AttributeError, "could not set the orientation from a 3x3 matrix, quaternion or euler sequence"); return 1; } -- cgit v1.2.3