mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #112857 from ryevdokimov/project-manager-shortcut-crash
Fix modifiying shortcuts in project manager causing crash
This commit is contained in:
commit
9eab056f8d
1 changed files with 41 additions and 25 deletions
|
|
@ -349,6 +349,13 @@ void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Ar
|
||||||
old_input_array = _event_list_to_array_helper(defaults);
|
old_input_array = _event_list_to_array_helper(defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_is_in_project_manager()) {
|
||||||
|
// Project Manager doesn't have EditorUndoRedoManager, so apply changes directly.
|
||||||
|
EditorSettings::get_singleton()->mark_setting_changed("builtin_action_overrides");
|
||||||
|
EditorSettings::get_singleton()->set_builtin_action_override(p_name, p_events);
|
||||||
|
_update_shortcuts();
|
||||||
|
_settings_changed();
|
||||||
|
} else {
|
||||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||||
undo_redo->create_action(vformat(TTR("Edit Built-in Action: %s"), p_name));
|
undo_redo->create_action(vformat(TTR("Edit Built-in Action: %s"), p_name));
|
||||||
undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
|
undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
|
||||||
|
|
@ -360,11 +367,19 @@ void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Ar
|
||||||
undo_redo->add_do_method(this, "_settings_changed");
|
undo_redo->add_do_method(this, "_settings_changed");
|
||||||
undo_redo->add_undo_method(this, "_settings_changed");
|
undo_redo->add_undo_method(this, "_settings_changed");
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const Array &p_events) {
|
void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const Array &p_events) {
|
||||||
Ref<Shortcut> current_sc = EditorSettings::get_singleton()->get_shortcut(p_path);
|
Ref<Shortcut> current_sc = EditorSettings::get_singleton()->get_shortcut(p_path);
|
||||||
|
|
||||||
|
if (_is_in_project_manager()) {
|
||||||
|
// Project Manager doesn't have EditorUndoRedoManager, so apply changes directly.
|
||||||
|
current_sc->set_events(p_events);
|
||||||
|
EditorSettings::get_singleton()->mark_setting_changed("shortcuts");
|
||||||
|
_update_shortcuts();
|
||||||
|
_settings_changed();
|
||||||
|
} else {
|
||||||
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
|
||||||
undo_redo->create_action(vformat(TTR("Edit Shortcut: %s"), p_path), UndoRedo::MERGE_DISABLE, EditorSettings::get_singleton());
|
undo_redo->create_action(vformat(TTR("Edit Shortcut: %s"), p_path), UndoRedo::MERGE_DISABLE, EditorSettings::get_singleton());
|
||||||
// History must be fixed based on the EditorSettings object because current_sc would
|
// History must be fixed based on the EditorSettings object because current_sc would
|
||||||
|
|
@ -379,6 +394,7 @@ void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const A
|
||||||
undo_redo->add_do_method(this, "_settings_changed");
|
undo_redo->add_do_method(this, "_settings_changed");
|
||||||
undo_redo->add_undo_method(this, "_settings_changed");
|
undo_redo->add_undo_method(this, "_settings_changed");
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
|
}
|
||||||
|
|
||||||
bool path_is_orbit_mod = p_path == "spatial_editor/viewport_orbit_modifier_1" || p_path == "spatial_editor/viewport_orbit_modifier_2";
|
bool path_is_orbit_mod = p_path == "spatial_editor/viewport_orbit_modifier_1" || p_path == "spatial_editor/viewport_orbit_modifier_2";
|
||||||
bool path_is_pan_mod = p_path == "spatial_editor/viewport_pan_modifier_1" || p_path == "spatial_editor/viewport_pan_modifier_2";
|
bool path_is_pan_mod = p_path == "spatial_editor/viewport_pan_modifier_1" || p_path == "spatial_editor/viewport_pan_modifier_2";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue