1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Use EditorUndoRedoManager to track the property changes of the

configured `InputEvent` in the plugin

This allows undo and redo, and can mark in time whether the handled
`InputEvent` resource is edited.

`command_or_control_autoremap` needs to be handled separately, as
its value will change the usage of other properties.
This commit is contained in:
风青山
2025-07-27 13:03:20 +08:00
parent 0dd9178269
commit 95403207e8
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") {