Skip to content

Commit

Permalink
Allow editor commands to have multiple default commands
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincardona committed Sep 16, 2023
1 parent ba54c34 commit 20887d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions editor/editor_command_palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,13 @@ Ref<Shortcut> ED_SHORTCUT_AND_COMMAND(const String &p_path, const String &p_name
EditorCommandPalette::get_singleton()->add_shortcut_command(p_command_name, p_path, shortcut);
return shortcut;
}

Ref<Shortcut> ED_SHORTCUT_ARRAY_AND_COMMAND(const String &p_path, const String &p_name, const PackedInt32Array &p_keycodes, String p_command_name) {
if (p_command_name.is_empty()) {
p_command_name = p_name;
}

Ref<Shortcut> shortcut = ED_SHORTCUT_ARRAY(p_path, p_name, p_keycodes);
EditorCommandPalette::get_singleton()->add_shortcut_command(p_command_name, p_path, shortcut);
return shortcut;
}
1 change: 1 addition & 0 deletions editor/editor_command_palette.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@ class EditorCommandPalette : public ConfirmationDialog {
};

Ref<Shortcut> ED_SHORTCUT_AND_COMMAND(const String &p_path, const String &p_name, Key p_keycode = Key::NONE, String p_command = "");
Ref<Shortcut> ED_SHORTCUT_ARRAY_AND_COMMAND(const String &p_path, const String &p_name, const PackedInt32Array &p_keycodes, String p_command = "");

#endif // EDITOR_COMMAND_PALETTE_H

0 comments on commit 20887d8

Please sign in to comment.