diff options
Diffstat (limited to 'editor/editor_log.cpp')
-rw-r--r-- | editor/editor_log.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 8aa099ddff..a3d4296edb 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -131,7 +131,7 @@ void EditorLog::_save_state() { Ref<ConfigFile> config; config.instantiate(); // Load and amend existing config if it exists. - config->load(EditorPaths::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg")); + config->load(EditorPaths::get_singleton()->get_project_settings_dir().path_join("editor_layout.cfg")); const String section = "editor_log"; for (const KeyValue<MessageType, LogFilter *> &E : type_filter_map) { @@ -141,7 +141,7 @@ void EditorLog::_save_state() { config->set_value(section, "collapse", collapse); config->set_value(section, "show_search", search_box->is_visible()); - config->save(EditorPaths::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg")); + config->save(EditorPaths::get_singleton()->get_project_settings_dir().path_join("editor_layout.cfg")); } void EditorLog::_load_state() { @@ -149,7 +149,7 @@ void EditorLog::_load_state() { Ref<ConfigFile> config; config.instantiate(); - config->load(EditorPaths::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg")); + config->load(EditorPaths::get_singleton()->get_project_settings_dir().path_join("editor_layout.cfg")); // Run the below code even if config->load returns an error, since we want the defaults to be set even if the file does not exist yet. const String section = "editor_log"; @@ -224,6 +224,10 @@ void EditorLog::set_tool_button(Button *p_tool_button) { tool_button = p_tool_button; } +void EditorLog::register_undo_redo(UndoRedo *p_undo_redo) { + p_undo_redo->set_commit_notify_callback(_undo_redo_cbk, this); +} + void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) { EditorLog *self = static_cast<EditorLog *>(p_self); self->add_message(p_name, EditorLog::MSG_TYPE_EDITOR); @@ -248,6 +252,11 @@ void EditorLog::_rebuild_log() { } void EditorLog::_add_log_line(LogMessage &p_message, bool p_replace_previous) { + if (!is_inside_tree()) { + // The log will be built all at once when it enters the tree and has its theme items. + return; + } + // Only add the message to the log if it passes the filters. bool filter_active = type_filter_map[p_message.type]->is_active(); String search_text = search_box->get_text(); @@ -410,7 +419,7 @@ EditorLog::EditorLog() { collapse_button = memnew(Button); collapse_button->set_flat(true); collapse_button->set_focus_mode(FOCUS_NONE); - collapse_button->set_tooltip(TTR("Collapse duplicate messages into one log entry. Shows number of occurrences.")); + collapse_button->set_tooltip_text(TTR("Collapse duplicate messages into one log entry. Shows number of occurrences.")); collapse_button->set_toggle_mode(true); collapse_button->set_pressed(false); collapse_button->connect("toggled", callable_mp(this, &EditorLog::_set_collapse)); @@ -458,8 +467,6 @@ EditorLog::EditorLog() { add_error_handler(&eh); current = Thread::get_caller_id(); - - EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk, this); } void EditorLog::deinit() { |