Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/Ketsji/KX_PythonInit.cpp
| Show First 20 Lines • Show All 1,033 Lines • ▼ Show 20 Lines | if (!PyVecTo(value, vec)) | ||||
| return NULL; | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.SetBackgroundColor(color), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.SetBackgroundColor(color), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("setBackgroundColor()", "KX_WorldInfo.background_color"); | |||||
| wi->setBackColor((float)vec[0], (float)vec[1], (float)vec[2]); | wi->setBackColor((float)vec[0], (float)vec[1], (float)vec[2]); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetMistColor(PyObject *, PyObject *value) | static PyObject *gPySetMistColor(PyObject *, PyObject *value) | ||||
| { | { | ||||
| MT_Vector3 vec; | MT_Vector3 vec; | ||||
| if (!PyVecTo(value, vec)) | if (!PyVecTo(value, vec)) | ||||
| return NULL; | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistColor(color), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistColor(color), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("setMistColor()", "KX_WorldInfo.mist_color"); | |||||
| wi->setMistColor((float)vec[0], (float)vec[1], (float)vec[2]); | wi->setMistColor((float)vec[0], (float)vec[1], (float)vec[2]); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPyDisableMist(PyObject *) | static PyObject *gPyDisableMist(PyObject *) | ||||
| { | { | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.DisableMist(), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.DisableMist(), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("DisableMist()", "setUseMist(false)"); | ShowDeprecationWarning("DisableMist()", "KX_WorldInfo.mist_enable = False"); | ||||
| wi->setUseMist(false); | wi->setUseMist(false); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetUseMist(PyObject *, PyObject *args) | static PyObject *gPySetUseMist(PyObject *, PyObject *args) | ||||
| { | { | ||||
| int enable; | int enable; | ||||
| if (!PyArg_ParseTuple(args,"i:setUseMist",&enable)) | if (!PyArg_ParseTuple(args,"i:setUseMist",&enable)) | ||||
| return NULL; | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setUseMist(enable), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.setUseMist(enable), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("setUseMist()", "KX_WorldInfo.mist_enable"); | |||||
| wi->setUseMist(enable); | wi->setUseMist(enable); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetMistType(PyObject *, PyObject *args) | static PyObject *gPySetMistType(PyObject *, PyObject *args) | ||||
| { | { | ||||
| short type; | short type; | ||||
| if (!PyArg_ParseTuple(args,"i:setMistType",&type)) | if (!PyArg_ParseTuple(args,"i:setMistType",&type)) | ||||
| return NULL; | return NULL; | ||||
| if (type < 0 || type > 2) { | if (type < 0 || type > 2) { | ||||
| PyErr_SetString(PyExc_ValueError, "Rasterizer.setMistType(int): Mist type is not known"); | PyErr_SetString(PyExc_ValueError, "Rasterizer.setMistType(int): Mist type is not known"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistType(int), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistType(int), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("setMistType()", "KX_WorldInfo.mist_type"); | |||||
| wi->setMistType(type); | wi->setMistType(type); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetMistStart(PyObject *, PyObject *args) | static PyObject *gPySetMistStart(PyObject *, PyObject *args) | ||||
| { | { | ||||
| float miststart; | float miststart; | ||||
| if (!PyArg_ParseTuple(args,"f:setMistStart",&miststart)) | if (!PyArg_ParseTuple(args,"f:setMistStart",&miststart)) | ||||
| return NULL; | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistStart(float), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistStart(float), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("setMistStart()", "KX_WorldInfo.mist_start"); | |||||
| wi->setMistStart(miststart); | wi->setMistStart(miststart); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetMistEnd(PyObject *, PyObject *args) | static PyObject *gPySetMistEnd(PyObject *, PyObject *args) | ||||
| { | { | ||||
| float mistdist; | float mistdist; | ||||
| if (!PyArg_ParseTuple(args,"f:setMistEnd",&mistdist)) | if (!PyArg_ParseTuple(args,"f:setMistEnd",&mistdist)) | ||||
| return NULL; | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistEnd(float), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistEnd(float), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("setMistEnd()", "KX_WorldInfo.mist_distance"); | |||||
| wi->setMistDistance(mistdist); | wi->setMistDistance(mistdist); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetMistIntensity(PyObject *, PyObject *args) | static PyObject *gPySetMistIntensity(PyObject *, PyObject *args) | ||||
| { | { | ||||
| float intensity; | float intensity; | ||||
| if (!PyArg_ParseTuple(args,"f:setMistIntensity",&intensity)) | if (!PyArg_ParseTuple(args,"f:setMistIntensity",&intensity)) | ||||
| return NULL; | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistIntensity(float), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.setMistIntensity(float), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("setMistIntensity()", "KX_WorldInfo.mist_intensity"); | |||||
| wi->setMistIntensity(intensity); | wi->setMistIntensity(intensity); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPySetAmbientColor(PyObject *, PyObject *value) | static PyObject *gPySetAmbientColor(PyObject *, PyObject *value) | ||||
| { | { | ||||
| MT_Vector3 vec; | MT_Vector3 vec; | ||||
| if (!PyVecTo(value, vec)) | if (!PyVecTo(value, vec)) | ||||
| return NULL; | return NULL; | ||||
| KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); | ||||
| if (!wi->hasWorld()) { | if (!wi->hasWorld()) { | ||||
| PyErr_SetString(PyExc_RuntimeError, "bge.render.setAmbientColor(color), World not available"); | PyErr_SetString(PyExc_RuntimeError, "bge.render.setAmbientColor(color), World not available"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ShowDeprecationWarning("setAmbientColor()", "KX_WorldInfo.ambient_color"); | |||||
| wi->setAmbientColor((float)vec[0], (float)vec[1], (float)vec[2]); | wi->setAmbientColor((float)vec[0], (float)vec[1], (float)vec[2]); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static PyObject *gPyMakeScreenshot(PyObject *, PyObject *args) | static PyObject *gPyMakeScreenshot(PyObject *, PyObject *args) | ||||
| { | { | ||||
| char* filename; | char* filename; | ||||
| ▲ Show 20 Lines • Show All 1,582 Lines • Show Last 20 Lines | |||||