diff options
author | Julian Eisel <julian@blender.org> | 2020-06-05 14:09:31 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-06-05 14:09:31 +0300 |
commit | 920a58d9b6d667894cf166cbbd25e4c2fbd238ea (patch) | |
tree | 7ca5a9da640753b5e070c439ac3bdd14dfad92cf /source/blender/windowmanager/intern/wm_files.c | |
parent | c94b6209861ca7cc3985b53474feed7d94c0221a (diff) | |
parent | a1d55bdd530390e58c51abe9707b8d3b0ae3e861 (diff) |
Merge branch 'master' into wm-drag-drop-rewritewm-drag-drop-rewrite
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 346 |
1 files changed, 209 insertions, 137 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 3f4d082f9f7..ed1b29d61ce 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -141,11 +141,37 @@ static void wm_history_file_free(RecentFile *recent); static void wm_history_file_update(void); static void wm_history_file_write(void); -/* To be able to read files without windows closing, opening, moving +/* -------------------------------------------------------------------- */ +/** \name Misc Utility Functions + * \{ */ + +void WM_file_tag_modified(void) +{ + wmWindowManager *wm = G_MAIN->wm.first; + if (wm->file_saved) { + wm->file_saved = 0; + /* notifier that data changed, for save-over warning or header */ + WM_main_add_notifier(NC_WM | ND_DATACHANGED, NULL); + } +} + +bool wm_file_or_image_is_modified(const Main *bmain, const wmWindowManager *wm) +{ + return !wm->file_saved || ED_image_should_save_modified(bmain); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Window Matching for File Reading + * \{ */ + +/** + * To be able to read files without windows closing, opening, moving * we try to prepare for worst case: * - active window gets active screen from file * - restoring the screens from non-active windows - * Best case is all screens match, in that case they get assigned to proper window + * Best case is all screens match, in that case they get assigned to proper window. */ static void wm_window_match_init(bContext *C, ListBase *wmlist) { @@ -236,7 +262,7 @@ static void wm_window_match_keep_current_wm(const bContext *C, /* when loading without UI, no matching needed */ if (load_ui && (screen = CTX_wm_screen(C))) { - for (wmWindow *win = wm->windows.first; win; win = win->next) { + LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { WorkSpace *workspace; BKE_workspace_layout_find_global(bmain, screen, &workspace); @@ -294,8 +320,8 @@ static void wm_window_match_replace_by_file_wm(bContext *C, wm_window_clear_drawable(oldwm); /* only first wm in list has ghostwins */ - for (wmWindow *win = wm->windows.first; win; win = win->next) { - for (wmWindow *oldwin = oldwm->windows.first; oldwin; oldwin = oldwin->next) { + LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { + LISTBASE_FOREACH (wmWindow *, oldwin, &oldwm->windows) { if (oldwin->winid == win->winid) { has_match = true; @@ -355,6 +381,12 @@ static void wm_window_match_do(bContext *C, } } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Preferences Initialization & Versioning + * \{ */ + /* in case UserDef was read, we re-initialize all, and do versioning */ static void wm_init_userdef(Main *bmain) { @@ -375,6 +407,9 @@ static void wm_init_userdef(Main *bmain) /* update tempdir from user preferences */ BKE_tempdir_init(U.tempdir); + + /* Update tablet API preference. */ + WM_init_tablet_api(); } /* return codes */ @@ -386,6 +421,15 @@ static void wm_init_userdef(Main *bmain) # define BKE_READ_EXOTIC_OK_OTHER 1 /* other supported formats */ #endif +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Read Exotic File Formats + * + * Currently only supports '.blend' files, + * we could support registering other file formats and their loaders. + * \{ */ + /* intended to check for non-blender formats but for now it only reads blends */ static int wm_read_exotic(const char *name) { @@ -438,6 +482,12 @@ static int wm_read_exotic(const char *name) return retval; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Read Blend-File Shared Utilities + * \{ */ + void WM_file_autoexec_init(const char *filepath) { if (G.f & G_FLAG_SCRIPT_OVERRIDE_PREF) { @@ -483,6 +533,24 @@ void wm_file_read_report(bContext *C, Main *bmain) /** * Logic shared between #WM_file_read & #wm_homefile_read, + * call before loading a file. + * \note In the case of #WM_file_read the file may fail to load. + * Change here shouldn't cause user-visible changes in that case. + */ +static void wm_file_read_pre(bContext *C, bool use_data, bool UNUSED(use_userdef)) +{ + if (use_data) { + BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE); + BLI_timer_on_file_load(); + } + + /* Always do this as both startup and preferences may have loaded in many font's + * at a different zoom level to the file being loaded. */ + UI_view2d_zoom_cache_reset(); +} + +/** + * Logic shared between #WM_file_read & #wm_homefile_read, * updates to make after reading a file. */ static void wm_file_read_post(bContext *C, @@ -507,12 +575,16 @@ static void wm_file_read_post(bContext *C, if (is_startup_file) { /* possible python hasn't been initialized */ if (CTX_py_init_get(C)) { - if (reset_app_template) { + bool reset_all = use_userdef; + if (use_userdef || reset_app_template) { /* Only run when we have a template path found. */ if (BKE_appdir_app_template_any()) { BPY_execute_string( C, (const char *[]){"bl_app_template_utils", NULL}, "bl_app_template_utils.reset()"); + reset_all = true; } + } + if (reset_all) { /* sync addons, these may have changed from the defaults */ BPY_execute_string(C, (const char *[]){"addon_utils", NULL}, "addon_utils.reset_all()"); } @@ -598,24 +670,27 @@ static void wm_file_read_post(bContext *C, } } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Read Main Blend-File API + * \{ */ + bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) { /* assume automated tasks with background, don't write recent file list */ const bool do_history = (G.background == false) && (CTX_wm_manager(C)->op_undo_depth == 0); bool success = false; + const bool use_data = true; + const bool use_userdef = false; + /* so we can get the error message */ errno = 0; WM_cursor_wait(1); - BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE); - BLI_timer_on_file_load(); - - UI_view2d_zoom_cache_reset(); - - /* Reset session-wise ID UUID counter. */ - BKE_lib_libblock_session_uuid_reset(); + wm_file_read_pre(C, use_data, use_userdef); /* first try to append data from exotic file formats... */ /* it throws error box when file doesn't exist and returns -1 */ @@ -675,8 +750,6 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) } } - const bool use_data = true; - const bool use_userdef = false; wm_file_read_post(C, false, false, use_data, use_userdef, false); } #if 0 @@ -746,6 +819,12 @@ const char *WM_init_state_app_template_get(void) return wm_init_state_app_template.override ? wm_init_state_app_template.app_template : NULL; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Read Startup & Preferences Blend-File API + * \{ */ + /** * Called on startup, (context entirely filled with NULLs) * or called for 'New File' both startup.blend and userpref.blend are checked. @@ -802,6 +881,23 @@ void wm_homefile_read(bContext *C, * or use app-template startup.blend which the user hasn't saved. */ bool is_factory_startup = true; + const char *app_template = NULL; + bool update_defaults = false; + + if (filepath_startup_override != NULL) { + /* pass */ + } + else if (app_template_override) { + /* This may be clearing the current template by setting to an empty string. */ + app_template = app_template_override; + } + else if (!use_factory_settings && U.app_template[0]) { + app_template = U.app_template; + } + + const bool reset_app_template = ((!app_template && U.app_template[0]) || + (app_template && !STREQ(app_template, U.app_template))); + /* options exclude eachother */ BLI_assert((use_factory_settings && filepath_startup_override) == 0); @@ -809,18 +905,30 @@ void wm_homefile_read(bContext *C, SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC); } - if (use_data) { - BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE); - BLI_timer_on_file_load(); + if (use_userdef || reset_app_template) { +#ifdef WITH_PYTHON + /* This only runs once Blender has already started. */ + if (CTX_py_init_get(C)) { + /* This is restored by 'wm_file_read_post', disable before loading any preferences + * so an add-on can read their own preferences when un-registering, + * and use new preferences if/when re-registering, see T67577. + * + * Note that this fits into 'wm_file_read_pre' function but gets messy + * since we need to know if 'reset_app_template' is true. */ + BPY_execute_string(C, (const char *[]){"addon_utils", NULL}, "addon_utils.disable_all()"); + } +#endif /* WITH_PYTHON */ + } + wm_file_read_pre(C, use_data, use_userdef); + + if (use_data) { G.relbase_valid = 0; /* put aside screens to match with persistent windows later */ wm_window_match_init(C, &wmbase); } - UI_view2d_zoom_cache_reset(); - filepath_startup[0] = '\0'; filepath_userdef[0] = '\0'; app_template_system[0] = '\0'; @@ -861,28 +969,6 @@ void wm_homefile_read(bContext *C, } } - const char *app_template = NULL; - bool update_defaults = false; - bool reset_app_template = false; - - if (filepath_startup_override != NULL) { - /* pass */ - } - else if (app_template_override) { - /* This may be clearing the current template by setting to an empty string. */ - app_template = app_template_override; - } - else if (!use_factory_settings && U.app_template[0]) { - app_template = U.app_template; - } - - if ((!app_template && U.app_template[0]) || - (app_template && !STREQ(app_template, U.app_template))) { - /* Always load UI when switching to another template. */ - G.fileflags &= ~G_FILE_NO_UI; - reset_app_template = true; - } - if ((app_template != NULL) && (app_template[0] != '\0')) { if (!BKE_appdir_app_template_id_search( app_template, app_template_system, sizeof(app_template_system))) { @@ -923,9 +1009,6 @@ void wm_homefile_read(bContext *C, } } - /* Reset session-wise ID UUID counter. */ - BKE_lib_libblock_session_uuid_reset(); - if (!use_factory_settings || (filepath_startup[0] != '\0')) { if (BLI_access(filepath_startup, R_OK) == 0) { success = BKE_blendfile_read(C, @@ -953,20 +1036,20 @@ void wm_homefile_read(bContext *C, } } + if (use_userdef) { + if ((skip_flags & BLO_READ_SKIP_USERDEF) == 0) { + UserDef *userdef_default = BKE_blendfile_userdef_from_defaults(); + BKE_blender_userdef_data_set_and_free(userdef_default); + skip_flags |= BLO_READ_SKIP_USERDEF; + } + } + if (success == false && filepath_startup_override && reports) { /* We can not return from here because wm is already reset */ BKE_reportf(reports, RPT_ERROR, "Could not read '%s'", filepath_startup_override); } if (success == false) { - if (use_userdef) { - if ((skip_flags & BLO_READ_SKIP_USERDEF) == 0) { - UserDef *userdef_default = BKE_blendfile_userdef_from_defaults(); - BKE_blender_userdef_data_set_and_free(userdef_default); - skip_flags |= BLO_READ_SKIP_USERDEF; - } - } - success = BKE_blendfile_read_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, @@ -1031,6 +1114,11 @@ void wm_homefile_read(bContext *C, * Screws up autosaves otherwise can remove this eventually, * only in a 2.53 and older, now its not written. */ G.fileflags &= ~G_FILE_RELATIVE_REMAP; + + if (reset_app_template) { + /* Always load UI when switching to another template. */ + G.fileflags &= ~G_FILE_NO_UI; + } } bmain = CTX_data_main(C); @@ -1038,7 +1126,6 @@ void wm_homefile_read(bContext *C, if (use_userdef) { /* check userdef before open window, keymaps etc */ wm_init_userdef(bmain); - reset_app_template = true; } if (use_data) { @@ -1047,8 +1134,8 @@ void wm_homefile_read(bContext *C, } if (use_userdef) { - /* Clear keymaps because the current default keymap may have been initialized - * from user preferences, which have been reset. */ + /* Clear keymaps because the current default keymap may have been initialized + * from user preferences, which have been reset. */ for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) { if (wm->defaultconf) { wm->defaultconf->flag &= ~KEYCONF_INIT_DEFAULT; @@ -1073,7 +1160,7 @@ void wm_homefile_read(bContext *C, } /* -------------------------------------------------------------------- */ -/** \name WM History File API +/** \name Blend-File History API * \{ */ void wm_history_file_read(void) @@ -1202,7 +1289,7 @@ static void wm_history_file_update(void) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Save Main .blend File (internal) +/** \name Save Main Blend-File (internal) * \{ */ /* screen can be NULL */ @@ -1215,11 +1302,12 @@ static ImBuf *blend_file_thumb(const bContext *C, ImBuf *ibuf; BlendThumbnail *thumb; wmWindowManager *wm = CTX_wm_manager(C); + const float pixelsize_old = U.pixelsize; wmWindow *windrawable_old = wm->windrawable; char err_out[256] = "unknown"; /* screen if no camera found */ - ScrArea *sa = NULL; + ScrArea *area = NULL; ARegion *region = NULL; View3D *v3d = NULL; @@ -1235,10 +1323,10 @@ static ImBuf *blend_file_thumb(const bContext *C, } if ((scene->camera == NULL) && (screen != NULL)) { - sa = BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0); - region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + area = BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0); + region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); if (region) { - v3d = sa->spacedata.first; + v3d = area->spacedata.first; } } @@ -1249,6 +1337,10 @@ static ImBuf *blend_file_thumb(const bContext *C, /* gets scaled to BLEN_THUMB_SIZE */ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); + /* Note that with scaling, this ends up being 0.5, + * as it's a thumbnail, we don't need object centers and friends to be 1:1 size. */ + U.pixelsize = 1.0f; + if (scene->camera) { ibuf = ED_view3d_draw_offscreen_imbuf_simple(depsgraph, scene, @@ -1279,6 +1371,8 @@ static ImBuf *blend_file_thumb(const bContext *C, err_out); } + U.pixelsize = pixelsize_old; + /* Reset to old drawable. */ if (windrawable_old) { wm_window_make_drawable(wm, windrawable_old); @@ -1433,6 +1527,9 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo ibuf_thumb = IMB_thumb_create(filepath, THB_LARGE, THB_SOURCE_BLEND, ibuf_thumb); } + /* Without this there is no feedback the file was saved. */ + BKE_reportf(reports, RPT_INFO, "Saved \"%s\"", BLI_path_basename(filepath)); + /* Success. */ ok = true; } @@ -1507,7 +1604,7 @@ void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *UNUSED(wt)) WM_event_remove_timer(wm, NULL, wm->autosavetimer); /* if a modal operator is running, don't autosave, but try again in 10 seconds */ - for (wmWindow *win = wm->windows.first; win; win = win->next) { + LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) { if (handler_base->type == WM_HANDLER_TYPE_OP) { wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base; @@ -1532,7 +1629,7 @@ void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *UNUSED(wt)) } } else { - /* save as regular blend file */ + /* Save as regular blend file. */ int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); ED_editors_flush_edits(bmain); @@ -1616,18 +1713,8 @@ void wm_open_init_use_scripts(wmOperator *op, bool use_prefs) /** \} */ -void WM_file_tag_modified(void) -{ - wmWindowManager *wm = G_MAIN->wm.first; - if (wm->file_saved) { - wm->file_saved = 0; - /* notifier that data changed, for save-over warning or header */ - WM_main_add_notifier(NC_WM | ND_DATACHANGED, NULL); - } -} - /* -------------------------------------------------------------------- */ -/** \name Preferences/startup save & load. +/** \name Startup File Save Operator * \{ */ /** @@ -1665,7 +1752,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) ED_editors_flush_edits(bmain); - /* force save as regular blend file */ + /* Force save as regular blend file. */ fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); if (BLO_write_file(bmain, filepath, fileflags, op->reports, NULL) == 0) { @@ -1692,48 +1779,11 @@ void WM_OT_save_homefile(wmOperatorType *ot) ot->exec = wm_homefile_write_exec; } -static int wm_userpref_autoexec_add_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) -{ - bPathCompare *path_cmp = MEM_callocN(sizeof(bPathCompare), "bPathCompare"); - BLI_addtail(&U.autoexec_paths, path_cmp); - U.runtime.is_dirty = true; - return OPERATOR_FINISHED; -} - -void WM_OT_userpref_autoexec_path_add(wmOperatorType *ot) -{ - ot->name = "Add Autoexec Path"; - ot->idname = "WM_OT_userpref_autoexec_path_add"; - ot->description = "Add path to exclude from autoexecution"; - - ot->exec = wm_userpref_autoexec_add_exec; - - ot->flag = OPTYPE_INTERNAL; -} - -static int wm_userpref_autoexec_remove_exec(bContext *UNUSED(C), wmOperator *op) -{ - const int index = RNA_int_get(op->ptr, "index"); - bPathCompare *path_cmp = BLI_findlink(&U.autoexec_paths, index); - if (path_cmp) { - BLI_freelinkN(&U.autoexec_paths, path_cmp); - U.runtime.is_dirty = true; - } - return OPERATOR_FINISHED; -} - -void WM_OT_userpref_autoexec_path_remove(wmOperatorType *ot) -{ - ot->name = "Remove Autoexec Path"; - ot->idname = "WM_OT_userpref_autoexec_path_remove"; - ot->description = "Remove path to exclude from autoexecution"; - - ot->exec = wm_userpref_autoexec_remove_exec; - - ot->flag = OPTYPE_INTERNAL; +/** \} */ - RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000); -} +/* -------------------------------------------------------------------- */ +/** \name Write Preferences Operator + * \{ */ /* Only save the prefs block. operator entry */ static int wm_userpref_write_exec(bContext *C, wmOperator *op) @@ -1758,6 +1808,12 @@ void WM_OT_save_userpref(wmOperatorType *ot) ot->exec = wm_userpref_write_exec; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Read Preferences Operator + * \{ */ + /** * When reading preferences, there are some exceptions for values which are reset. */ @@ -1821,10 +1877,6 @@ static void wm_userpref_update_when_changed(bContext *C, rna_struct_update_when_changed(C, bmain, &ptr_a, &ptr_b); -#ifdef WITH_PYTHON - BPY_execute_string(C, (const char *[]){"addon_utils", NULL}, "addon_utils.reset_all()"); -#endif - WM_reinit_gizmomap_all(bmain); WM_keyconfig_reload(C); @@ -1890,6 +1942,12 @@ void WM_OT_read_factory_userpref(wmOperatorType *ot) ot->exec = wm_userpref_read_exec; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Read File History Operator + * \{ */ + static int wm_history_file_read_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { ED_file_read_bookmarks(); @@ -1910,6 +1968,14 @@ void WM_OT_read_history(wmOperatorType *ot) ot->flag = OPTYPE_INTERNAL; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Read Startup & Preferences Operator + * + * Both #WM_OT_read_homefile & #WM_OT_read_factory_settings. + * \{ */ + static int wm_homefile_read_exec(bContext *C, wmOperator *op) { const bool use_factory_settings = (STREQ(op->type->idname, "WM_OT_read_factory_settings")); @@ -1953,9 +2019,11 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op) RNA_property_string_get(op->ptr, prop_app_template, app_template_buf); app_template = app_template_buf; - /* Always load preferences when switching templates with own preferences. */ - use_userdef = BKE_appdir_app_template_has_userpref(app_template) || - BKE_appdir_app_template_has_userpref(U.app_template); + if (!use_factory_settings) { + /* Always load preferences when switching templates with own preferences. */ + use_userdef = BKE_appdir_app_template_has_userpref(app_template) || + BKE_appdir_app_template_has_userpref(U.app_template); + } /* Turn override off, since we're explicitly loading a different app-template. */ WM_init_state_app_template_set(NULL); @@ -2298,7 +2366,7 @@ static bool wm_open_mainfile_check(bContext *UNUSED(C), wmOperator *op) RNA_string_get(op->ptr, "filepath", path); /* get the dir */ - lslash = (char *)BLI_last_slash(path); + lslash = (char *)BLI_path_slash_rfind(path); if (lslash) { *(lslash + 1) = '\0'; } @@ -2433,7 +2501,7 @@ void WM_OT_revert_mainfile(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Recover last session & auto-save. +/** \name Recover Last Session Operator * \{ */ void WM_recover_last_session(bContext *C, ReportList *reports) @@ -2477,6 +2545,12 @@ void WM_OT_recover_last_session(wmOperatorType *ot) ot->exec = wm_recover_last_session_exec; } +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Auto-Save Main .blend File Operator + * \{ */ + static int wm_recover_auto_save_exec(bContext *C, wmOperator *op) { char filepath[FILE_MAX]; @@ -2531,12 +2605,14 @@ void WM_OT_recover_auto_save(wmOperatorType *ot) /* -------------------------------------------------------------------- */ /** \name Save Main .blend File Operator + * + * Both #WM_OT_save_as_mainfile & #WM_OT_save_mainfile. * \{ */ static void wm_filepath_default(char *filepath) { if (G.save_over == false) { - BLI_ensure_filename(filepath, FILE_MAX, "untitled.blend"); + BLI_path_filename_ensure(filepath, FILE_MAX, "untitled.blend"); } } @@ -2715,8 +2791,6 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U RNA_string_get(op->ptr, "filepath", path); ret = wm_save_as_mainfile_exec(C, op); - /* Without this there is no feedback the file was saved. */ - BKE_reportf(op->reports, RPT_INFO, "Saved \"%s\"", BLI_path_basename(path)); } else { WM_event_add_fileselect(C, op); @@ -2759,7 +2833,7 @@ void WM_OT_save_mainfile(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Auto-execution of scripts warning popup +/** \name Auto Script Execution Warning Dialog * \{ */ static void wm_block_autorun_warning_ignore(bContext *C, void *arg_block, void *UNUSED(arg)) @@ -2961,8 +3035,11 @@ void wm_test_autorun_warning(bContext *C) } } -/* Close File Dialog - *************************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Close File Dialog + * \{ */ static char save_images_when_file_is_closed = true; @@ -3228,9 +3305,4 @@ void wm_close_file_dialog(bContext *C, wmGenericCallback *post_action) } } -bool wm_file_or_image_is_modified(const Main *bmain, const wmWindowManager *wm) -{ - return !wm->file_saved || ED_image_should_save_modified(bmain); -} - /** \} */ |