diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-14 13:39:52 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-14 13:39:52 +0300 |
commit | 4bf751be7012827758b5b2ae844e370028921bd2 (patch) | |
tree | 40102707050faa5742a7e435a7f3d68804fa53a1 /source/blender/windowmanager | |
parent | a671aa922a1591128f0a1478c29af39ff6eca61f (diff) | |
parent | 66407e15cb5136bdbed45b9e0576b1e9863c3f4f (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/modifiers/intern/MOD_normal_edit.c
source/blender/windowmanager/intern/wm_files.c
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 10 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 34 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 9 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_files.h | 3 |
7 files changed, 33 insertions, 29 deletions
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index f13dac9cb4c..eaeaac45f89 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -194,7 +194,7 @@ void WM_cursor_modal_restore(wmWindow *win) void WM_cursor_wait(bool val) { if (!G.background) { - wmWindowManager *wm = G.main->wm.first; + wmWindowManager *wm = G_MAIN->wm.first; wmWindow *win = wm ? wm->windows.first : NULL; for (; win; win = win->next) { diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 00f5f6c1368..5fd7c3a24c0 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -210,7 +210,7 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference void WM_main_add_notifier(unsigned int type, void *reference) { - Main *bmain = G.main; + Main *bmain = G_MAIN; wmWindowManager *wm = bmain->wm.first; wmNotifier *note; @@ -235,7 +235,7 @@ void WM_main_add_notifier(unsigned int type, void *reference) */ void WM_main_remove_notifier_reference(const void *reference) { - Main *bmain = G.main; + Main *bmain = G_MAIN; wmWindowManager *wm = bmain->wm.first; if (wm) { @@ -263,7 +263,7 @@ void WM_main_remove_notifier_reference(const void *reference) void WM_main_remap_editor_id_reference(ID *old_id, ID *new_id) { - Main *bmain = G.main; + Main *bmain = G_MAIN; bScreen *sc; for (sc = bmain->screen.first; sc; sc = sc->id.next) { @@ -714,7 +714,7 @@ void WM_event_print(const wmEvent *event) */ void WM_report_banner_show(void) { - wmWindowManager *wm = G.main->wm.first; + wmWindowManager *wm = G_MAIN->wm.first; ReportList *wm_reports = &wm->reports; ReportTimerInfo *rti; @@ -749,7 +749,7 @@ static void wm_add_reports(ReportList *reports) { /* if the caller owns them, handle this */ if (reports->list.first && (reports->flag & RPT_OP_HOLD) == 0) { - wmWindowManager *wm = G.main->wm.first; + wmWindowManager *wm = G_MAIN->wm.first; /* add reports to the global list, otherwise they are not seen */ BLI_movelisttolist(&wm->reports.list, &reports->list); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 3aaec875627..5e58571cdbf 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -153,8 +153,8 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist) wmWindowManager *wm; wmWindow *win, *active_win; - *wmlist = G.main->wm; - BLI_listbase_clear(&G.main->wm); + *wmlist = G_MAIN->wm; + BLI_listbase_clear(&G_MAIN->wm); active_win = CTX_wm_window(C); @@ -440,12 +440,12 @@ void WM_file_autoexec_init(const char *filepath) } } -void wm_file_read_report(bContext *C) +void wm_file_read_report(bContext *C, Main *bmain) { ReportList *reports = NULL; Scene *sce; - for (sce = G.main->scene.first; sce; sce = sce->id.next) { + for (sce = bmain->scene.first; sce; sce = sce->id.next) { if (sce->r.engine[0] && BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL) { @@ -472,6 +472,7 @@ void wm_file_read_report(bContext *C) */ static void wm_file_read_post(bContext *C, const bool is_startup_file, const bool use_userdef) { + Main *bmain = CTX_data_main(C); bool addons_loaded = false; wmWindowManager *wm = CTX_wm_manager(C); @@ -483,7 +484,7 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo CTX_wm_window_set(C, wm->windows.first); ED_editors_init(C); - DEG_on_visible_update(CTX_data_main(C), true); + DEG_on_visible_update(bmain, true); #ifdef WITH_PYTHON if (is_startup_file) { @@ -513,8 +514,8 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo WM_operatortype_last_properties_clear_all(); /* important to do before NULL'ing the context */ - BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE); - BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); + BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE); + BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST); #if 1 WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL); @@ -525,7 +526,7 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo /* report any errors. * currently disabled if addons aren't yet loaded */ if (addons_loaded) { - wm_file_read_report(C); + wm_file_read_report(C, bmain); } if (!G.background) { @@ -535,7 +536,7 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo else { BKE_undosys_stack_clear(wm->undo_stack); } - BKE_undosys_stack_init_from_main(wm->undo_stack, CTX_data_main(C)); + BKE_undosys_stack_init_from_main(wm->undo_stack, bmain); BKE_undosys_stack_init_from_context(wm->undo_stack, C); } @@ -677,7 +678,7 @@ int wm_homefile_read( bool use_factory_settings, bool use_empty_data, bool use_userdef, const char *filepath_startup_override, const char *app_template_override) { - Main *bmain = G.main; /* Context does not always have valid main pointer here... */ + Main *bmain = G_MAIN; /* Context does not always have valid main pointer here... */ ListBase wmbase; bool success = false; @@ -1099,7 +1100,7 @@ bool write_crash_blend(void) BLI_strncpy(path, BKE_main_blendfile_path_from_global(), sizeof(path)); BLI_replace_extension(path, sizeof(path), "_crash.blend"); - if (BLO_write_file(G.main, path, fileflags, NULL, NULL)) { + if (BLO_write_file(G_MAIN, path, fileflags, NULL, NULL)) { printf("written: %s\n", path); return 1; } @@ -1234,7 +1235,7 @@ void wm_autosave_location(char *filepath) const char *savedir; #endif - if (G.main && G.relbase_valid) { + if (G_MAIN && G.relbase_valid) { const char *basename = BLI_path_basename(BKE_main_blendfile_path_from_global()); int len = strlen(basename) - 6; BLI_snprintf(path, sizeof(path), "%.*s.blend", len, basename); @@ -1384,7 +1385,7 @@ void wm_open_init_use_scripts(wmOperator *op, bool use_prefs) void WM_file_tag_modified(void) { - wmWindowManager *wm = G.main->wm.first; + wmWindowManager *wm = G_MAIN->wm.first; if (wm->file_saved) { wm->file_saved = 0; /* notifier that data changed, for save-over warning or header */ @@ -1401,6 +1402,7 @@ void WM_file_tag_modified(void) */ static int wm_homefile_write_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); char filepath[FILE_MAX]; @@ -1413,7 +1415,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_PRE); + BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE); /* check current window and close it if temp */ if (win && WM_window_is_temp_screen(win)) @@ -1431,7 +1433,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) /* force save as regular blend file */ fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); - if (BLO_write_file(CTX_data_main(C), filepath, fileflags | G_FILE_USERPREFS, op->reports, NULL) == 0) { + if (BLO_write_file(bmain, filepath, fileflags | G_FILE_USERPREFS, op->reports, NULL) == 0) { printf("fail\n"); return OPERATOR_CANCELLED; } @@ -1440,7 +1442,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) G.save_over = 0; - BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_POST); + BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_POST); return OPERATOR_FINISHED; } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index c5a57147dd6..ebaa51e7906 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -296,7 +296,7 @@ void WM_init(bContext *C, int argc, const char **argv) /* allow a path of "", this is what happens when making a new file */ #if 0 if (BKE_main_blendfile_path_from_global()[0] == '\0') - BLI_make_file_string("/", G.main->name, BKE_appdir_folder_default(), "untitled.blend"); + BLI_make_file_string("/", G_MAIN->name, BKE_appdir_folder_default(), "untitled.blend"); #endif BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib)); @@ -314,6 +314,7 @@ void WM_init(bContext *C, int argc, const char **argv) /* that prevents loading both the kept session, and the file on the command line */ } else { + Main *bmain = CTX_data_main(C); /* note, logic here is from wm_file_read_post, * call functions that depend on Python being initialized. */ @@ -324,10 +325,10 @@ void WM_init(bContext *C, int argc, const char **argv) * note that recovering the last session does its own callbacks. */ CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); - BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE); - BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); + BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE); + BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST); - wm_file_read_report(C); + wm_file_read_report(C, bmain); if (!G.background) { CTX_wm_window_set(C, NULL); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 67493454e8f..bbc7e6fbb69 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -828,7 +828,7 @@ wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, const Enu if (!items) { /* init modal items from default config */ - wmWindowManager *wm = G.main->wm.first; + wmWindowManager *wm = G_MAIN->wm.first; if (wm->defaultconf) { wmKeyMap *defaultkm = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index e1528551c12..38d51c2b1da 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -553,7 +553,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) char str[sizeof(((Main *)NULL)->name) + 24]; BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", wm->file_saved ? "" : "*", BKE_main_blendfile_path_from_global(), - G.main->recovered ? " (Recovered)" : ""); + G_MAIN->recovered ? " (Recovered)" : ""); GHOST_SetTitle(win->ghostwin, str); } else diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h index 4e87202ef5f..5b6022658db 100644 --- a/source/blender/windowmanager/wm_files.h +++ b/source/blender/windowmanager/wm_files.h @@ -31,6 +31,7 @@ #ifndef __WM_FILES_H__ #define __WM_FILES_H__ +struct Main; struct wmOperatorType; /* wm_files.c */ @@ -39,7 +40,7 @@ int wm_homefile_read( struct bContext *C, struct ReportList *reports, bool use_factory_settings, bool use_empty_data, bool use_userdef, const char *filepath_startup_override, const char *app_template_override); -void wm_file_read_report(bContext *C); +void wm_file_read_report(bContext *C, struct Main *bmain); void WM_OT_save_homefile(struct wmOperatorType *ot); void WM_OT_userpref_autoexec_path_add(struct wmOperatorType *ot); |