Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-05-07 18:53:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-05-07 18:53:40 +0400
commitf590ffdadc0dceac9d37d30dc565ca083c3c7fca (patch)
tree44112f23b693d9b8472da7055b0953650732656a /source/gameengine
parent42557f90bd16771a5c6437dbfb3952527df7fb1a (diff)
[#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.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h1
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp25
-rw-r--r--source/gameengine/PyDoc/KX_GameObject.py2
4 files changed, 26 insertions, 14 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index b20c0dae97b..492f72584f5 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -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)
{
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 2869404ee9b..8fafcc1f9b6 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -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);
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index eede3a0e832..c0b05859539 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -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)
diff --git a/source/gameengine/PyDoc/KX_GameObject.py b/source/gameengine/PyDoc/KX_GameObject.py
index 2688de0d018..0f9bfea98f3 100644
--- a/source/gameengine/PyDoc/KX_GameObject.py
+++ b/source/gameengine/PyDoc/KX_GameObject.py
@@ -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():