feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include "core/input/input_map.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/debugger/editor_debugger_node.h"
|
||||
#include "editor/editor_inspector.h"
|
||||
#include "editor/editor_log.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_property_name_processor.h"
|
||||
|
|
@ -42,11 +43,14 @@
|
|||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "editor/event_listener_line_edit.h"
|
||||
#include "editor/input_event_configuration_dialog.h"
|
||||
#include "editor/plugins/node_3d_editor_plugin.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "editor/themes/editor_theme_manager.h"
|
||||
#include "scene/gui/check_button.h"
|
||||
#include "scene/gui/panel_container.h"
|
||||
#include "scene/gui/tab_container.h"
|
||||
#include "scene/gui/texture_rect.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
void EditorSettingsDialog::ok_pressed() {
|
||||
if (!EditorSettings::get_singleton()) {
|
||||
|
|
@ -74,9 +78,101 @@ void EditorSettingsDialog::_settings_property_edited(const String &p_name) {
|
|||
EditorSettings::get_singleton()->set_manually("text_editor/theme/color_theme", "Custom");
|
||||
} else if (full_name.begins_with("editors/visual_editors/connection_colors") || full_name.begins_with("editors/visual_editors/category_colors")) {
|
||||
EditorSettings::get_singleton()->set_manually("editors/visual_editors/color_theme", "Custom");
|
||||
} else if (full_name == "editors/3d/navigation/orbit_mouse_button" || full_name == "editors/3d/navigation/pan_mouse_button" || full_name == "editors/3d/navigation/zoom_mouse_button" || full_name == "editors/3d/navigation/emulate_3_button_mouse") {
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/navigation_scheme", (int)Node3DEditorViewport::NAVIGATION_CUSTOM);
|
||||
} else if (full_name == "editors/3d/navigation/navigation_scheme") {
|
||||
update_navigation_preset();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::update_navigation_preset() {
|
||||
Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int();
|
||||
Node3DEditorViewport::ViewportNavMouseButton set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
Node3DEditorViewport::ViewportNavMouseButton set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
Node3DEditorViewport::ViewportNavMouseButton set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
bool set_3_button_mouse = false;
|
||||
Ref<InputEventKey> orbit_mod_key_1;
|
||||
Ref<InputEventKey> orbit_mod_key_2;
|
||||
Ref<InputEventKey> pan_mod_key_1;
|
||||
Ref<InputEventKey> pan_mod_key_2;
|
||||
Ref<InputEventKey> zoom_mod_key_1;
|
||||
Ref<InputEventKey> zoom_mod_key_2;
|
||||
bool set_preset = false;
|
||||
|
||||
if (nav_scheme == Node3DEditorViewport::NAVIGATION_GODOT) {
|
||||
set_preset = true;
|
||||
set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::NONE);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
|
||||
pan_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
zoom_mod_key_1 = InputEventKey::create_reference(Key::CTRL);
|
||||
zoom_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA) {
|
||||
set_preset = true;
|
||||
set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_RIGHT_MOUSE;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_1 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
zoom_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
zoom_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) {
|
||||
set_preset = true;
|
||||
set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
|
||||
pan_mod_key_2 = InputEventKey::create_reference(Key::ALT);
|
||||
zoom_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
zoom_mod_key_2 = InputEventKey::create_reference(Key::CTRL);
|
||||
} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_TABLET) {
|
||||
set_preset = true;
|
||||
set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_3_button_mouse = true;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
|
||||
pan_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
zoom_mod_key_1 = InputEventKey::create_reference(Key::CTRL);
|
||||
zoom_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
}
|
||||
// Set settings to the desired preset values.
|
||||
if (set_preset) {
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/orbit_mouse_button", (int)set_orbit_mouse_button);
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/pan_mouse_button", (int)set_pan_mouse_button);
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/zoom_mouse_button", (int)set_zoom_mouse_button);
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/emulate_3_button_mouse", set_3_button_mouse);
|
||||
_set_shortcut_input("spatial_editor/viewport_orbit_modifier_1", orbit_mod_key_1);
|
||||
_set_shortcut_input("spatial_editor/viewport_orbit_modifier_2", orbit_mod_key_2);
|
||||
_set_shortcut_input("spatial_editor/viewport_pan_modifier_1", pan_mod_key_1);
|
||||
_set_shortcut_input("spatial_editor/viewport_pan_modifier_2", pan_mod_key_2);
|
||||
_set_shortcut_input("spatial_editor/viewport_zoom_modifier_1", zoom_mod_key_1);
|
||||
_set_shortcut_input("spatial_editor/viewport_zoom_modifier_2", zoom_mod_key_2);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_set_shortcut_input(const String &p_name, Ref<InputEventKey> &p_event) {
|
||||
Array sc_events;
|
||||
if (p_event->get_keycode() != Key::NONE) {
|
||||
sc_events.push_back((Variant)p_event);
|
||||
}
|
||||
|
||||
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_name);
|
||||
sc->set_events(sc_events);
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_settings_save() {
|
||||
EditorSettings::get_singleton()->notify_changes();
|
||||
EditorSettings::get_singleton()->save();
|
||||
|
|
@ -97,6 +193,8 @@ void EditorSettingsDialog::popup_edit_settings() {
|
|||
|
||||
EditorSettings::get_singleton()->list_text_editor_themes(); // make sure we have an up to date list of themes
|
||||
|
||||
_update_dynamic_property_hints();
|
||||
|
||||
inspector->edit(EditorSettings::get_singleton());
|
||||
inspector->get_inspector()->update_tree();
|
||||
|
||||
|
|
@ -139,8 +237,8 @@ void EditorSettingsDialog::_notification(int p_what) {
|
|||
|
||||
case NOTIFICATION_READY: {
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY).undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, nullptr);
|
||||
undo_redo->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY).undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, nullptr);
|
||||
undo_redo->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY).undo_redo->set_method_notify_callback(EditorDebuggerNode::_methods_changed, nullptr);
|
||||
undo_redo->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY).undo_redo->set_property_notify_callback(EditorDebuggerNode::_properties_changed, nullptr);
|
||||
undo_redo->get_or_create_history(EditorUndoRedoManager::GLOBAL_HISTORY).undo_redo->set_commit_notify_callback(_undo_redo_callback, this);
|
||||
} break;
|
||||
|
||||
|
|
@ -160,6 +258,12 @@ void EditorSettingsDialog::_notification(int p_what) {
|
|||
_update_shortcuts();
|
||||
}
|
||||
|
||||
if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/3d/navigation")) {
|
||||
// Shortcuts may have changed, so dynamic hint values must update.
|
||||
_update_dynamic_property_hints();
|
||||
inspector->get_inspector()->update_tree();
|
||||
}
|
||||
|
||||
if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/localize_settings")) {
|
||||
inspector->update_category_list();
|
||||
}
|
||||
|
|
@ -199,7 +303,7 @@ void EditorSettingsDialog::_update_icons() {
|
|||
shortcut_search_box->set_right_icon(shortcuts->get_editor_theme_icon(SNAME("Search")));
|
||||
shortcut_search_box->set_clear_button_enabled(true);
|
||||
|
||||
restart_close_button->set_icon(shortcuts->get_editor_theme_icon(SNAME("Close")));
|
||||
restart_close_button->set_button_icon(shortcuts->get_editor_theme_icon(SNAME("Close")));
|
||||
restart_container->add_theme_style_override(SceneStringName(panel), shortcuts->get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
|
||||
restart_icon->set_texture(shortcuts->get_editor_theme_icon(SNAME("StatusWarning")));
|
||||
restart_label->add_theme_color_override(SceneStringName(font_color), shortcuts->get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
|
||||
|
|
@ -228,6 +332,10 @@ void EditorSettingsDialog::_event_config_confirmed() {
|
|||
|
||||
void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Array &p_events) {
|
||||
Array old_input_array = EditorSettings::get_singleton()->get_builtin_action_overrides(p_name);
|
||||
if (old_input_array.is_empty()) {
|
||||
List<Ref<InputEvent>> defaults = InputMap::get_singleton()->get_builtins_with_feature_overrides_applied()[current_edited_identifier];
|
||||
old_input_array = _event_list_to_array_helper(defaults);
|
||||
}
|
||||
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(vformat(TTR("Edit Built-in Action: %s"), p_name));
|
||||
|
|
@ -235,18 +343,21 @@ void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Ar
|
|||
undo_redo->add_undo_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
|
||||
undo_redo->add_do_method(EditorSettings::get_singleton(), "set_builtin_action_override", p_name, p_events);
|
||||
undo_redo->add_undo_method(EditorSettings::get_singleton(), "set_builtin_action_override", p_name, old_input_array);
|
||||
undo_redo->add_do_method(this, "_update_shortcuts");
|
||||
undo_redo->add_undo_method(this, "_update_shortcuts");
|
||||
undo_redo->add_do_method(this, "_settings_changed");
|
||||
undo_redo->add_undo_method(this, "_settings_changed");
|
||||
undo_redo->commit_action();
|
||||
|
||||
_update_shortcuts();
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const Array &p_events) {
|
||||
Ref<Shortcut> current_sc = EditorSettings::get_singleton()->get_shortcut(p_path);
|
||||
|
||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
undo_redo->create_action(vformat(TTR("Edit Shortcut: %s"), p_path));
|
||||
undo_redo->create_action(vformat(TTR("Edit Shortcut: %s"), p_path), UndoRedo::MERGE_DISABLE, EditorSettings::get_singleton());
|
||||
// History must be fixed based on the EditorSettings object because current_sc would
|
||||
// incorrectly make this action use the scene history.
|
||||
undo_redo->force_fixed_history();
|
||||
undo_redo->add_do_method(current_sc.ptr(), "set_events", p_events);
|
||||
undo_redo->add_undo_method(current_sc.ptr(), "set_events", current_sc->get_events());
|
||||
undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "shortcuts");
|
||||
|
|
@ -256,6 +367,13 @@ void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const A
|
|||
undo_redo->add_do_method(this, "_settings_changed");
|
||||
undo_redo->add_undo_method(this, "_settings_changed");
|
||||
undo_redo->commit_action();
|
||||
|
||||
bool path_is_orbit_mod = p_path == "spatial_editor/viewport_orbit_modifier_1" || p_path == "spatial_editor/viewport_orbit_modifier_2";
|
||||
bool path_is_pan_mod = p_path == "spatial_editor/viewport_pan_modifier_1" || p_path == "spatial_editor/viewport_pan_modifier_2";
|
||||
bool path_is_zoom_mod = p_path == "spatial_editor/viewport_zoom_modifier_1" || p_path == "spatial_editor/viewport_zoom_modifier_2";
|
||||
if (path_is_orbit_mod || path_is_pan_mod || path_is_zoom_mod) {
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/navigation_scheme", (int)Node3DEditorViewport::NAVIGATION_CUSTOM);
|
||||
}
|
||||
}
|
||||
|
||||
Array EditorSettingsDialog::_event_list_to_array_helper(const List<Ref<InputEvent>> &p_events) {
|
||||
|
|
@ -272,7 +390,7 @@ Array EditorSettingsDialog::_event_list_to_array_helper(const List<Ref<InputEven
|
|||
return events;
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_create_shortcut_treeitem(TreeItem *p_parent, const String &p_shortcut_identifier, const String &p_display, Array &p_events, bool p_allow_revert, bool p_is_action, bool p_is_collapsed) {
|
||||
TreeItem *EditorSettingsDialog::_create_shortcut_treeitem(TreeItem *p_parent, const String &p_shortcut_identifier, const String &p_display, Array &p_events, bool p_allow_revert, bool p_is_action, bool p_is_collapsed) {
|
||||
TreeItem *shortcut_item = shortcuts->create_item(p_parent);
|
||||
shortcut_item->set_collapsed(p_is_collapsed);
|
||||
shortcut_item->set_text(0, p_display);
|
||||
|
|
@ -280,7 +398,7 @@ void EditorSettingsDialog::_create_shortcut_treeitem(TreeItem *p_parent, const S
|
|||
Ref<InputEvent> primary = p_events.size() > 0 ? Ref<InputEvent>(p_events[0]) : Ref<InputEvent>();
|
||||
Ref<InputEvent> secondary = p_events.size() > 1 ? Ref<InputEvent>(p_events[1]) : Ref<InputEvent>();
|
||||
|
||||
String sc_text = "None";
|
||||
String sc_text = TTRC("None");
|
||||
if (primary.is_valid()) {
|
||||
sc_text = primary->as_text();
|
||||
|
||||
|
|
@ -291,6 +409,7 @@ void EditorSettingsDialog::_create_shortcut_treeitem(TreeItem *p_parent, const S
|
|||
sc_text += " (+" + itos(p_events.size() - 2) + ")";
|
||||
}
|
||||
}
|
||||
shortcut_item->set_auto_translate_mode(1, AUTO_TRANSLATE_MODE_DISABLED);
|
||||
}
|
||||
|
||||
shortcut_item->set_text(1, sc_text);
|
||||
|
|
@ -320,8 +439,10 @@ void EditorSettingsDialog::_create_shortcut_treeitem(TreeItem *p_parent, const S
|
|||
|
||||
TreeItem *event_item = shortcuts->create_item(shortcut_item);
|
||||
|
||||
event_item->set_text(0, shortcut_item->get_child_count() == 1 ? "Primary" : "");
|
||||
// TRANSLATORS: This is the label for the main input event of a shortcut.
|
||||
event_item->set_text(0, shortcut_item->get_child_count() == 1 ? TTRC("Primary") : "");
|
||||
event_item->set_text(1, ie->as_text());
|
||||
event_item->set_auto_translate_mode(1, AUTO_TRANSLATE_MODE_DISABLED);
|
||||
|
||||
event_item->add_button(1, shortcuts->get_editor_theme_icon(SNAME("Edit")), SHORTCUT_EDIT);
|
||||
event_item->add_button(1, shortcuts->get_editor_theme_icon(SNAME("Close")), SHORTCUT_ERASE);
|
||||
|
|
@ -333,22 +454,38 @@ void EditorSettingsDialog::_create_shortcut_treeitem(TreeItem *p_parent, const S
|
|||
event_item->set_meta("type", "event");
|
||||
event_item->set_meta("event_index", i);
|
||||
}
|
||||
|
||||
return shortcut_item;
|
||||
}
|
||||
|
||||
bool EditorSettingsDialog::_should_display_shortcut(const String &p_name, const Array &p_events) const {
|
||||
bool EditorSettingsDialog::_should_display_shortcut(const String &p_name, const Array &p_events, bool p_match_localized_name) const {
|
||||
const Ref<InputEvent> search_ev = shortcut_search_by_event->get_event();
|
||||
bool event_match = true;
|
||||
if (search_ev.is_valid()) {
|
||||
event_match = false;
|
||||
bool event_match = false;
|
||||
for (int i = 0; i < p_events.size(); ++i) {
|
||||
const Ref<InputEvent> ev = p_events[i];
|
||||
if (ev.is_valid() && ev->is_match(search_ev, true)) {
|
||||
event_match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!event_match) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return event_match && shortcut_search_box->get_text().is_subsequence_ofn(p_name);
|
||||
const String &search_text = shortcut_search_box->get_text();
|
||||
if (search_text.is_empty()) {
|
||||
return true;
|
||||
}
|
||||
if (search_text.is_subsequence_ofn(p_name)) {
|
||||
return true;
|
||||
}
|
||||
if (p_match_localized_name && search_text.is_subsequence_ofn(TTR(p_name))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_update_shortcuts() {
|
||||
|
|
@ -390,7 +527,7 @@ void EditorSettingsDialog::_update_shortcuts() {
|
|||
// Set up section for Common/Built-in actions
|
||||
TreeItem *common_section = shortcuts->create_item(root);
|
||||
sections["Common"] = common_section;
|
||||
common_section->set_text(0, TTR("Common"));
|
||||
common_section->set_text(0, TTRC("Common"));
|
||||
common_section->set_selectable(0, false);
|
||||
common_section->set_selectable(1, false);
|
||||
if (collapsed.has("Common")) {
|
||||
|
|
@ -411,7 +548,7 @@ void EditorSettingsDialog::_update_shortcuts() {
|
|||
|
||||
const List<Ref<InputEvent>> &all_default_events = InputMap::get_singleton()->get_builtins_with_feature_overrides_applied().find(action_name)->value;
|
||||
Array action_events = _event_list_to_array_helper(action.inputs);
|
||||
if (!_should_display_shortcut(action_name, action_events)) {
|
||||
if (!_should_display_shortcut(action_name, action_events, false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -419,7 +556,8 @@ void EditorSettingsDialog::_update_shortcuts() {
|
|||
bool same_as_defaults = Shortcut::is_event_array_equal(default_events, action_events);
|
||||
bool collapse = !collapsed.has(action_name) || (collapsed.has(action_name) && collapsed[action_name]);
|
||||
|
||||
_create_shortcut_treeitem(common_section, action_name, action_name, action_events, !same_as_defaults, true, collapse);
|
||||
TreeItem *item = _create_shortcut_treeitem(common_section, action_name, action_name, action_events, !same_as_defaults, true, collapse);
|
||||
item->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED); // `ui_*` input action names are untranslatable identifiers.
|
||||
}
|
||||
|
||||
// Editor Shortcuts
|
||||
|
|
@ -445,6 +583,7 @@ void EditorSettingsDialog::_update_shortcuts() {
|
|||
const String item_name = EditorPropertyNameProcessor::get_singleton()->process_name(section_name, name_style, E);
|
||||
const String tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(section_name, tooltip_style, E);
|
||||
|
||||
section->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED); // Already translated manually.
|
||||
section->set_text(0, item_name);
|
||||
section->set_tooltip_text(0, tooltip);
|
||||
section->set_selectable(0, false);
|
||||
|
|
@ -469,7 +608,7 @@ void EditorSettingsDialog::_update_shortcuts() {
|
|||
String section_name = E.get_slice("/", 0);
|
||||
TreeItem *section = sections[section_name];
|
||||
|
||||
if (!_should_display_shortcut(sc->get_name(), sc->get_events())) {
|
||||
if (!_should_display_shortcut(sc->get_name(), sc->get_events(), true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -605,7 +744,7 @@ Variant EditorSettingsDialog::get_drag_data_fw(const Point2 &p_point, Control *p
|
|||
return Variant();
|
||||
}
|
||||
|
||||
String label_text = "Event " + itos(selected->get_meta("event_index"));
|
||||
String label_text = vformat(TTRC("Event %d"), selected->get_meta("event_index"));
|
||||
Label *label = memnew(Label(label_text));
|
||||
label->set_modulate(Color(1, 1, 1, 1.0f));
|
||||
shortcuts->set_drag_preview(label);
|
||||
|
|
@ -661,6 +800,44 @@ void EditorSettingsDialog::drop_data_fw(const Point2 &p_point, const Variant &p_
|
|||
|
||||
void EditorSettingsDialog::_tabs_tab_changed(int p_tab) {
|
||||
_focus_current_search_box();
|
||||
|
||||
// When tab has switched, shortcuts may have changed.
|
||||
_update_dynamic_property_hints();
|
||||
inspector->get_inspector()->update_tree();
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_update_dynamic_property_hints() {
|
||||
// Calling add_property_hint overrides the existing hint.
|
||||
EditorSettings *settings = EditorSettings::get_singleton();
|
||||
settings->add_property_hint(_create_mouse_shortcut_property_info("editors/3d/navigation/orbit_mouse_button", "spatial_editor/viewport_orbit_modifier_1", "spatial_editor/viewport_orbit_modifier_2"));
|
||||
settings->add_property_hint(_create_mouse_shortcut_property_info("editors/3d/navigation/pan_mouse_button", "spatial_editor/viewport_pan_modifier_1", "spatial_editor/viewport_pan_modifier_2"));
|
||||
settings->add_property_hint(_create_mouse_shortcut_property_info("editors/3d/navigation/zoom_mouse_button", "spatial_editor/viewport_zoom_modifier_1", "spatial_editor/viewport_zoom_modifier_2"));
|
||||
}
|
||||
|
||||
PropertyInfo EditorSettingsDialog::_create_mouse_shortcut_property_info(const String &p_property_name, const String &p_shortcut_1_name, const String &p_shortcut_2_name) {
|
||||
String hint_string;
|
||||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Left Mouse,";
|
||||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Middle Mouse,";
|
||||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Right Mouse,";
|
||||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Mouse Button 4,";
|
||||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Mouse Button 5";
|
||||
|
||||
return PropertyInfo(Variant::INT, p_property_name, PROPERTY_HINT_ENUM, hint_string);
|
||||
}
|
||||
|
||||
String EditorSettingsDialog::_get_shortcut_button_string(const String &p_shortcut_name) {
|
||||
String button_string;
|
||||
Ref<Shortcut> shortcut_ref = EditorSettings::get_singleton()->get_shortcut(p_shortcut_name);
|
||||
Array events = shortcut_ref->get_events();
|
||||
for (Ref<InputEvent> input_event : events) {
|
||||
button_string += input_event->as_text() + " + ";
|
||||
}
|
||||
return button_string;
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_focus_current_search_box() {
|
||||
|
|
@ -678,6 +855,10 @@ void EditorSettingsDialog::_focus_current_search_box() {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_advanced_toggled(bool p_button_pressed) {
|
||||
EditorSettings::get_singleton()->set("_editor_settings_advanced_mode", p_button_pressed);
|
||||
}
|
||||
|
||||
void EditorSettingsDialog::_editor_restart() {
|
||||
EditorNode::get_singleton()->save_all_scenes();
|
||||
EditorNode::get_singleton()->restart_editor();
|
||||
|
|
@ -720,9 +901,17 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
|||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->add_child(search_box);
|
||||
|
||||
advanced_switch = memnew(CheckButton(TTR("Advanced Settings")));
|
||||
hbc->add_child(advanced_switch);
|
||||
|
||||
bool use_advanced = EDITOR_DEF("_editor_settings_advanced_mode", false);
|
||||
advanced_switch->set_pressed(use_advanced);
|
||||
advanced_switch->connect(SceneStringName(toggled), callable_mp(this, &EditorSettingsDialog::_advanced_toggled));
|
||||
|
||||
inspector = memnew(SectionedInspector);
|
||||
inspector->get_inspector()->set_use_filter(true);
|
||||
inspector->register_search_box(search_box);
|
||||
inspector->register_advanced_toggle(advanced_switch);
|
||||
inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
tab_general->add_child(inspector);
|
||||
inspector->get_inspector()->connect("property_edited", callable_mp(this, &EditorSettingsDialog::_settings_property_edited));
|
||||
|
|
@ -783,13 +972,12 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
|||
top_hbox->add_child(clear_all_search);
|
||||
|
||||
shortcuts = memnew(Tree);
|
||||
shortcuts->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
shortcuts->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
shortcuts->set_columns(2);
|
||||
shortcuts->set_hide_root(true);
|
||||
shortcuts->set_column_titles_visible(true);
|
||||
shortcuts->set_column_title(0, TTR("Name"));
|
||||
shortcuts->set_column_title(1, TTR("Binding"));
|
||||
shortcuts->set_column_title(0, TTRC("Name"));
|
||||
shortcuts->set_column_title(1, TTRC("Binding"));
|
||||
shortcuts->connect("button_clicked", callable_mp(this, &EditorSettingsDialog::_shortcut_button_pressed));
|
||||
shortcuts->connect("item_activated", callable_mp(this, &EditorSettingsDialog::_shortcut_cell_double_clicked));
|
||||
tab_shortcuts->add_child(shortcuts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue