mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 13:43:15 +00:00
Fix command history for plugin commands
This commit is contained in:
parent
f4d9749e23
commit
abe22dfcf4
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user