fixes for bugs submitted by BGE users, fixes by myself and Mitchell Stokes

- when the attribute check function failed it didnt set an error raising a SystemError instead
- Rasterizer.getMaterialMode would never return KX_BLENDER_MULTITEX_MATERIAL
- PropertySensor value attribute checking function was always returning a fail.
- Vertex Self Shadow python script didnt update for meshes with modifiers.
This commit is contained in:
Campbell Barton
2009-05-03 09:21:58 +00:00
parent b0ec497f39
commit 22b501c791
6 changed files with 16 additions and 7 deletions

View File

@@ -519,6 +519,10 @@ int PyObjectPlus::py_set_attrdef(void *self, const PyAttributeDef *attrdef, PyOb
{
if ((*attrdef->m_checkFunction)(self, attrdef) != 0)
{
// if the checing function didnt set an error then set a generic one here so we dont set an error with no exception
if (PyErr_Occurred()==0)
PyErr_Format(PyExc_AttributeError, "type check error for attribute \"%s\", reasion unknown", attrdef->m_name);
// post check returned an error, restore values
UNDO_AND_ERROR:
if (undoBuffer)

View File

@@ -295,9 +295,8 @@ CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername)
int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
{
bool result = true;
/* There is no type checking at this moment, unfortunately... */
return result;
return 0;
}
/* ------------------------------------------------------------------------- */

View File

@@ -1004,7 +1004,7 @@ static PyObject* gPyGetMaterialType(PyObject*)
{
int flag;
if(G.fileflags & (G_FILE_GAME_MAT|G_FILE_GAME_MAT_GLSL))
if(G.fileflags & G_FILE_GAME_MAT_GLSL)
flag = KX_BLENDER_GLSL_MATERIAL;
else if(G.fileflags & G_FILE_GAME_MAT)
flag = KX_BLENDER_MULTITEX_MATERIAL;

View File

@@ -363,7 +363,7 @@ const char KX_SceneActuator::SetUseRestart_doc[] =
"\tSet flag to 1 to restart the scene.\n" ;
PyObject* KX_SceneActuator::PySetUseRestart(PyObject* args)
{
ShowDeprecationWarning("setUseRestart()", "(no replacement)");
ShowDeprecationWarning("setUseRestart()", "the useRestart property");
int boolArg;
if (!PyArg_ParseTuple(args, "i:setUseRestart", &boolArg))
@@ -384,7 +384,7 @@ const char KX_SceneActuator::GetUseRestart_doc[] =
"\tReturn whether the scene will be restarted.\n" ;
PyObject* KX_SceneActuator::PyGetUseRestart()
{
ShowDeprecationWarning("getUseRestart()", "(no replacement)");
ShowDeprecationWarning("getUseRestart()", "the useRestart property");
return PyInt_FromLong(!(m_restart == 0));
}

View File

@@ -18,12 +18,14 @@ class KX_SceneActuator(SCA_IActuator):
@ivar camera: the camera to change to.
When setting the attribute, you can use either a L{KX_Camera} or the name of the camera.
@type camera: L{KX_Camera} on read, string or L{KX_Camera} on write
@ivar useRestart: Set flag to True to restart the sene
@type useRestart: bool
@type mode: The mode of the actuator
@type mode: int from 0 to 5 L{GameLogic.Scene Actuator}
"""
def setUseRestart(flag):
"""
DEPRECATED
DEPRECATED: use the useRestart property instead
Set flag to True to restart the scene.
@type flag: boolean
@@ -46,7 +48,7 @@ class KX_SceneActuator(SCA_IActuator):
"""
def getUseRestart():
"""
DEPRECATED
DEPRECATED: use the useRestart property instead
Returns True if the scene will be restarted.
@rtype: boolean