Merge pull request #65957 from EricEzaM/GH-65956-fix-ed-shortcut-section-order
Update Editor Shortcuts tree creation to always have sections in same order
This commit is contained in:
commit
1a0943e0f8
@ -416,45 +416,50 @@ void EditorSettingsDialog::_update_shortcuts() {
|
|||||||
|
|
||||||
List<String> slist;
|
List<String> slist;
|
||||||
EditorSettings::get_singleton()->get_shortcut_list(&slist);
|
EditorSettings::get_singleton()->get_shortcut_list(&slist);
|
||||||
|
slist.sort(); // Sort alphabetically.
|
||||||
|
|
||||||
const EditorPropertyNameProcessor::Style name_style = EditorPropertyNameProcessor::get_settings_style();
|
const EditorPropertyNameProcessor::Style name_style = EditorPropertyNameProcessor::get_settings_style();
|
||||||
const EditorPropertyNameProcessor::Style tooltip_style = EditorPropertyNameProcessor::get_tooltip_style(name_style);
|
const EditorPropertyNameProcessor::Style tooltip_style = EditorPropertyNameProcessor::get_tooltip_style(name_style);
|
||||||
|
|
||||||
|
// Create all sections first.
|
||||||
|
for (const String &E : slist) {
|
||||||
|
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(E);
|
||||||
|
String section_name = E.get_slice("/", 0);
|
||||||
|
|
||||||
|
if (sections.has(section_name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
TreeItem *section = shortcuts->create_item(root);
|
||||||
|
|
||||||
|
const String item_name = EditorPropertyNameProcessor::get_singleton()->process_name(section_name, name_style);
|
||||||
|
const String tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(section_name, tooltip_style);
|
||||||
|
|
||||||
|
section->set_text(0, item_name);
|
||||||
|
section->set_tooltip_text(0, tooltip);
|
||||||
|
section->set_selectable(0, false);
|
||||||
|
section->set_selectable(1, false);
|
||||||
|
section->set_custom_bg_color(0, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor")));
|
||||||
|
section->set_custom_bg_color(1, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor")));
|
||||||
|
|
||||||
|
if (collapsed.has(item_name)) {
|
||||||
|
section->set_collapsed(collapsed[item_name]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sections[section_name] = section;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add shortcuts to sections.
|
||||||
for (const String &E : slist) {
|
for (const String &E : slist) {
|
||||||
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(E);
|
Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(E);
|
||||||
if (!sc->has_meta("original")) {
|
if (!sc->has_meta("original")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shortcut Section
|
|
||||||
|
|
||||||
TreeItem *section;
|
|
||||||
String section_name = E.get_slice("/", 0);
|
String section_name = E.get_slice("/", 0);
|
||||||
|
TreeItem *section = sections[section_name];
|
||||||
if (sections.has(section_name)) {
|
|
||||||
section = sections[section_name];
|
|
||||||
} else {
|
|
||||||
section = shortcuts->create_item(root);
|
|
||||||
|
|
||||||
const String item_name = EditorPropertyNameProcessor::get_singleton()->process_name(section_name, name_style);
|
|
||||||
const String tooltip = EditorPropertyNameProcessor::get_singleton()->process_name(section_name, tooltip_style);
|
|
||||||
|
|
||||||
section->set_text(0, item_name);
|
|
||||||
section->set_tooltip_text(0, tooltip);
|
|
||||||
section->set_selectable(0, false);
|
|
||||||
section->set_selectable(1, false);
|
|
||||||
section->set_custom_bg_color(0, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor")));
|
|
||||||
section->set_custom_bg_color(1, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor")));
|
|
||||||
|
|
||||||
if (collapsed.has(item_name)) {
|
|
||||||
section->set_collapsed(collapsed[item_name]);
|
|
||||||
}
|
|
||||||
|
|
||||||
sections[section_name] = section;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shortcut Item
|
// Shortcut Item
|
||||||
|
|
||||||
if (!shortcut_filter.is_subsequence_ofn(sc->get_name())) {
|
if (!shortcut_filter.is_subsequence_ofn(sc->get_name())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user