BGE Py API

use PY_SET_ATTR_FAIL and PY_SET_ATTR_SUCCESS return values so the fake subclassing can know if a value failed to be set or if it was missing from the type. (with PY_SET_ATTR_MISSING)

Also noticed some other mistakes.
- KX_LightObject, setting the type didnt check for an int.
- KX_SoundActuator, didnt return an error when assigning an invalid orientation value
- KX_GameObject, worldOrientation didnt return an error value.
This commit is contained in:
Campbell Barton
2009-05-19 07:16:40 +00:00
parent 5bd4b25dd1
commit 1a16fb1953
16 changed files with 89 additions and 83 deletions

View File

@@ -563,14 +563,14 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D
if (scriptArg==NULL) {
PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text");
return -1;
return PY_SET_ATTR_FAIL;
}
/* set scripttext sets m_bModified to true,
so next time the script is needed, a reparse into byte code is done */
self->SetScriptText(scriptArg);
return 0;
return PY_SET_ATTR_SUCCESS;
}