Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Steiblys <imbusy@imbusy.org>2009-10-02 02:29:15 +0400
committerLukas Steiblys <imbusy@imbusy.org>2009-10-02 02:29:15 +0400
commit0677398a649b6b8c293df3ce3c6668f0a3be3bc8 (patch)
tree9d510a5bd23559bf4fae670ed04d7e5d6c12578c /source/gameengine/BlenderRoutines
parent59248e9f62006ba05e3098e4d213f3dcb23fe711 (diff)
parentbc942eceacb638735dc4f4f68252c4c207147a70 (diff)
merge from 23153 to 23595soc-2009-imbusy
Diffstat (limited to 'source/gameengine/BlenderRoutines')
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp48
-rw-r--r--source/gameengine/BlenderRoutines/CMakeLists.txt8
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp1
-rw-r--r--source/gameengine/BlenderRoutines/Makefile1
-rw-r--r--source/gameengine/BlenderRoutines/SConscript7
5 files changed, 52 insertions, 13 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index ae46f880711..df7f35d7773 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -34,6 +34,7 @@
#include <signal.h>
#include <stdlib.h>
+#include <stdio.h>
#ifdef WIN32
// don't show stl-warnings
@@ -89,6 +90,8 @@ extern "C" {
#include "DNA_scene_types.h"
/***/
+#include "AUD_C-API.h"
+
//XXX #include "BSE_headerbuttons.h"
#include "BKE_context.h"
#include "../../blender/windowmanager/WM_types.h"
@@ -135,6 +138,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
BLI_strncpy(oldsce, G.sce, sizeof(oldsce));
+#ifndef DISABLE_PYTHON
resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path
setGamePythonPath(G.sce);
@@ -143,6 +147,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
PyGILState_STATE gilstate = PyGILState_Ensure();
PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */
+#endif
bgl::InitExtensions(true);
@@ -204,8 +209,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
ketsjiengine->SetUseFixedTime(usefixed);
ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
+#ifndef DISABLE_PYTHON
CValue::SetDeprecationWarnings(nodepwarnings);
-
+#endif
//lock frame and camera enabled - storing global values
int tmp_lay= scene->lay;
@@ -286,7 +292,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
if(blenderdata) {
BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce));
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
+#ifndef DISABLE_PYTHON
setGamePythonPath(G.sce);
+#endif
}
}
// else forget it, we can't find it
@@ -363,10 +371,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
networkdevice,
startscenename,
blscene);
-
+
+#ifndef DISABLE_PYTHON
// some python things
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest, blenderdata);
- ketsjiengine->SetPythonDictionary(dictionaryobject);
+ ketsjiengine->SetPyNamespace(dictionaryobject);
initRasterizer(rasterizer, canvas);
PyObject *gameLogic = initGameLogic(ketsjiengine, startscene);
PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
@@ -381,17 +390,22 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
#ifdef WITH_FFMPEG
initVideoTexture();
#endif
+#endif // DISABLE_PYTHON
//initialize Dome Settings
if(blscene->gm.stereoflag == STEREO_DOME)
ketsjiengine->InitDome(blscene->gm.dome.res, blscene->gm.dome.mode, blscene->gm.dome.angle, blscene->gm.dome.resbuf, blscene->gm.dome.tilt, blscene->gm.dome.warptext);
+ // initialize 3D Audio Settings
+ AUD_set3DSetting(AUD_3DS_SPEED_OF_SOUND, blscene->audio.speed_of_sound);
+ AUD_set3DSetting(AUD_3DS_DOPPLER_FACTOR, blscene->audio.doppler_factor);
+ AUD_set3DSetting(AUD_3DS_DISTANCE_MODEL, blscene->audio.distance_model);
+
if (sceneconverter)
{
// convert and add scene
sceneconverter->ConvertScene(
startscene,
- dictionaryobject,
rendertools,
canvas);
ketsjiengine->AddScene(startscene);
@@ -461,7 +475,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
// when exiting the mainloop
-
+#ifndef DISABLE_PYTHON
// Clears the dictionary by hand:
// This prevents, extra references to global variables
// inside the GameLogic dictionary when the python interpreter is finalized.
@@ -481,9 +495,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
}
Py_DECREF(gameLogic_keys_new);
gameLogic_keys_new = NULL;
-
+#endif
ketsjiengine->StopEngine();
+#ifndef DISABLE_PYTHON
exitGamePythonScripting();
+#endif
networkdevice->Disconnect();
}
if (sceneconverter)
@@ -491,9 +507,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
delete sceneconverter;
sceneconverter = NULL;
}
-
+
+#ifndef DISABLE_PYTHON
Py_DECREF(gameLogic_keys);
gameLogic_keys = NULL;
+#endif
}
//lock frame and camera enabled - restoring global values
if (v3d->scenelock==0){
@@ -548,14 +566,17 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
} while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
- Py_DECREF(pyGlobalDict);
-
if (bfd) BLO_blendfiledata_free(bfd);
BLI_strncpy(G.sce, oldsce, sizeof(G.sce));
+#ifndef DISABLE_PYTHON
+ Py_DECREF(pyGlobalDict);
+
// Release Python's GIL
PyGILState_Release(gilstate);
+#endif
+
}
extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
@@ -574,9 +595,11 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
+#ifndef DISABLE_PYTHON
// Acquire Python's GIL (global interpreter lock)
// so we can safely run Python code and API calls
PyGILState_STATE gilstate = PyGILState_Ensure();
+#endif
bgl::InitExtensions(true);
@@ -673,9 +696,10 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
startscenename,
blscene);
+#ifndef DISABLE_PYTHON
// some python things
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest, blenderdata);
- ketsjiengine->SetPythonDictionary(dictionaryobject);
+ ketsjiengine->SetPyNamespace(dictionaryobject);
initRasterizer(rasterizer, canvas);
PyObject *gameLogic = initGameLogic(ketsjiengine, startscene);
PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module
@@ -687,13 +711,13 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
#ifdef WITH_FFMPEG
initVideoTexture();
#endif
+#endif // DISABLE_PYTHON
if (sceneconverter)
{
// convert and add scene
sceneconverter->ConvertScene(
startscene,
- dictionaryobject,
rendertools,
canvas);
ketsjiengine->AddScene(startscene);
@@ -771,6 +795,8 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
} while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
+#ifndef DISABLE_PYTHON
// Release Python's GIL
PyGILState_Release(gilstate);
+#endif
}
diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt
index ee15fd99ed5..f2d6528d797 100644
--- a/source/gameengine/BlenderRoutines/CMakeLists.txt
+++ b/source/gameengine/BlenderRoutines/CMakeLists.txt
@@ -6,6 +6,7 @@ SET(INC
../../../source/kernel/gen_system
../../../intern/string
../../../intern/guardedalloc
+ ../../../intern/audaspace/intern
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
../../../source/gameengine/Converter
../../../source/blender/imbuf
@@ -34,12 +35,17 @@ SET(INC
../../../source/blender/gpu
../../../extern/bullet2/src
../../../extern/glew/include
- ${PYTHON_INC}
)
IF(WITH_FFMPEG)
ADD_DEFINITIONS(-DWITH_FFMPEG)
ENDIF(WITH_FFMPEG)
+IF(WITH_PYTHON)
+ SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+ ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
BLENDERLIB(bf_blroutines "${SRC}" "${INC}")
#env.BlenderLib ( 'bf_bloutines', sources, Split(incs), [], libtype=['game', 'game2', 'player'], priority=[0, 0, 55] , compileflags=cxxflags)
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index dba6d1113c9..bb02f3b372e 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -44,6 +44,7 @@ extern "C" {
* This little block needed for linking to Blender...
*/
#ifdef WIN32
+#include <vector>
#include "BLI_winstuff.h"
#endif
diff --git a/source/gameengine/BlenderRoutines/Makefile b/source/gameengine/BlenderRoutines/Makefile
index 4b65da667ef..4a437aff97d 100644
--- a/source/gameengine/BlenderRoutines/Makefile
+++ b/source/gameengine/BlenderRoutines/Makefile
@@ -40,6 +40,7 @@ CPPFLAGS += -I$(NAN_STRING)/include
CPPFLAGS += -I$(NAN_MOTO)/include
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
+CPPFLAGS += -I$(NAN_AUDASPACE)/include
# because of kernel dependency on makesdna
CPPFLAGS += -I../../blender/makesdna
CPPFLAGS += -I../../blender/editors/include
diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript
index ad6f9f23fce..f076612e231 100644
--- a/source/gameengine/BlenderRoutines/SConscript
+++ b/source/gameengine/BlenderRoutines/SConscript
@@ -8,6 +8,7 @@ incs = '. #source/kernel/gen_system #intern/string #intern/guardedalloc'
incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer'
incs += ' #source/gameengine/Converter #source/blender/imbuf'
incs += ' #intern/ghost/include'
+incs += ' #intern/audaspace/intern'
incs += ' #intern/moto/include #source/gameengine/Ketsji #source/blender/blenlib'
incs += ' #source/blender/blenkernel #source/blender'
incs += ' #source/blender/blenfont #source/blender/editors/include'
@@ -24,7 +25,11 @@ incs += ' #source/blender/windowmanager'
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')
-incs += ' ' + env['BF_PYTHON_INC']
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
incs += ' ' + env['BF_BULLET_INC']
incs += ' ' + env['BF_OPENGL_INC']