patch to add backkbacks for game engine start/end,
by sjoerd_de_vries
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user