Sfoglia il codice sorgente

Allow editor commands to have multiple default commands

Kevin Cardona 2 anni fa
parent
commit
20887d801b
2 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. 10 0
      editor/editor_command_palette.cpp
  2. 1 0
      editor/editor_command_palette.h

+ 10 - 0
editor/editor_command_palette.cpp

@@ -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 - 0
editor/editor_command_palette.h

@@ -105,5 +105,6 @@ public:
 };
 
 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