forked from bartvdbraak/blender
[#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.
This commit is contained in:
parent
42557f90bd
commit
f590ffdadc
@ -294,10 +294,12 @@ void bilinear_interpolation_color(struct ImBuf *in, unsigned char *outI, float *
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1208,6 +1208,7 @@ PyAttributeDef KX_GameObject::Attributes[] = {
|
||||
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 @@ PyObject* KX_GameObject::pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE
|
||||
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)
|
||||
{
|
||||
|
@ -895,6 +895,7 @@ public:
|
||||
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);
|
||||
|
@ -221,24 +221,21 @@ PyObject* KX_MeshProxy::PyGetVertexArrayLength(PyObject* args, PyObject* kwds)
|
||||
|
||||
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)
|
||||
|
@ -79,6 +79,8 @@ class KX_GameObject(SCA_IObject):
|
||||
- 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():
|
||||
|
Loading…
Reference in New Issue
Block a user