BGE: Extend Python API for KX_BlenderMaterial (specular, diffuse…)

Add support for material diffuse, specular… in KX_BlenderMaterial python proxy. And use mathutils in KX_BlenderMaterial for the specular and diffuse color in KX_BlenderMaterial.

Reviewers: sybren, brita_, kupoman, agoose77, dfelinto, moguri, campbellbarton, hg1

Reviewed By: moguri, campbellbarton, hg1

Subscribers: dfelinto

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1298
This commit is contained in:
Porteries Tristan
2015-07-03 11:47:48 +02:00
parent 659e5234af
commit 145ab8c49e
6 changed files with 368 additions and 0 deletions

View File

@@ -197,4 +197,19 @@ PyObject *PyObjectFrom(const MT_Tuple2 &vec)
#endif
}
PyObject *PyColorFromVector(const MT_Vector3 &vec)
{
#ifdef USE_MATHUTILS
float fvec[3];
vec.getValue(fvec);
return Color_CreatePyObject(fvec, NULL);
#else
PyObject *list = PyList_New(3);
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0]));
PyList_SET_ITEM(list, 1, PyFloat_FromDouble(vec[1]));
PyList_SET_ITEM(list, 2, PyFloat_FromDouble(vec[2]));
return list;
#endif
}
#endif // WITH_PYTHON