diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2005-01-23 04:40:37 +0300 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2005-01-23 04:40:37 +0300 |
commit | 413e4f51a638b9af2fe669e399d7219afdbdb932 (patch) | |
tree | 593310a879ef5d924ead75b98852b8fa8b6ad456 /source/gameengine/Ketsji/KX_PolygonMaterial.cpp | |
parent | d21b9be9a8ddb3225c2001e676be5046bb27a7d6 (diff) |
Make the KX_PolygonMaterial Python member variables writable.
Diffstat (limited to 'source/gameengine/Ketsji/KX_PolygonMaterial.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PolygonMaterial.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp index 81ff5ca6a3a..85963640caf 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp @@ -268,6 +268,97 @@ PyObject* KX_PolygonMaterial::_getattr(const STR_String& attr) int KX_PolygonMaterial::_setattr(const STR_String &attr, PyObject *pyvalue) { + if (PyFloat_Check(pyvalue)) + { + float value = PyFloat_AsDouble(pyvalue); + if (attr == "shininess") + { + m_shininess = value; + return 0; + } + + if (attr == "specularity") + { + m_specularity = value; + return 0; + } + } + + if (PyInt_Check(pyvalue)) + { + int value = PyInt_AsLong(pyvalue); + if (attr == "tile") + { + m_tile = value; + return 0; + } + + if (attr == "tilexrep") + { + m_tilexrep = value; + return 0; + } + + if (attr == "tileyrep") + { + m_tileyrep = value; + return 0; + } + + if (attr == "drawingmode") + { + m_drawingmode = value; + return 0; + } + + if (attr == "transparent") + { + m_transparant = value; + return 0; + } + + if (attr == "zsort") + { + m_zsort = value; + return 0; + } + + if (attr == "lightlayer") + { + m_lightlayer = value; + return 0; + } + + // This probably won't work... + if (attr == "triangle") + { + m_bIsTriangle = value; + return 0; + } + } + + if (PySequence_Check(pyvalue)) + { + if (PySequence_Size(pyvalue) == 3) + { + MT_Vector3 value; + if (PyVecTo(pyvalue, value)) + { + if (attr == "diffuse") + { + m_diffuse = value; + return 0; + } + + if (attr == "specular") + { + m_specular = value; + return 0; + } + } + } + } + return PyObjectPlus::_setattr(attr, pyvalue); } |