fixes for bugs submitted by BGE users, fixes by myself and Mitchell Stokes
authorCampbell Barton <ideasman42@gmail.com>
Sun, 3 May 2009 09:21:58 +0000 (09:21 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 3 May 2009 09:21:58 +0000 (09:21 +0000)
- 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.

release/scripts/vertexpaint_selfshadow_ao.py
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/PyDoc/KX_SceneActuator.py

index 95ba7d2..d641fd1 100644 (file)
@@ -180,6 +180,10 @@ def main():
        
        t= sys.time()
        vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY)
+       
+       if ob.modifiers:
+               me.update()
+       
        print 'done in %.6f' % (sys.time()-t)
 if __name__=='__main__':
        main()
index e6b4933..107b12b 100644 (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)
index c78283d..e8a291b 100644 (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;
 }
 
 /* ------------------------------------------------------------------------- */
index afc1fc5..18fd990 100644 (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;
index eed1bb8..64edb6c 100644 (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));
 }
 
index 2429cd6..8e806c2 100644 (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