diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-20 19:06:46 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-04-20 19:06:46 +0400 |
commit | 874c29cea8e6f9bc411fccf2d6f4cb07e94328d0 (patch) | |
tree | 5971e577cf7c02e05a1e37b5ad058c71a6744877 /source/gameengine/GamePlayer/ghost | |
parent | 7555bfa793a2b0fc187c6211c56986f35b2d7b09 (diff) | |
parent | c5bc4e4fb1a33eda8c31f2ea02e91f32f74c8fa5 (diff) |
2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323:HEAD
Notes:
* blenderbuttons and ICON_SNAP_PEEL_OBJECT were not merged.
Diffstat (limited to 'source/gameengine/GamePlayer/ghost')
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 22 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_Application.h | 6 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 15 |
3 files changed, 33 insertions, 10 deletions
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 81a0f1f4e99..109ed3790ff 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -151,7 +151,7 @@ GPG_Application::~GPG_Application(void) -bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene) +bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, int argc, char **argv) { bool result = false; @@ -163,6 +163,10 @@ bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene) m_startScene = scene; result = true; } + + /* Python needs these */ + m_argc= argc; + m_argv= argv; return result; } @@ -208,7 +212,7 @@ static LRESULT CALLBACK screenSaverWindowProc(HWND hwnd, UINT uMsg, WPARAM wPara BOOL CALLBACK findGhostWindowHWNDProc(HWND hwnd, LPARAM lParam) { - GHOST_IWindow *p = (GHOST_IWindow*) GetWindowLong(hwnd, GWL_USERDATA); + GHOST_IWindow *p = (GHOST_IWindow*) GetWindowLongPtr(hwnd, GWLP_USERDATA); BOOL ret = TRUE; if (p == ghost_window_to_find) { @@ -292,8 +296,8 @@ bool GPG_Application::startScreenSaverFullScreen( if (ghost_hwnd != NULL) { GetCursorPos(&scr_save_mouse_pos); - ghost_wnd_proc = (WNDPROC) GetWindowLong(ghost_hwnd, GWL_WNDPROC); - SetWindowLong(ghost_hwnd,GWL_WNDPROC, (LONG) screenSaverWindowProc); + ghost_wnd_proc = (WNDPROC) GetWindowLongPtr(ghost_hwnd, GWLP_WNDPROC); + SetWindowLongPtr(ghost_hwnd,GWLP_WNDPROC, (uintptr_t) screenSaverWindowProc); } } return ret; @@ -530,7 +534,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixed_framerate", fixedFr) != 0); bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", G.fileflags & G_FILE_DISPLAY_LISTS) != 0); - bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 0) != 0); + bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0); if(GLEW_ARB_multitexture && GLEW_VERSION_1_1) m_blendermat = (SYS_GetCommandLineInt(syshandle, "blender_material", 1) != 0); @@ -681,7 +685,7 @@ bool GPG_Application::startEngine(void) // some python things - PyObject* dictionaryobject = initGamePlayerPythonScripting("Ketsji", psl_Lowest); + PyObject* dictionaryobject = initGamePlayerPythonScripting("Ketsji", psl_Lowest, m_maggie, m_argc, m_argv); m_ketsjiengine->SetPythonDictionary(dictionaryobject); initRasterizer(m_rasterizer, m_canvas); PyObject *gameLogic = initGameLogic(m_ketsjiengine, startscene); @@ -689,9 +693,15 @@ bool GPG_Application::startEngine(void) initGameKeys(); initPythonConstraintBinding(); initMathutils(); + initBGL(); #ifdef WITH_FFMPEG initVideoTexture(); #endif + + //initialize Dome Settings + if(m_startScene->r.stereomode == RAS_IRasterizer::RAS_STEREO_DOME) + m_ketsjiengine->InitDome(m_startScene->r.domesize, m_startScene->r.domeres, m_startScene->r.domemode, m_startScene->r.domeangle, m_startScene->r.domeresbuf, m_startScene->r.dometext); + // Set the GameLogic.globalDict from marshal'd data, so we can // load new blend files and keep data in GameLogic.globalDict loadGamePythonConfig(m_pyGlobalDictString, m_pyGlobalDictString_Length); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h index 38408f919b4..845686f5770 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h @@ -58,7 +58,7 @@ public: GPG_Application(GHOST_ISystem* system); ~GPG_Application(void); - bool SetGameEngineData(struct Main* maggie, struct Scene* scene); + bool SetGameEngineData(struct Main* maggie, struct Scene* scene, int argc, char** argv); bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight, const bool stereoVisual, const int stereoMode); bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode); @@ -154,5 +154,9 @@ protected: */ char* m_pyGlobalDictString; int m_pyGlobalDictString_Length; + + /* argc and argv need to be passed on to python */ + int m_argc; + char** m_argv; }; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index d993694ab4a..97b21d13e90 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -205,7 +205,9 @@ void usage(const char* program) printf(" show_properties 0 Show debug properties\n"); printf(" show_profile 0 Show profiling information\n"); printf(" blender_material 0 Enable material settings\n"); - printf(" ignore_deprecation_warnings 0 Ignore deprecation warnings\n"); + printf(" ignore_deprecation_warnings 1 Ignore deprecation warnings\n"); + printf("\n"); + printf(" - : all arguments after this are ignored, allowing python to access them from sys.argv\n"); printf("\n"); printf("example: %s -w 320 200 10 10 -g noaudio c:\\loadtest.blend\n", program); printf("example: %s -g show_framerate = 0 c:\\loadtest.blend\n", program); @@ -292,6 +294,7 @@ static BlendFileData *load_game_data(char *progname, char *filename = NULL, char int main(int argc, char** argv) { int i; + int argc_py_clamped= argc; /* use this so python args can be added after ' - ' */ bool error = false; SYS_SystemHandle syshandle = SYS_GetSystem(); bool fullScreen = false; @@ -392,6 +395,12 @@ int main(int argc, char** argv) #endif if (argv[i][0] == '-') { + /* ignore all args after " - ", allow python to have own args */ + if (argv[i][1]=='\0') { + argc_py_clamped= i; + break; + } + switch (argv[i][1]) { case 'g': @@ -595,7 +604,7 @@ int main(int argc, char** argv) char pathname[FILE_MAXDIR + FILE_MAXFILE]; char *titlename; - get_filename(argc, argv, filename); + get_filename(argc_py_clamped, argv, filename); if(filename[0]) BLI_convertstringcwd(filename); @@ -690,7 +699,7 @@ int main(int argc, char** argv) } // GPG_Application app (system, maggie, startscenename); - app.SetGameEngineData(maggie, scene); + app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ BLI_strncpy(pathname, maggie->name, sizeof(pathname)); BLI_strncpy(G.sce, maggie->name, sizeof(G.sce)); |