2.5: Game Engine
* Added Shading and Performance panels in the scene buttons, containing the options previously in the 2.4x game menu. * Added show framerate/debug/physics/warnings back in game menu. * Moved these settings from G.fileflags to scene GameData. * Enabled Display Lists by default. * Some other small game scene button tweaks.
This commit is contained in:
@@ -92,6 +92,7 @@ extern "C" {
|
||||
|
||||
/* we only need this to get a list of libraries from the main struct */
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
|
||||
#include "marshal.h" /* python header for loading/saving dicts */
|
||||
@@ -206,8 +207,6 @@ static PyObject* gPySendMessage(PyObject*, PyObject* args)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static bool usedsp = false;
|
||||
|
||||
// this gets a pointer to an array filled with floats
|
||||
static PyObject* gPyGetSpectrum(PyObject*)
|
||||
{
|
||||
@@ -769,17 +768,17 @@ static PyObject* gPyDisableMotionBlur(PyObject*)
|
||||
int getGLSLSettingFlag(char *setting)
|
||||
{
|
||||
if(strcmp(setting, "lights") == 0)
|
||||
return G_FILE_GLSL_NO_LIGHTS;
|
||||
return GAME_GLSL_NO_LIGHTS;
|
||||
else if(strcmp(setting, "shaders") == 0)
|
||||
return G_FILE_GLSL_NO_SHADERS;
|
||||
return GAME_GLSL_NO_SHADERS;
|
||||
else if(strcmp(setting, "shadows") == 0)
|
||||
return G_FILE_GLSL_NO_SHADOWS;
|
||||
return GAME_GLSL_NO_SHADOWS;
|
||||
else if(strcmp(setting, "ramps") == 0)
|
||||
return G_FILE_GLSL_NO_RAMPS;
|
||||
return GAME_GLSL_NO_RAMPS;
|
||||
else if(strcmp(setting, "nodes") == 0)
|
||||
return G_FILE_GLSL_NO_NODES;
|
||||
return GAME_GLSL_NO_NODES;
|
||||
else if(strcmp(setting, "extra_textures") == 0)
|
||||
return G_FILE_GLSL_NO_EXTRA_TEX;
|
||||
return GAME_GLSL_NO_EXTRA_TEX;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
@@ -788,8 +787,9 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*,
|
||||
PyObject* args,
|
||||
PyObject*)
|
||||
{
|
||||
GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
|
||||
char *setting;
|
||||
int enable, flag, fileflags;
|
||||
int enable, flag, sceneflag;
|
||||
|
||||
if (!PyArg_ParseTuple(args,"si:setGLSLMaterialSetting",&setting,&enable))
|
||||
return NULL;
|
||||
@@ -801,15 +801,15 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fileflags = G.fileflags;
|
||||
sceneflag= gm->flag;
|
||||
|
||||
if (enable)
|
||||
G.fileflags &= ~flag;
|
||||
gm->flag &= ~flag;
|
||||
else
|
||||
G.fileflags |= flag;
|
||||
gm->flag |= flag;
|
||||
|
||||
/* display lists and GLSL materials need to be remade */
|
||||
if(G.fileflags != fileflags) {
|
||||
if(sceneflag != gm->flag) {
|
||||
GPU_materials_free();
|
||||
if(gp_KetsjiEngine) {
|
||||
KX_SceneList *scenes = gp_KetsjiEngine->CurrentScenes();
|
||||
@@ -830,6 +830,7 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*,
|
||||
PyObject* args,
|
||||
PyObject*)
|
||||
{
|
||||
GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
|
||||
char *setting;
|
||||
int enabled = 0, flag;
|
||||
|
||||
@@ -843,7 +844,7 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
enabled = ((G.fileflags & flag) != 0);
|
||||
enabled = ((gm->flag & flag) != 0);
|
||||
return PyLong_FromSsize_t(enabled);
|
||||
}
|
||||
|
||||
@@ -855,35 +856,34 @@ static PyObject* gPySetMaterialType(PyObject*,
|
||||
PyObject* args,
|
||||
PyObject*)
|
||||
{
|
||||
int flag, type;
|
||||
GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
|
||||
int type;
|
||||
|
||||
if (!PyArg_ParseTuple(args,"i:setMaterialType",&type))
|
||||
return NULL;
|
||||
|
||||
if(type == KX_BLENDER_GLSL_MATERIAL)
|
||||
flag = G_FILE_GAME_MAT|G_FILE_GAME_MAT_GLSL;
|
||||
gm->matmode= GAME_MAT_GLSL;
|
||||
else if(type == KX_BLENDER_MULTITEX_MATERIAL)
|
||||
flag = G_FILE_GAME_MAT;
|
||||
gm->matmode= GAME_MAT_MULTITEX;
|
||||
else if(type == KX_TEXFACE_MATERIAL)
|
||||
flag = 0;
|
||||
gm->matmode= GAME_MAT_TEXFACE;
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError, "Rasterizer.setMaterialType(int): material type is not known");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
G.fileflags &= ~(G_FILE_GAME_MAT|G_FILE_GAME_MAT_GLSL);
|
||||
G.fileflags |= flag;
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* gPyGetMaterialType(PyObject*)
|
||||
{
|
||||
GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
|
||||
int flag;
|
||||
|
||||
if(G.fileflags & G_FILE_GAME_MAT_GLSL)
|
||||
if(gm->matmode == GAME_MAT_GLSL)
|
||||
flag = KX_BLENDER_GLSL_MATERIAL;
|
||||
else if(G.fileflags & G_FILE_GAME_MAT)
|
||||
else if(gm->matmode == GAME_MAT_MULTITEX)
|
||||
flag = KX_BLENDER_MULTITEX_MATERIAL;
|
||||
else
|
||||
flag = KX_TEXFACE_MATERIAL;
|
||||
|
Reference in New Issue
Block a user