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:
authorCampbell Barton <ideasman42@gmail.com>2013-08-23 19:45:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-23 19:45:18 +0400
commit384b8aafbf44e42557f3869d371cae2c4106d057 (patch)
treef03578bf793da2f6fa5d0b6c1b45fe82146ef01b /source/blender
parentdd36c6b948892f1d79ab058d5ca4a0b817a3e104 (diff)
patch to add backkbacks for game engine start/end,
by sjoerd_de_vries
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/BLI_callbacks.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c6
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c2
3 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h
index 8a0442c8bc8..e1775965444 100644
--- a/source/blender/blenlib/BLI_callbacks.h
+++ b/source/blender/blenlib/BLI_callbacks.h
@@ -43,6 +43,8 @@ typedef enum {
BLI_CB_EVT_SAVE_POST,
BLI_CB_EVT_SCENE_UPDATE_PRE,
BLI_CB_EVT_SCENE_UPDATE_POST,
+ BLI_CB_EVT_GAME_PRE,
+ BLI_CB_EVT_GAME_POST,
BLI_CB_EVT_TOT
} eCbEvent;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index dfb4d1b25a2..0246e2b75a9 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -40,6 +40,7 @@
#include "BLI_rect.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_callbacks.h"
#include "BKE_anim.h"
#include "BKE_action.h"
@@ -1433,6 +1434,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
{
#ifdef WITH_GAMEENGINE
Scene *startscene = CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
ScrArea /* *sa, */ /* UNUSED */ *prevsa = CTX_wm_area(C);
ARegion *ar, *prevar = CTX_wm_region(C);
wmWindow *prevwin = CTX_wm_window(C);
@@ -1449,6 +1451,8 @@ static int game_engine_exec(bContext *C, wmOperator *op)
* the window manager until after this operator exits */
WM_redraw_windows(C);
+ BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_PRE);
+
rv3d = CTX_wm_region_view3d(C);
/* sa = CTX_wm_area(C); */ /* UNUSED */
ar = CTX_wm_region(C);
@@ -1504,6 +1508,8 @@ static int game_engine_exec(bContext *C, wmOperator *op)
BKE_scene_set_background(CTX_data_main(C), startscene);
//XXX BKE_scene_update_for_newframe(bmain, scene, scene->lay);
+ BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_POST);
+
return OPERATOR_FINISHED;
#else
(void)C; /* unused */
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index 90a0444ceae..959e4a788dd 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -57,6 +57,8 @@ static PyStructSequence_Field app_cb_info_fields[] = {
{(char *)"save_post", (char *)"Callback list - on saving a blend file (after)"},
{(char *)"scene_update_pre", (char *)"Callback list - on updating the scenes data (before)"},
{(char *)"scene_update_post", (char *)"Callback list - on updating the scenes data (after)"},
+ {(char *)"game_pre", (char *)"Callback list - on starting the game engine"},
+ {(char *)"game_post", (char *)"Callback list - on ending the game engine"},
/* sets the permanent tag */
# define APP_CB_OTHER_FIELDS 1