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:
authorBastien Montagne <montagne29@wanadoo.fr>2018-06-06 16:50:24 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-06 16:50:24 +0300
commit48e871ab1d57ef2e95047b2be5718cee5d3cefe6 (patch)
tree65088effec7dac68ea72fe2ae60e32df544d99a6 /source/blender/windowmanager/intern
parentbfbd85e9d66be3793e51ef989f793bdd69214493 (diff)
Cleanup: Nuke moar G.main usages...
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r--source/blender/windowmanager/intern/wm.c3
-rw-r--r--source/blender/windowmanager/intern/wm_files.c25
-rw-r--r--source/blender/windowmanager/intern/wm_window.c6
3 files changed, 20 insertions, 14 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 3fd2aed91f0..a425eadfe21 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -381,6 +381,7 @@ void WM_keymap_init(bContext *C)
void WM_check(bContext *C)
{
+ Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);
/* wm context */
@@ -407,7 +408,7 @@ void WM_check(bContext *C)
/* case: fileread */
/* note: this runs in bg mode to set the screen context cb */
if ((wm->initialized & WM_INIT_WINDOW) == 0) {
- ED_screens_initialize(wm);
+ ED_screens_initialize(bmain, wm);
wm->initialized |= WM_INIT_WINDOW;
}
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index ffc6a566ced..f1cc4539470 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -226,14 +226,14 @@ static void wm_window_substitute_old(wmWindowManager *wm, wmWindow *oldwin, wmWi
* 4- current wm, and wm in file: try match ghostwin
*/
-static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
+static void wm_window_match_do(Main *bmain, bContext *C, ListBase *oldwmlist)
{
wmWindowManager *oldwm, *wm;
wmWindow *oldwin, *win;
/* cases 1 and 2 */
if (BLI_listbase_is_empty(oldwmlist)) {
- if (G.main->wm.first) {
+ if (bmain->wm.first) {
/* nothing todo */
}
else {
@@ -244,7 +244,7 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* cases 3 and 4 */
/* we've read file without wm..., keep current one entirely alive */
- if (BLI_listbase_is_empty(&G.main->wm)) {
+ if (BLI_listbase_is_empty(&bmain->wm)) {
bScreen *screen = NULL;
/* when loading without UI, no matching needed */
@@ -258,7 +258,7 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
if (screen->winid == 0)
win->screen = screen;
else
- win->screen = ED_screen_duplicate(win, screen);
+ win->screen = ED_screen_duplicate(bmain, win, screen);
BLI_strncpy(win->screenname, win->screen->id.name + 2, sizeof(win->screenname));
win->screen->winid = win->winid;
@@ -266,10 +266,10 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
}
}
- G.main->wm = *oldwmlist;
+ bmain->wm = *oldwmlist;
/* screens were read from file! */
- ED_screens_initialize(G.main->wm.first);
+ ED_screens_initialize(bmain, bmain->wm.first);
}
else {
bool has_match = false;
@@ -277,7 +277,7 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* what if old was 3, and loaded 1? */
/* this code could move to setup_appdata */
oldwm = oldwmlist->first;
- wm = G.main->wm.first;
+ wm = bmain->wm.first;
/* preserve key configurations in new wm, to preserve their keymaps */
wm->keyconfigs = oldwm->keyconfigs;
@@ -559,7 +559,6 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* we didn't succeed, now try to read Blender file */
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
- Main *bmain = CTX_data_main(C);
int G_f = G.f;
ListBase wmbase;
@@ -570,6 +569,10 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* confusing this global... */
G.relbase_valid = 1;
retval = BKE_blendfile_read(C, filepath, reports, 0);
+
+ /* BKE_file_read sets new Main into context. */
+ Main *bmain = CTX_data_main(C);
+
/* when loading startup.blend's, we can be left with a blank path */
if (BKE_main_blendfile_path(bmain)) {
G.save_over = 1;
@@ -587,12 +590,12 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
}
/* match the read WM with current WM */
- wm_window_match_do(C, &wmbase);
+ wm_window_match_do(bmain, C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */
if (retval == BKE_BLENDFILE_READ_OK_USERPREFS) {
/* in case a userdef is read from regular .blend */
- wm_init_userdef(G.main, false);
+ wm_init_userdef(bmain, false);
}
if (retval != BKE_BLENDFILE_READ_FAIL) {
@@ -856,7 +859,7 @@ int wm_homefile_read(
}
/* match the read WM with current WM */
- wm_window_match_do(C, &wmbase);
+ wm_window_match_do(bmain, C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */
bmain->name[0] = '\0';
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index c7805184819..b28f845caf5 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -249,6 +249,7 @@ wmWindow *wm_window_new(bContext *C)
/* part of wm_window.c api */
wmWindow *wm_window_copy(bContext *C, wmWindow *win_src)
{
+ Main *bmain = CTX_data_main(C);
wmWindow *win_dst = wm_window_new(C);
win_dst->posx = win_src->posx + 10;
@@ -257,7 +258,7 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *win_src)
win_dst->sizey = win_src->sizey;
/* duplicate assigns to window */
- win_dst->screen = ED_screen_duplicate(win_dst, win_src->screen);
+ win_dst->screen = ED_screen_duplicate(bmain, win_dst, win_src->screen);
BLI_strncpy(win_dst->screenname, win_dst->screen->id.name + 2, sizeof(win_dst->screenname));
win_dst->screen->winid = win_dst->winid;
@@ -793,6 +794,7 @@ wmWindow *WM_window_open(bContext *C, const rcti *rect)
*/
wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, int type)
{
+ Main *bmain = CTX_data_main(C);
wmWindow *win_prev = CTX_wm_window(C);
wmWindow *win;
ScrArea *sa;
@@ -839,7 +841,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
if (win->screen == NULL) {
/* add new screen */
- win->screen = ED_screen_add(win, scene, "temp");
+ win->screen = ED_screen_add(bmain, win, scene, "temp");
}
else {
/* switch scene for rendering */