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:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c79
1 files changed, 50 insertions, 29 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 8546290d281..f96a8c3d7fd 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -52,8 +52,8 @@
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_utildefines.h"
+#include "BLI_timer.h"
#include "BLI_threads.h"
-#include "BLI_callbacks.h"
#include "BLI_system.h"
#include BLI_SYSTEM_PID_H
@@ -73,7 +73,7 @@
#include "BKE_autoexec.h"
#include "BKE_blender.h"
#include "BKE_blendfile.h"
-#include "BKE_blender_undo.h"
+#include "BKE_callbacks.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
@@ -101,6 +101,7 @@
#include "ED_datafiles.h"
#include "ED_fileselect.h"
#include "ED_image.h"
+#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "ED_util.h"
@@ -113,8 +114,6 @@
#include "UI_resources.h"
#include "UI_view2d.h"
-#include "GPU_draw.h"
-
/* only to report a missing engine */
#include "RE_engine.h"
@@ -535,16 +534,16 @@ static void wm_file_read_post(bContext *C,
if (use_userdef) {
if (is_factory_startup) {
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_FACTORY_USERDEF_POST);
+ BKE_callback_exec_null(bmain, BKE_CB_EVT_LOAD_FACTORY_USERDEF_POST);
}
}
if (use_data) {
/* important to do before NULL'ing the context */
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE);
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST);
+ BKE_callback_exec_null(bmain, BKE_CB_EVT_VERSION_UPDATE);
+ BKE_callback_exec_null(bmain, BKE_CB_EVT_LOAD_POST);
if (is_factory_startup) {
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST);
+ BKE_callback_exec_null(bmain, BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST);
}
}
@@ -607,7 +606,8 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
WM_cursor_wait(1);
- BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
+ BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE);
+ BLI_timer_on_file_load();
UI_view2d_zoom_cache_reset();
@@ -804,7 +804,8 @@ void wm_homefile_read(bContext *C,
}
if (use_data) {
- BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
+ BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE);
+ BLI_timer_on_file_load();
G.relbase_valid = 0;
@@ -1204,6 +1205,8 @@ static ImBuf *blend_file_thumb(const bContext *C,
/* will be scaled down, but gives some nice oversampling */
ImBuf *ibuf;
BlendThumbnail *thumb;
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *windrawable_old = wm->windrawable;
char err_out[256] = "unknown";
/* screen if no camera found */
@@ -1269,6 +1272,14 @@ static ImBuf *blend_file_thumb(const bContext *C,
err_out);
}
+ /* Reset to old drawable. */
+ if (windrawable_old) {
+ wm_window_make_drawable(wm, windrawable_old);
+ }
+ else {
+ wm_window_clear_drawable(wm);
+ }
+
if (ibuf) {
float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp);
@@ -1354,7 +1365,7 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo
/* Call pre-save callbacks before writing preview,
* that way you can generate custom file thumbnail. */
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE);
+ BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_PRE);
/* Enforce full override check/generation on file save. */
BKE_main_override_library_operations_create(bmain, true);
@@ -1407,7 +1418,7 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo
wm_history_file_update();
}
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_POST);
+ BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_POST);
/* run this function after because the file cant be written before the blend is */
if (ibuf_thumb) {
@@ -1632,7 +1643,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE);
+ BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_PRE);
/* check current window and close it if temp */
if (win && WM_window_is_temp_screen(win)) {
@@ -1660,7 +1671,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op)
G.save_over = 0;
- BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_POST);
+ BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_POST);
return OPERATOR_FINISHED;
}
@@ -1753,7 +1764,7 @@ static void wm_userpref_read_exceptions(UserDef *userdef_curr, const UserDef *us
((void)0)
/* Current visible preferences category. */
- USERDEF_RESTORE(userpref);
+ USERDEF_RESTORE(space_data.section_active);
#undef USERDEF_RESTORE
}
@@ -1971,6 +1982,10 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op)
}
}
+ if (G.fileflags & G_FILE_NO_UI) {
+ ED_outliner_select_sync_from_all_tag(C);
+ }
+
return OPERATOR_FINISHED;
}
@@ -2226,6 +2241,10 @@ static int wm_open_mainfile__open(bContext *C, wmOperator *op)
BKE_report_print_level_set(op->reports, RPT_WARNING);
if (success) {
+ if (G.fileflags & G_FILE_NO_UI) {
+ ED_outliner_select_sync_from_all_tag(C);
+ }
+ ED_view3d_local_collections_reset(C, (G.fileflags & G_FILE_NO_UI) != 0);
return OPERATOR_FINISHED;
}
else {
@@ -2314,7 +2333,7 @@ static void wm_open_mainfile_ui(bContext *UNUSED(C), wmOperator *op)
void WM_OT_open_mainfile(wmOperatorType *ot)
{
- ot->name = "Open Blender File";
+ ot->name = "Open";
ot->idname = "WM_OT_open_mainfile";
ot->description = "Open a Blender file";
@@ -2390,7 +2409,10 @@ void WM_OT_revert_mainfile(wmOperatorType *ot)
ot->name = "Revert";
ot->idname = "WM_OT_revert_mainfile";
ot->description = "Reload the saved file";
+
ot->invoke = WM_operator_confirm;
+ ot->exec = wm_revert_mainfile_exec;
+ ot->poll = wm_revert_mainfile_poll;
RNA_def_boolean(ot->srna,
"use_scripts",
@@ -2398,9 +2420,6 @@ void WM_OT_revert_mainfile(wmOperatorType *ot)
"Trusted Source",
"Allow .blend file to execute scripts automatically, default available from "
"system preferences");
-
- ot->exec = wm_revert_mainfile_exec;
- ot->poll = wm_revert_mainfile_poll;
}
/** \} */
@@ -2445,8 +2464,8 @@ void WM_OT_recover_last_session(wmOperatorType *ot)
ot->name = "Recover Last Session";
ot->idname = "WM_OT_recover_last_session";
ot->description = "Open the last closed file (\"" BLENDER_QUIT_FILE "\")";
- ot->invoke = WM_operator_confirm;
+ ot->invoke = WM_operator_confirm;
ot->exec = wm_recover_last_session_exec;
}
@@ -2488,15 +2507,15 @@ void WM_OT_recover_auto_save(wmOperatorType *ot)
ot->idname = "WM_OT_recover_auto_save";
ot->description = "Open an automatically saved file to recover it";
- ot->exec = wm_recover_auto_save_exec;
ot->invoke = wm_recover_auto_save_invoke;
+ ot->exec = wm_recover_auto_save_exec;
WM_operator_properties_filesel(ot,
FILE_TYPE_BLENDER,
FILE_BLENDER,
FILE_OPENFILE,
WM_FILESEL_FILEPATH,
- FILE_LONGDISPLAY,
+ FILE_VERTICALDISPLAY,
FILE_SORT_TIME);
}
@@ -2630,7 +2649,7 @@ void WM_OT_save_as_mainfile(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name = "Save As Blender File";
+ ot->name = "Save As";
ot->idname = "WM_OT_save_as_mainfile";
ot->description = "Save the current file in the desired location";
@@ -3038,7 +3057,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi
BLI_path_extension_replace(filename, sizeof(filename), "");
}
else {
- BLI_snprintf(filename, sizeof(filename), IFACE_("Untitled"));
+ STRNCPY(filename, IFACE_("Untitled"));
}
/* Title */
@@ -3074,6 +3093,12 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi
BKE_reports_init(&reports, RPT_STORE);
uint modified_images_count = ED_image_save_all_modified_info(C, &reports);
+ LISTBASE_FOREACH (Report *, report, &reports.list) {
+ uiLayout *row = uiLayoutRow(layout, false);
+ uiLayoutSetRedAlert(row, true);
+ uiItemL(row, report->message, ICON_CANCEL);
+ }
+
if (modified_images_count > 0) {
char message[64];
BLI_snprintf(message,
@@ -3099,13 +3124,9 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi
"");
}
- LISTBASE_FOREACH (Report *, report, &reports.list) {
- uiItemL(layout, report->message, ICON_ERROR);
- }
-
BKE_reports_clear(&reports);
- uiItemL(layout, "", ICON_NONE);
+ uiItemS_ex(layout, 3.0f);
/* Buttons */
#ifdef _WIN32