diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-19 13:13:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 13:13:09 +0200 |
commit | b1b5d516d70be512b657eebcef78210267fbd862 (patch) | |
tree | 7d5702595e1e4bb2c9c6a4a88903873ebeb0fe27 /editor | |
parent | 964c8322b12ae6ee0ae672c853b9de77c5eb5d76 (diff) | |
parent | abe22dfcf44c281d67ad2f3e107f0bc6885470c8 (diff) |
Merge pull request #53979 from KoBeWi/bug_from_the_past
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_command_palette.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp index e69ced8522..71e9fac219 100644 --- a/editor/editor_command_palette.cpp +++ b/editor/editor_command_palette.cpp @@ -212,6 +212,12 @@ void EditorCommandPalette::_add_command(String p_command_name, String p_key_name command.callable = p_binded_action; command.shortcut = p_shortcut_text; + // Commands added from plugins don't exist yet when the history is loaded, so we assign the last use time here if it was recorded. + Dictionary command_history = EditorSettings::get_singleton()->get_project_metadata("command_palette", "command_history", Dictionary()); + if (command_history.has(p_key_name)) { + command.last_used = command_history[p_key_name]; + } + commands[p_key_name] = command; } @@ -242,7 +248,9 @@ void EditorCommandPalette::register_shortcuts_as_command() { Array history_entries = command_history.keys(); for (int i = 0; i < history_entries.size(); i++) { const String &history_key = history_entries[i]; - commands[history_key].last_used = command_history[history_key]; + if (commands.has(history_key)) { + commands[history_key].last_used = command_history[history_key]; + } } } |