mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Save scene and global checkbox options of History window, fixes #88432
This commit is contained in:
parent
7d2ca2d8ac
commit
0f26ae93f2
@ -31,6 +31,7 @@
|
|||||||
#include "history_dock.h"
|
#include "history_dock.h"
|
||||||
|
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
|
#include "editor/editor_settings.h"
|
||||||
#include "editor/editor_string_names.h"
|
#include "editor/editor_string_names.h"
|
||||||
#include "editor/editor_undo_redo_manager.h"
|
#include "editor/editor_undo_redo_manager.h"
|
||||||
#include "scene/gui/check_box.h"
|
#include "scene/gui/check_box.h"
|
||||||
@ -219,6 +220,11 @@ void HistoryDock::_notification(int p_notification) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryDock::save_options() {
|
||||||
|
EditorSettings::get_singleton()->set_project_metadata("history", "include_scene", current_scene_checkbox->is_pressed());
|
||||||
|
EditorSettings::get_singleton()->set_project_metadata("history", "include_global", global_history_checkbox->is_pressed());
|
||||||
|
}
|
||||||
|
|
||||||
HistoryDock::HistoryDock() {
|
HistoryDock::HistoryDock() {
|
||||||
set_name("History");
|
set_name("History");
|
||||||
|
|
||||||
@ -229,23 +235,28 @@ HistoryDock::HistoryDock() {
|
|||||||
HBoxContainer *mode_hb = memnew(HBoxContainer);
|
HBoxContainer *mode_hb = memnew(HBoxContainer);
|
||||||
add_child(mode_hb);
|
add_child(mode_hb);
|
||||||
|
|
||||||
|
bool include_scene = EditorSettings::get_singleton()->get_project_metadata("history", "include_scene", true);
|
||||||
|
bool include_global = EditorSettings::get_singleton()->get_project_metadata("history", "include_global", true);
|
||||||
|
|
||||||
current_scene_checkbox = memnew(CheckBox);
|
current_scene_checkbox = memnew(CheckBox);
|
||||||
mode_hb->add_child(current_scene_checkbox);
|
mode_hb->add_child(current_scene_checkbox);
|
||||||
current_scene_checkbox->set_flat(true);
|
current_scene_checkbox->set_flat(true);
|
||||||
current_scene_checkbox->set_pressed(true);
|
current_scene_checkbox->set_pressed(include_scene);
|
||||||
current_scene_checkbox->set_text(TTR("Scene"));
|
current_scene_checkbox->set_text(TTR("Scene"));
|
||||||
current_scene_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
current_scene_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
current_scene_checkbox->set_clip_text(true);
|
current_scene_checkbox->set_clip_text(true);
|
||||||
current_scene_checkbox->connect("toggled", callable_mp(this, &HistoryDock::refresh_history).unbind(1));
|
current_scene_checkbox->connect("toggled", callable_mp(this, &HistoryDock::refresh_history).unbind(1));
|
||||||
|
current_scene_checkbox->connect("toggled", callable_mp(this, &HistoryDock::save_options).unbind(1));
|
||||||
|
|
||||||
global_history_checkbox = memnew(CheckBox);
|
global_history_checkbox = memnew(CheckBox);
|
||||||
mode_hb->add_child(global_history_checkbox);
|
mode_hb->add_child(global_history_checkbox);
|
||||||
global_history_checkbox->set_flat(true);
|
global_history_checkbox->set_flat(true);
|
||||||
global_history_checkbox->set_pressed(true);
|
global_history_checkbox->set_pressed(include_global);
|
||||||
global_history_checkbox->set_text(TTR("Global"));
|
global_history_checkbox->set_text(TTR("Global"));
|
||||||
global_history_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
global_history_checkbox->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
global_history_checkbox->set_clip_text(true);
|
global_history_checkbox->set_clip_text(true);
|
||||||
global_history_checkbox->connect("toggled", callable_mp(this, &HistoryDock::refresh_history).unbind(1));
|
global_history_checkbox->connect("toggled", callable_mp(this, &HistoryDock::refresh_history).unbind(1));
|
||||||
|
global_history_checkbox->connect("toggled", callable_mp(this, &HistoryDock::save_options).unbind(1));
|
||||||
|
|
||||||
action_list = memnew(ItemList);
|
action_list = memnew(ItemList);
|
||||||
action_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
action_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||||
|
@ -53,6 +53,7 @@ class HistoryDock : public VBoxContainer {
|
|||||||
void refresh_history();
|
void refresh_history();
|
||||||
void on_version_changed();
|
void on_version_changed();
|
||||||
void refresh_version();
|
void refresh_version();
|
||||||
|
void save_options();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_notification);
|
void _notification(int p_notification);
|
||||||
|
Loading…
Reference in New Issue
Block a user