Merge pull request #109016 from Rindbee/use-undo_redo-to-track-property-changes

Use `EditorUndoRedoManager` to track the property changes of the configured `InputEvent` in the plugin
This commit is contained in:
Thaddeus Crews
2025-08-01 11:45:20 -05:00
2 changed files with 58 additions and 2 deletions

View File

@@ -153,6 +153,9 @@ int64_t InputEventFromWindow::get_window_id() const {
///////////////////////////////////
void InputEventWithModifiers::set_command_or_control_autoremap(bool p_enabled) {
if (command_or_control_autoremap == p_enabled) {
return;
}
command_or_control_autoremap = p_enabled;
if (command_or_control_autoremap) {
if (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) {
@@ -166,6 +169,7 @@ void InputEventWithModifiers::set_command_or_control_autoremap(bool p_enabled) {
ctrl_pressed = false;
meta_pressed = false;
}
notify_property_list_changed();
emit_changed();
}
@@ -309,9 +313,11 @@ void InputEventWithModifiers::_validate_property(PropertyInfo &p_property) const
// Cannot be used with Meta/Command or Control!
if (p_property.name == "meta_pressed") {
p_property.usage ^= PROPERTY_USAGE_STORAGE;
p_property.usage ^= PROPERTY_USAGE_EDITOR;
}
if (p_property.name == "ctrl_pressed") {
p_property.usage ^= PROPERTY_USAGE_STORAGE;
p_property.usage ^= PROPERTY_USAGE_EDITOR;
}
} else {
if (p_property.name == "command_or_control_autoremap") {