Revision: 20096
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20096
Author:   campbellbarton
Date:     2009-05-07 16:53:40 +0200 (Thu, 07 May 2009)

Log Message:
-----------
[#18645] Texture painting smudge brush darkens images - 2.49RC1
not fixed but the problem is now less bad when projection painting, bilinear 
interpolation was rounding down.
- added gameOb.attrDict to get the internal gameObject dict.
- mesh.getVertex wasnt setting an exception.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/imageprocess.c
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.h
    trunk/blender/source/gameengine/Ketsji/KX_MeshProxy.cpp
    trunk/blender/source/gameengine/PyDoc/KX_GameObject.py

Modified: trunk/blender/source/blender/imbuf/intern/imageprocess.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/imageprocess.c    2009-05-07 
09:52:36 UTC (rev 20095)
+++ trunk/blender/source/blender/imbuf/intern/imageprocess.c    2009-05-07 
14:53:40 UTC (rev 20096)
@@ -294,10 +294,12 @@
                b= v-floor(v);
                a_b= a*b; ma_b= (1.0f-a)*b; a_mb= a*(1.0f-b); ma_mb= 
(1.0f-a)*(1.0f-b);
                
-               outI[0]= ma_mb*row1I[0] + a_mb*row3I[0] + ma_b*row2I[0]+ 
a_b*row4I[0];
-               outI[1]= ma_mb*row1I[1] + a_mb*row3I[1] + ma_b*row2I[1]+ 
a_b*row4I[1];
-               outI[2]= ma_mb*row1I[2] + a_mb*row3I[2] + ma_b*row2I[2]+ 
a_b*row4I[2];
-               outI[3]= ma_mb*row1I[3] + a_mb*row3I[3] + ma_b*row2I[3]+ 
a_b*row4I[3];
+               /* need to add 0.5 to avoid rounding down (causes darken with 
the smear brush)
+                * tested with white images and this should not wrap back to 
zero */
+               outI[0]= (ma_mb*row1I[0] + a_mb*row3I[0] + ma_b*row2I[0]+ 
a_b*row4I[0]) + 0.5f;
+               outI[1]= (ma_mb*row1I[1] + a_mb*row3I[1] + ma_b*row2I[1]+ 
a_b*row4I[1]) + 0.5f;
+               outI[2]= (ma_mb*row1I[2] + a_mb*row3I[2] + ma_b*row2I[2]+ 
a_b*row4I[2]) + 0.5f;
+               outI[3]= (ma_mb*row1I[3] + a_mb*row3I[3] + ma_b*row2I[3]+ 
a_b*row4I[3]) + 0.5f;
        }
 }
 

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp    2009-05-07 
09:52:36 UTC (rev 20095)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp    2009-05-07 
14:53:40 UTC (rev 20096)
@@ -1208,6 +1208,7 @@
        KX_PYATTRIBUTE_RW_FUNCTION("worldPosition",     KX_GameObject, 
pyattr_get_worldPosition,    pyattr_set_worldPosition),
        KX_PYATTRIBUTE_RW_FUNCTION("localScaling",      KX_GameObject, 
pyattr_get_localScaling, pyattr_set_localScaling),
        KX_PYATTRIBUTE_RO_FUNCTION("worldScaling",      KX_GameObject, 
pyattr_get_worldScaling),
+       KX_PYATTRIBUTE_RO_FUNCTION("attrDict",  KX_GameObject, 
pyattr_get_attrDict),
        
        /* Experemental, dont rely on these yet */
        KX_PYATTRIBUTE_RO_FUNCTION("sensors",           KX_GameObject, 
pyattr_get_sensors),
@@ -1766,6 +1767,17 @@
        return resultlist;
 }
 
+PyObject* KX_GameObject::pyattr_get_attrDict(void *self_v, const 
KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
+       
+       if(self->m_attr_dict==NULL)
+               self->m_attr_dict= PyDict_New();
+       
+       Py_INCREF(self->m_attr_dict);
+       return self->m_attr_dict;
+}
+
 /* We need these because the macros have a return in them */
 PyObject* KX_GameObject::py_getattro__internal(PyObject *attr)
 {

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.h      2009-05-07 
09:52:36 UTC (rev 20095)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.h      2009-05-07 
14:53:40 UTC (rev 20096)
@@ -895,6 +895,7 @@
        static PyObject*        pyattr_get_state(void *self_v, const 
KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_state(void *self_v, const 
KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
        static PyObject*        pyattr_get_meshes(void* self_v, const 
KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject*        pyattr_get_attrDict(void *self_v, const 
KX_PYATTRIBUTE_DEF *attrdef);
        
        /* Experemental! */
        static PyObject*        pyattr_get_sensors(void *self_v, const 
KX_PYATTRIBUTE_DEF *attrdef);

Modified: trunk/blender/source/gameengine/Ketsji/KX_MeshProxy.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_MeshProxy.cpp     2009-05-07 
09:52:36 UTC (rev 20095)
+++ trunk/blender/source/gameengine/Ketsji/KX_MeshProxy.cpp     2009-05-07 
14:53:40 UTC (rev 20096)
@@ -221,24 +221,21 @@
 
 PyObject* KX_MeshProxy::PyGetVertex(PyObject* args, PyObject* kwds)
 {
-    int vertexindex= 1;
-       int matindex= 1;
+    int vertexindex;
+       int matindex;
        PyObject* vertexob = NULL;
 
-       if (PyArg_ParseTuple(args,"ii:getVertex",&matindex,&vertexindex))
-       {
-               RAS_TexVert* vertex = 
m_meshobj->GetVertex(matindex,vertexindex);
-               if (vertex)
-               {
-                       vertexob = (new KX_VertexProxy(this, 
vertex))->NewProxy(true);
-               }
-       }
-       else {
+       if (!PyArg_ParseTuple(args,"ii:getVertex",&matindex,&vertexindex))
                return NULL;
+       
+       RAS_TexVert* vertex = m_meshobj->GetVertex(matindex,vertexindex);
+       
+       if(vertex==NULL) {
+               PyErr_SetString(PyExc_ValueError, "mesh.getVertex(mat_idx, 
vert_idx): KX_MeshProxy, could not get a vertex at the given indicies");
+               return NULL;
        }
-
-       return vertexob;
-               
+       
+       return (new KX_VertexProxy(this, vertex))->NewProxy(true);
 }
 
 PyObject* KX_MeshProxy::PyGetPolygon(PyObject* args, PyObject* kwds)

Modified: trunk/blender/source/gameengine/PyDoc/KX_GameObject.py
===================================================================
--- trunk/blender/source/gameengine/PyDoc/KX_GameObject.py      2009-05-07 
09:52:36 UTC (rev 20095)
+++ trunk/blender/source/gameengine/PyDoc/KX_GameObject.py      2009-05-07 
14:53:40 UTC (rev 20096)
@@ -79,6 +79,8 @@
                - note: This attribute is experemental and may be removed (but 
probably wont be).
                - note: Changes to this list will not update the KX_GameObject.
        @type actuators: list
+       @ivar attrDict: get the objects internal python attribute dictionary 
for direct (faster) access.
+       @type attrDict: dict
        @group Deprecated: getPosition, setPosition, setWorldPosition, 
getOrientation, setOrientation, getState, setState, getParent, getVisible, 
getMass, getMesh
        """
        def endObject():


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to