summaryrefslogtreecommitdiffstats
path: root/core/config/project_settings.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-11-20 17:03:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-11-20 17:03:23 +0100
commitcfef79415b39ca8e0f6b1234f5b810e4dc6ac3f6 (patch)
treee3dec14ce23cd90c76767a0cbdd86697953a208a /core/config/project_settings.cpp
parent7c1f42506ab1b23efd9ff7ddc7fc03449bfc578c (diff)
parentbc5e2f9b96eff14e25514ebca072e3ffe75c2451 (diff)
downloadredot-engine-cfef79415b39ca8e0f6b1234f5b810e4dc6ac3f6.tar.gz
Merge pull request #99449 from Sauermann/fix-revert-device-id-clash
Revert "Fix `InputEvent` device id clash" and add a compatibility function
Diffstat (limited to 'core/config/project_settings.cpp')
-rw-r--r--core/config/project_settings.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index a6883064d8..6c28b00f48 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -514,16 +514,19 @@ void ProjectSettings::_convert_to_last_version(int p_from_version) {
}
}
}
- if (p_from_version <= 5) {
- // Converts the device in events from -1 (emulated events) to -3 (all events).
+ if (p_from_version == 5) {
+ // Converts the device in events from -3 to -1.
+ // -3 was introduced in GH-97707 as a way to prevent a clash in device IDs, but as reported in GH-99243, this leads to problems.
+ // -3 was used during dev-releases, so this conversion helps to revert such affected projects.
+ // This conversion doesn't affect any other projects, since -3 is not used otherwise.
for (KeyValue<StringName, ProjectSettings::VariantContainer> &E : props) {
if (String(E.key).begins_with("input/")) {
Dictionary action = E.value.variant;
Array events = action["events"];
for (int i = 0; i < events.size(); i++) {
Ref<InputEvent> ev = events[i];
- if (ev.is_valid() && ev->get_device() == -1) { // -1 was the previous value (GH-97707).
- ev->set_device(InputEvent::DEVICE_ID_ALL_DEVICES);
+ if (ev.is_valid() && ev->get_device() == -3) {
+ ev->set_device(-1);
}
}
}