diff options
Diffstat (limited to 'source/gameengine/BlenderRoutines')
5 files changed, 65 insertions, 65 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 6e698166fd9..22616458b54 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -108,7 +108,7 @@ static BlendFileData *load_game_data(const char *filename) { ReportList reports; BlendFileData *bfd; - + BKE_reports_init(&reports, RPT_STORE); bfd= BLO_read_from_file(filename, &reports, BLO_READ_SKIP_USERDEF); @@ -202,13 +202,13 @@ static int BL_KetsjiPyNextFrame(void *state0) { BL_KetsjiNextFrameState *state = (BL_KetsjiNextFrameState *) state0; return BL_KetsjiNextFrame( - state->ketsjiengine, - state->C, - state->win, - state->scene, + state->ketsjiengine, + state->C, + state->win, + state->scene, state->ar, - state->keyboarddevice, - state->mousedevice, + state->keyboarddevice, + state->mousedevice, state->draw_letterbox); } #endif @@ -246,7 +246,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // Acquire Python's GIL (global interpreter lock) // so we can safely run Python code and API calls PyGILState_STATE gilstate = PyGILState_Ensure(); - + PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */ #endif @@ -276,14 +276,14 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c bool restrictAnimFPS = (startscene->gm.flag & GAME_RESTRICT_ANIM_UPDATES) != 0; short drawtype = v3d->drawtype; - + /* we do not support material mode in game engine, force change to texture mode */ if (drawtype == OB_MATERIAL) drawtype = OB_TEXTURE; if (animation_record) usefixed= false; /* override since you don't want to run full-speed for sim recording */ // create the canvas and rasterizer RAS_ICanvas* canvas = new KX_BlenderCanvas(wm, win, area_rect, ar); - + // default mouse state set on render panel if (mouse_state) canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); @@ -316,11 +316,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c RAS_IRasterizer::MipmapOption mipmapval = rasterizer->GetMipmapping(); - + // create the inputdevices KX_BlenderKeyboardDevice* keyboarddevice = new KX_BlenderKeyboardDevice(); KX_BlenderMouseDevice* mousedevice = new KX_BlenderMouseDevice(); - + // create a networkdevice NG_NetworkDeviceInterface* networkdevice = new NG_LoopBackNetworkDeviceInterface(); @@ -328,10 +328,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // // create a ketsji/blendersystem (only needed for timing and stuff) KX_BlenderSystem* kxsystem = new KX_BlenderSystem(); - + // create the ketsjiengine KX_KetsjiEngine* ketsjiengine = new KX_KetsjiEngine(kxsystem); - + // set the devices ketsjiengine->SetKeyboardDevice(keyboarddevice); ketsjiengine->SetMouseDevice(mousedevice); @@ -382,7 +382,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c { exitrequested = KX_EXIT_REQUEST_NO_REQUEST; if (bfd) BLO_blendfiledata_free(bfd); - + char basedpath[FILE_MAX]; // base the actuator filename with respect // to the original file working directory @@ -396,18 +396,18 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // that happened to be loaded first BLI_path_abs(basedpath, pathname); bfd = load_game_data(basedpath); - + // if it wasn't loaded, try it forced relative if (!bfd) { // just add "//" in front of it char temppath[FILE_MAX] = "//"; BLI_strncpy(temppath + 2, basedpath, FILE_MAX - 2); - + BLI_path_abs(temppath, pathname); bfd = load_game_data(temppath); } - + // if we got a loaded blendfile, proceed if (bfd) { @@ -435,7 +435,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c { int startFrame = scene->r.cfra; ketsjiengine->SetAnimRecordMode(animation_record, startFrame); - + // Quad buffered needs a special window. if (scene->gm.stereoflag == STEREO_ENABLED) { if (scene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) @@ -446,7 +446,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c rasterizer->SetBackColor(scene->gm.framing.col); } - + if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME) { if (rv3d->persp != RV3D_CAMOB) @@ -458,7 +458,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); ketsjiengine->SetCameraOverrideLens(v3d->lens); } - + // create a scene converter, create and convert the startingscene KX_ISceneConverter* sceneconverter = new KX_BlenderSceneConverter(blenderdata, ketsjiengine); ketsjiengine->SetSceneConverter(sceneconverter); @@ -471,7 +471,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c sceneconverter->SetGLSLMaterials(true); if (scene->gm.flag & GAME_NO_MATERIAL_CACHING) sceneconverter->SetCacheMaterials(false); - + KX_Scene* startscene = new KX_Scene(keyboarddevice, mousedevice, networkdevice, @@ -509,19 +509,19 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c rasterizer, canvas); ketsjiengine->AddScene(startscene); - + // init the rasterizer rasterizer->Init(); - + // start the engine ketsjiengine->StartEngine(true); - + // Set the animation playback rate for ipo's and actions // the framerate below should patch with FPS macro defined in blendef.h // Could be in StartEngine set the framerate, we need the scene to do this ketsjiengine->SetAnimFrameRate(FPS); - + #ifdef WITH_PYTHON char *python_main = NULL; pynextframestate.state = NULL; @@ -545,7 +545,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjinextframestate.keyboarddevice = keyboarddevice; ketsjinextframestate.mousedevice = mousedevice; ketsjinextframestate.draw_letterbox = draw_letterbox; - + pynextframestate.state = &ketsjinextframestate; pynextframestate.func = &BL_KetsjiPyNextFrame; printf("Yielding control to Python script '%s'...\n", python_main); @@ -577,9 +577,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // inside the GameLogic dictionary when the python interpreter is finalized. // which allows the scene to safely delete them :) // see: (space.c)->start_game - + //PyDict_Clear(PyModule_GetDict(gameLogic)); - + // Keep original items, means python plugins will autocomplete members PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic)); const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new); @@ -624,7 +624,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // set mipmap setting back to its original value rasterizer->SetMipmapping(mipmapval); } - + // clean up some stuff if (ketsjiengine) { @@ -665,9 +665,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // stop all remaining playing sounds AUD_Device_stopAll(BKE_sound_get_device()); - + } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); - + if (bfd) BLO_blendfiledata_free(bfd); BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name)); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index a6b2340d7b4..fdfa64cbd91 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -293,7 +293,7 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y) int winX = m_frame_rect.GetLeft(); int winY = m_frame_rect.GetBottom(); int winH = m_frame_rect.GetHeight(); - + WM_cursor_warp(m_win, winX + x, winY + (winH-y)); } diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h index 6f408f86551..8029360273b 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h @@ -48,7 +48,7 @@ struct wmWindow; struct wmWindowManager; /** - * 2D Blender device context abstraction. + * 2D Blender device context abstraction. * The connection from 3d rendercontext to 2d Blender surface embedding. */ @@ -63,17 +63,17 @@ private: public: /* Construct a new canvas. - * + * * \param area The Blender ARegion to run the game within. */ KX_BlenderCanvas(struct wmWindowManager *wm, struct wmWindow* win, RAS_Rect &rect, struct ARegion* ar); ~KX_BlenderCanvas(); - void + void Init( ); - - void + + void SwapBuffers( ); @@ -89,7 +89,7 @@ public: void GetDisplayDimensions(int &width, int &height); - void + void ResizeWindow( int width, int height @@ -107,11 +107,11 @@ public: BeginFrame( ); - void + void EndFrame( ); - void + void ClearColor( float r, float g, @@ -119,16 +119,16 @@ public: float a ); - void + void ClearBuffer( int type ); - int + int GetWidth( ) const; - int + int GetHeight( ) const; @@ -180,27 +180,27 @@ public: const int* GetViewPort(); - void + void SetMouseState( RAS_MouseState mousestate ); - void + void SetMousePosition( int x, int y ); - void + void MakeScreenShot( const char* filename ); - - bool + + bool BeginDraw( ); - void + void EndDraw( ); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp index ea78d2d389e..073f91bf8c4 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp @@ -33,7 +33,7 @@ #ifdef _MSC_VER /* annoying warnings about truncated STL debug info */ # pragma warning (disable:4786) -#endif +#endif #include "KX_BlenderKeyboardDevice.h" #include "KX_KetsjiEngine.h" @@ -55,7 +55,7 @@ KX_BlenderKeyboardDevice::~KX_BlenderKeyboardDevice() bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) { const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || + bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || inevent.m_status == SCA_InputEvent::KX_ACTIVE); return pressed; } @@ -72,7 +72,7 @@ bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputco void KX_BlenderKeyboardDevice::NextFrame() { SCA_IInputDevice::NextFrame(); - + // now convert justpressed keyevents into regular (active) keyevents int previousTable = 1-m_currentTable; for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++) @@ -94,7 +94,7 @@ void KX_BlenderKeyboardDevice::NextFrame() bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode) { bool result = false; - + // convert event KX_EnumInputs kxevent = this->ToNative(incode); @@ -122,7 +122,7 @@ bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short break; } case SCA_InputEvent::KX_ACTIVE: - + { m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; break; @@ -137,7 +137,7 @@ bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; } } - + } else if (val == KM_RELEASE) { // blender eventval == 0 diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp index 9df06e83b92..fee184e1902 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp @@ -32,7 +32,7 @@ #ifdef _MSC_VER /* annoying warnings about truncated STL debug info */ # pragma warning (disable:4786) -#endif +#endif #include "KX_BlenderMouseDevice.h" @@ -52,7 +52,7 @@ KX_BlenderMouseDevice::~KX_BlenderMouseDevice() bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) { const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || + bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || inevent.m_status == SCA_InputEvent::KX_ACTIVE); return pressed; } @@ -70,7 +70,7 @@ bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) void KX_BlenderMouseDevice::NextFrame() { SCA_IInputDevice::NextFrame(); - + // now convert justpressed keyevents into regular (active) keyevents int previousTable = 1-m_currentTable; for (int mouseevent= KX_BEGINMOUSE; mouseevent< KX_ENDMOUSEBUTTONS;mouseevent++) @@ -90,13 +90,13 @@ void KX_BlenderMouseDevice::NextFrame() if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) { - + m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_JUSTRELEASED; } else { if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) { - + m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; } } @@ -111,7 +111,7 @@ void KX_BlenderMouseDevice::NextFrame() bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode) { bool result = false; - + // convert event KX_EnumInputs kxevent = this->ToNative(incode); int previousTable = 1-m_currentTable; @@ -125,7 +125,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val switch (m_eventStatusTables[previousTable][kxevent].m_status) { - + case SCA_InputEvent::KX_ACTIVE: case SCA_InputEvent::KX_JUSTACTIVATED: { @@ -142,7 +142,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; } } - + } else if (val == KM_RELEASE) { // blender eventval == 0 @@ -168,7 +168,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val switch (m_eventStatusTables[previousTable][kxevent].m_status) { - + case SCA_InputEvent::KX_ACTIVE: case SCA_InputEvent::KX_JUSTACTIVATED: { |