Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions editor/editor_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include "scene/gui/separator.h"
#include "scene/resources/font.h"

#define MAX_MESSAGES_BEFORE_COLLAPSE 10

void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type) {
EditorLog *self = static_cast<EditorLog *>(p_self);

Expand Down Expand Up @@ -230,6 +232,14 @@ void EditorLog::_process_message(const String &p_msg, MessageType p_type, bool p
LogMessage &previous = messages.write[messages.size() - 1];
previous.count++;

if (!collapse && previous.count == MAX_MESSAGES_BEFORE_COLLAPSE) {
if (!Thread::is_main_thread()) {
MessageQueue::get_main_singleton()->push_callable(callable_mp(this, &EditorLog::_set_collapse), true);
} else {
_set_collapse(true);
}
}

_add_log_line(previous, collapse);
} else {
// Different message to the previous one received.
Expand Down