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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user