Skip to content

Commit bf8dd73

Browse files
committed
Merge pull request #86280 from Calinou/editor-input-map-editor-action-edit-title
Add input action name to window title in input map editor
2 parents 8d9c11b + 8e2f319 commit bf8dd73

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

editor/action_map_editor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void ActionMapEditor::_tree_button_pressed(Object *p_item, int p_column, int p_i
168168
current_action_name = item->get_meta("__name");
169169
current_action_event_index = -1;
170170

171-
event_config_dialog->popup_and_configure();
171+
event_config_dialog->popup_and_configure(Ref<InputEvent>(), current_action_name);
172172
} break;
173173
case ActionMapEditor::BUTTON_EDIT_EVENT: {
174174
// Action and Action name is located on the parent of the event.
@@ -179,7 +179,7 @@ void ActionMapEditor::_tree_button_pressed(Object *p_item, int p_column, int p_i
179179

180180
Ref<InputEvent> ie = item->get_meta("__event");
181181
if (ie.is_valid()) {
182-
event_config_dialog->popup_and_configure(ie);
182+
event_config_dialog->popup_and_configure(ie, current_action_name);
183183
}
184184
} break;
185185
case ActionMapEditor::BUTTON_REMOVE_ACTION: {

editor/input_event_configuration_dialog.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ void InputEventConfigurationDialog::_notification(int p_what) {
572572
}
573573
}
574574

575-
void InputEventConfigurationDialog::popup_and_configure(const Ref<InputEvent> &p_event) {
575+
void InputEventConfigurationDialog::popup_and_configure(const Ref<InputEvent> &p_event, const String &p_current_action_name) {
576576
if (p_event.is_valid()) {
577577
_set_event(p_event->duplicate(), p_event);
578578
} else {
@@ -596,6 +596,12 @@ void InputEventConfigurationDialog::popup_and_configure(const Ref<InputEvent> &p
596596
device_id_option->select(0);
597597
}
598598

599+
if (!p_current_action_name.is_empty()) {
600+
set_title(vformat(TTR("Event Configuration for \"%s\""), p_current_action_name));
601+
} else {
602+
set_title(TTR("Event Configuration"));
603+
}
604+
599605
popup_centered(Size2(0, 400) * EDSCALE);
600606
}
601607

@@ -611,7 +617,6 @@ void InputEventConfigurationDialog::set_allowed_input_types(int p_type_masks) {
611617
InputEventConfigurationDialog::InputEventConfigurationDialog() {
612618
allowed_input_types = INPUT_KEY | INPUT_MOUSE_BUTTON | INPUT_JOY_BUTTON | INPUT_JOY_MOTION;
613619

614-
set_title(TTR("Event Configuration"));
615620
set_min_size(Size2i(550, 0) * EDSCALE);
616621

617622
VBoxContainer *main_vbox = memnew(VBoxContainer);

editor/input_event_configuration_dialog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ class InputEventConfigurationDialog : public ConfirmationDialog {
120120

121121
public:
122122
// Pass an existing event to configure it. Alternatively, pass no event to start with a blank configuration.
123-
void popup_and_configure(const Ref<InputEvent> &p_event = Ref<InputEvent>());
123+
// An action name can be passed for descriptive purposes.
124+
void popup_and_configure(const Ref<InputEvent> &p_event = Ref<InputEvent>(), const String &p_current_action_name = "");
124125
Ref<InputEvent> get_event() const;
125126

126127
void set_allowed_input_types(int p_type_masks);

0 commit comments

Comments
 (0)