Show error icon at "Output" in case of errors

(cherry picked from commit 5120690013)
This commit is contained in:
Bernhard Liebl 2018-03-11 14:20:32 +01:00 committed by Hein-Pieter van Braam
parent dfe6d42a01
commit 4ce6a8f5f9
3 changed files with 10 additions and 4 deletions

View File

@ -88,6 +88,7 @@ void EditorLog::_notification(int p_what) {
void EditorLog::_clear_request() { void EditorLog::_clear_request() {
log->clear(); log->clear();
tool_button->set_icon(Ref<Texture>());
} }
void EditorLog::clear() { void EditorLog::clear() {
@ -103,9 +104,7 @@ void EditorLog::add_message(const String &p_msg, bool p_error) {
Ref<Texture> icon = get_icon("Error", "EditorIcons"); Ref<Texture> icon = get_icon("Error", "EditorIcons");
log->add_image(icon); log->add_image(icon);
log->add_text(" "); log->add_text(" ");
//button->set_icon(icon); tool_button->set_icon(icon);
} else {
//button->set_icon(Ref<Texture>());
} }
log->add_text(p_msg); log->add_text(p_msg);
@ -115,6 +114,10 @@ void EditorLog::add_message(const String &p_msg, bool p_error) {
log->pop(); log->pop();
} }
void EditorLog::set_tool_button(ToolButton *p_tool_button) {
tool_button = p_tool_button;
}
/* /*
void EditorLog::_dragged(const Point2& p_ofs) { void EditorLog::_dragged(const Point2& p_ofs) {

View File

@ -51,6 +51,7 @@ class EditorLog : public VBoxContainer {
RichTextLabel *log; RichTextLabel *log;
HBoxContainer *title_hb; HBoxContainer *title_hb;
//PaneDrag *pd; //PaneDrag *pd;
ToolButton *tool_button;
static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type); static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type);
@ -68,6 +69,7 @@ protected:
public: public:
void add_message(const String &p_msg, bool p_error = false); void add_message(const String &p_msg, bool p_error = false);
void set_tool_button(ToolButton *p_tool_button);
void deinit(); void deinit();
void clear(); void clear();

View File

@ -5577,7 +5577,8 @@ EditorNode::EditorNode() {
bottom_panel_vb->add_child(bottom_panel_hb); bottom_panel_vb->add_child(bottom_panel_hb);
log = memnew(EditorLog); log = memnew(EditorLog);
add_bottom_panel_item(TTR("Output"), log); ToolButton *output_button = add_bottom_panel_item(TTR("Output"), log);
log->set_tool_button(output_button);
old_split_ofs = 0; old_split_ofs = 0;