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:
authorCampbell Barton <ideasman42@gmail.com>2015-09-22 09:45:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-09-22 09:53:07 +0300
commite29f8c600b729e42ccdf5427e79ec4d8768dd0bf (patch)
treef9519862f282012062f183a43601d21ddaaa65cc
parentb87cb9ad2c33ace0424f0b2ca8399edce0896a48 (diff)
Reporting was done before before addons were loaded
On the very first start, reporting of missing engines wasn't working.
-rw-r--r--source/blender/windowmanager/intern/wm_files.c59
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c11
-rw-r--r--source/blender/windowmanager/intern/wm_window.c2
-rw-r--r--source/blender/windowmanager/wm_files.h1
4 files changed, 47 insertions, 26 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 98ea8b903b4..d08c6c59a7f 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -404,12 +404,40 @@ void WM_file_autoexec_init(const char *filepath)
}
}
+void wm_file_read_report(bContext *C)
+{
+ ReportList *reports = NULL;
+ Scene *sce;
+
+ for (sce = G.main->scene.first; sce; sce = sce->id.next) {
+ if (sce->r.engine[0] &&
+ BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
+ {
+ if (reports == NULL) {
+ reports = CTX_wm_reports(C);
+ }
+
+ BKE_reportf(reports, RPT_ERROR,
+ "Engine '%s' not available for scene '%s' "
+ "(an addon may need to be installed or enabled)",
+ sce->r.engine, sce->id.name + 2);
+ }
+ }
+
+ if (reports) {
+ if (!G.background) {
+ WM_report_banner_show(C);
+ }
+ }
+}
+
/**
* Logic shared between #WM_file_read & #wm_homefile_read,
* updates to make after reading a file.
*/
static void wm_file_read_post(bContext *C, bool is_startup_file)
{
+ bool addons_loaded = false;
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
ED_editors_init(C);
@@ -423,11 +451,13 @@ static void wm_file_read_post(bContext *C, bool is_startup_file)
BPY_string_exec(C, "__import__('addon_utils').reset_all()");
BPY_python_reset(C);
+ addons_loaded = true;
}
}
else {
/* run any texts that were loaded in and flagged as modules */
BPY_python_reset(C);
+ addons_loaded = true;
}
#endif /* WITH_PYTHON */
@@ -439,31 +469,10 @@ static void wm_file_read_post(bContext *C, bool is_startup_file)
WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL);
- /* report any errors */
- {
- ReportList *reports = NULL;
- Scene *sce;
-
- for (sce = G.main->scene.first; sce; sce = sce->id.next) {
- if (sce->r.engine[0] &&
- BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
- {
- if (reports == NULL) {
- reports = CTX_wm_reports(C);
- }
-
- BKE_reportf(reports, RPT_ERROR,
- "Engine '%s' not available for scene '%s' "
- "(an addon may need to be installed or enabled)",
- sce->r.engine, sce->id.name + 2);
- }
- }
-
- if (reports) {
- if (!G.background) {
- WM_report_banner_show(C);
- }
- }
+ /* report any errors.
+ * currently disabled if addons aren't yet loaded */
+ if (addons_loaded) {
+ wm_file_read_report(C);
}
if (!G.background) {
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 1f5a2767dd5..ba4a807dbd7 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -261,13 +261,24 @@ 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 {
+ /* note, logic here is from wm_file_read_post,
+ * call functions that depend on Python being initialized. */
+
/* normally 'wm_homefile_read' will do this,
* however python is not initialized when called from this function.
*
* unlikely any handlers are set but its possible,
* 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);
+
+ wm_file_read_report(C);
+
+ if (!G.background) {
+ CTX_wm_window_set(C, NULL);
+ }
}
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index a03f2c22055..3120cfc4f52 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1278,7 +1278,7 @@ void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *t
wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
{
wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
-
+
wt->event_type = event_type;
wt->ltime = PIL_check_seconds_timer();
wt->ntime = wt->ltime + timestep;
diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h
index 467926aa770..4b35f662a99 100644
--- a/source/blender/windowmanager/wm_files.h
+++ b/source/blender/windowmanager/wm_files.h
@@ -38,6 +38,7 @@ int wm_homefile_read_exec(struct bContext *C, struct wmOperator *op);
int wm_homefile_read(struct bContext *C, struct ReportList *reports, bool from_memory, const char *filepath);
int wm_homefile_write_exec(struct bContext *C, struct wmOperator *op);
int wm_userpref_write_exec(struct bContext *C, struct wmOperator *op);
+void wm_file_read_report(bContext *C);
#endif /* __WM_FILES_H__ */