[Bf-blender-cvs] [e812fb4] asset-engine: Add some header info about asset errors or reload needs.
Bastien Montagne
noreply at git.blender.org
Tue Apr 26 16:42:17 CEST 2016
Commit: e812fb482554fec758116d627eb61d518c0b995a
Author: Bastien Montagne
Date: Tue Apr 26 16:40:46 2016 +0200
Branches: asset-engine
https://developer.blender.org/rBe812fb482554fec758116d627eb61d518c0b995a
Add some header info about asset errors or reload needs.
Again, rather rough UI but enough to be useful for now.
===================================================================
M release/scripts/startup/bl_ui/space_info.py
M source/blender/blenkernel/BKE_global.h
M source/blender/editors/space_script/script_edit.c
M source/blender/editors/space_script/script_intern.h
M source/blender/editors/space_script/script_ops.c
M source/blender/python/intern/bpy_app.c
M source/blender/windowmanager/intern/wm_files_link.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 1988457..ae68281 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -68,6 +68,16 @@ class INFO_HT_header(Header):
row.label(bpy.app.autoexec_fail_message)
return
+ if (bpy.app.assets_fail or bpy.app.assets_need_reload) and not bpy.app.assets_quiet:
+ row.operator("script.assets_warn_clear", text="Ignore")
+ if bpy.app.assets_need_reload is True and bpy.app.assets_quiet is False:
+ row.label("Some assets have to be reloaded", icon='INFO')
+ row.label(icon='SCREEN_BACK', text="Reload Assets")
+ #~ row.operator("wm.reload_assets", icon='SCREEN_BACK', text="Reload Assets")
+ if bpy.app.assets_fail is True and bpy.app.assets_quiet is False:
+ row.label("Some asset engine(s) failed to retrieve updated data about their assets...", icon='ERROR')
+ return
+
row.operator("wm.splash", text="", icon='BLENDER', emboss=False)
row.label(text=scene.statistics(), translate=False)
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 26a4059..1fd8346 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -104,6 +104,10 @@ typedef struct Global {
/* #define G_FACESELECT (1 << 8) use (mesh->editflag & ME_EDIT_PAINT_FACE_SEL) */
+#define G_ASSETS_NEED_RELOAD (1 << 10)
+#define G_ASSETS_FAIL (1 << 11)
+#define G_ASSETS_QUIET (1 << 12)
+
#define G_SCRIPT_AUTOEXEC (1 << 13)
#define G_SCRIPT_OVERRIDE_PREF (1 << 14) /* when this flag is set ignore the userprefs */
#define G_SCRIPT_AUTOEXEC_FAIL (1 << 15)
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 6bfb51d..ce169a8 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -165,3 +165,23 @@ void SCRIPT_OT_autoexec_warn_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec = script_autoexec_warn_clear_exec;
}
+
+static int script_assets_warn_clear_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
+{
+ G.f |= G_ASSETS_QUIET;
+ return OPERATOR_FINISHED;
+}
+
+void SCRIPT_OT_assets_warn_clear(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Silence Assets Warnings";
+ ot->description = "Ignore assets warning and errors";
+ ot->idname = "SCRIPT_OT_assets_warn_clear";
+
+ /* flags */
+ ot->flag = OPTYPE_INTERNAL;
+
+ /* api callbacks */
+ ot->exec = script_assets_warn_clear_exec;
+}
diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h
index cef6082..e1e34db 100644
--- a/source/blender/editors/space_script/script_intern.h
+++ b/source/blender/editors/space_script/script_intern.h
@@ -41,6 +41,7 @@ void script_keymap(struct wmKeyConfig *keyconf);
void SCRIPT_OT_reload(struct wmOperatorType *ot);
void SCRIPT_OT_python_file_run(struct wmOperatorType *ot);
void SCRIPT_OT_autoexec_warn_clear(struct wmOperatorType *ot);
+void SCRIPT_OT_assets_warn_clear(struct wmOperatorType *ot);
#endif /* __SCRIPT_INTERN_H__ */
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c
index 41c0759..4da3488 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -45,6 +45,7 @@ void script_operatortypes(void)
WM_operatortype_append(SCRIPT_OT_python_file_run);
WM_operatortype_append(SCRIPT_OT_reload);
WM_operatortype_append(SCRIPT_OT_autoexec_warn_clear);
+ WM_operatortype_append(SCRIPT_OT_assets_warn_clear);
}
void script_keymap(wmKeyConfig *UNUSED(keyconf))
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 17617a2..9f83bc9 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -350,7 +350,14 @@ static PyGetSetDef bpy_app_getsets[] = {
{(char *)"autoexec_fail", bpy_app_global_flag_get, NULL, NULL, (void *)G_SCRIPT_AUTOEXEC_FAIL},
{(char *)"autoexec_fail_quiet", bpy_app_global_flag_get, NULL, NULL, (void *)G_SCRIPT_AUTOEXEC_FAIL_QUIET},
{(char *)"autoexec_fail_message", bpy_app_autoexec_fail_message_get, NULL, NULL, NULL},
- {NULL, NULL, NULL, NULL, NULL}
+
+ /* Assets */
+ {(char *)"assets_need_reload", bpy_app_global_flag_get, NULL, NULL, (void *)G_ASSETS_NEED_RELOAD},
+ {(char *)"assets_fail", bpy_app_global_flag_get, NULL, NULL, (void *)G_ASSETS_FAIL},
+ {(char *)"assets_quiet", bpy_app_global_flag_get, NULL, NULL, (void *)G_ASSETS_QUIET},
+// {(char *)"assets_fail_message", bpy_app_autoexec_fail_message_get, NULL, NULL, NULL},
+
+ {NULL, NULL, NULL, NULL, NULL}
};
static void py_struct_seq_getset_init(void)
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index cdc3e7a..86f63e1 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -628,12 +628,15 @@ static void asset_updatecheck_update(void *aucjv)
*id->uuid = *uuid;
if (id->uuid->tag & UUID_TAG_ENGINE_MISSING) {
+ G.f |= G_ASSETS_FAIL;
printf("\t%s uses a currently unknown asset engine!\n", id->name);
}
else if (id->uuid->tag & UUID_TAG_ASSET_MISSING) {
+ G.f |= G_ASSETS_FAIL;
printf("\t%s is currently unknown by asset engine!\n", id->name);
}
else if (id->uuid->tag & UUID_TAG_ASSET_RELOAD) {
+ G.f |= G_ASSETS_NEED_RELOAD;
printf("\t%s needs to be reloaded/updated!\n", id->name);
}
done = true;
@@ -744,6 +747,7 @@ static void asset_updatecheck_start(const bContext *C)
if (ae_type == NULL) {
if (id->uuid) {
id->uuid->tag = UUID_TAG_ENGINE_MISSING;
+ G.f |= G_ASSETS_FAIL;
}
continue;
}
@@ -769,6 +773,7 @@ static void asset_updatecheck_start(const bContext *C)
}
}
}
+ G.f &= ~(G_ASSETS_FAIL | G_ASSETS_NEED_RELOAD | G_ASSETS_QUIET);
/* setup job */
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), CTX_wm_area(C), "Checking for asset updates...",
More information about the Bf-blender-cvs
mailing list