Fix #145919: Enable BKE_reports to be seen when file is loaded from CLI
There were two issues conspiring to prevent most BKE_reports from surfacing when loading a file from the command line. The first is that the "print_level" was left initialized to only RPT_ERROR which prevents this particular warning from being traced to the console. The second is that, in order for us to display reports in the notification area, we need to give the reports to the window manager. This is typically all wired up during normal operator execution, but not when just starting up from the command line. Pull Request: https://projects.blender.org/blender/blender/pulls/147251
This commit is contained in:
committed by
Jesse Yurkovich
parent
a09d0cfd8c
commit
8a99ab4463
@@ -2713,12 +2713,16 @@ static bool handle_load_file(bContext *C, const char *filepath_arg, const bool l
|
||||
|
||||
/* Load the file. */
|
||||
ReportList reports;
|
||||
BKE_reports_init(&reports, RPT_PRINT);
|
||||
BKE_reports_init(&reports, RPT_PRINT | RPT_STORE);
|
||||
BKE_report_print_level_set(&reports, RPT_WARNING);
|
||||
/* When activating from the command line there isn't an exact equivalent to operator properties.
|
||||
* Instead, enabling auto-execution via `--enable-autoexec` causes the auto-execution
|
||||
* check to be skipped (if it's set), so it's fine to always enable the check here. */
|
||||
const bool use_scripts_autoexec_check = true;
|
||||
const bool success = WM_file_read(C, filepath, use_scripts_autoexec_check, &reports);
|
||||
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
WM_reports_from_reports_move(wm, &reports);
|
||||
BKE_reports_free(&reports);
|
||||
|
||||
if (success) {
|
||||
|
||||
Reference in New Issue
Block a user