Optimize theme usage in editor log
This commit is contained in:
@ -93,6 +93,12 @@ void EditorLog::_update_theme() {
|
|||||||
collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons")));
|
collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons")));
|
||||||
show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||||
search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||||
|
|
||||||
|
theme_cache.error_color = get_theme_color(SNAME("error_color"), SNAME("Editor"));
|
||||||
|
theme_cache.error_icon = get_theme_icon(SNAME("Error"), SNAME("EditorIcons"));
|
||||||
|
theme_cache.warning_color = get_theme_color(SNAME("warning_color"), SNAME("Editor"));
|
||||||
|
theme_cache.warning_icon = get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"));
|
||||||
|
theme_cache.message_color = get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorLog::_notification(int p_what) {
|
void EditorLog::_notification(int p_what) {
|
||||||
@ -264,22 +270,22 @@ void EditorLog::_add_log_line(LogMessage &p_message, bool p_replace_previous) {
|
|||||||
case MSG_TYPE_STD_RICH: {
|
case MSG_TYPE_STD_RICH: {
|
||||||
} break;
|
} break;
|
||||||
case MSG_TYPE_ERROR: {
|
case MSG_TYPE_ERROR: {
|
||||||
log->push_color(get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
log->push_color(theme_cache.error_color);
|
||||||
Ref<Texture2D> icon = get_theme_icon(SNAME("Error"), SNAME("EditorIcons"));
|
Ref<Texture2D> icon = theme_cache.error_icon;
|
||||||
log->add_image(icon);
|
log->add_image(icon);
|
||||||
log->add_text(" ");
|
log->add_text(" ");
|
||||||
tool_button->set_icon(icon);
|
tool_button->set_icon(icon);
|
||||||
} break;
|
} break;
|
||||||
case MSG_TYPE_WARNING: {
|
case MSG_TYPE_WARNING: {
|
||||||
log->push_color(get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
log->push_color(theme_cache.warning_color);
|
||||||
Ref<Texture2D> icon = get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"));
|
Ref<Texture2D> icon = theme_cache.warning_icon;
|
||||||
log->add_image(icon);
|
log->add_image(icon);
|
||||||
log->add_text(" ");
|
log->add_text(" ");
|
||||||
tool_button->set_icon(icon);
|
tool_button->set_icon(icon);
|
||||||
} break;
|
} break;
|
||||||
case MSG_TYPE_EDITOR: {
|
case MSG_TYPE_EDITOR: {
|
||||||
// Distinguish editor messages from messages printed by the project
|
// Distinguish editor messages from messages printed by the project
|
||||||
log->push_color(get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.6));
|
log->push_color(theme_cache.message_color);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,6 +67,16 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Color error_color;
|
||||||
|
Ref<Texture2D> error_icon;
|
||||||
|
|
||||||
|
Color warning_color;
|
||||||
|
Ref<Texture2D> warning_icon;
|
||||||
|
|
||||||
|
Color message_color;
|
||||||
|
} theme_cache;
|
||||||
|
|
||||||
// Encapsulates all data and functionality regarding filters.
|
// Encapsulates all data and functionality regarding filters.
|
||||||
struct LogFilter {
|
struct LogFilter {
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user