From f31aa20562fa10a144e0545203a5c32495c1c93b Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Thu, 4 Dec 2025 11:40:53 +0100 Subject: [PATCH] Add special compat methods for EditorFileDialog enum fns Fixes broken binary compatibility in GDExtension, introduced by moving methods from EditorFileDialog to its base class FileDialog. While the general derived-to-base compat mechanism works, the function hashes are changed when enum types are also moved between classes. An earlier attempt restored original enums in EditorFileDialog and added regular compatibility methods, however this caused shadowed symbols in C# bindings. Instead, hash mappings are now directly hardcoded as "special compat hashes". --- core/extension/gdextension_special_compat_hashes.cpp | 6 ++++++ editor/project_manager/project_manager.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/extension/gdextension_special_compat_hashes.cpp b/core/extension/gdextension_special_compat_hashes.cpp index 73b60425072..9698748ec28 100644 --- a/core/extension/gdextension_special_compat_hashes.cpp +++ b/core/extension/gdextension_special_compat_hashes.cpp @@ -331,6 +331,12 @@ void GDExtensionSpecialCompatHashes::initialize() { }); mappings.insert("EditorFileDialog", { { "add_filter", 233059325, 3388804757 }, + { "get_access", 778734016, 3344081076 }, + { "set_access", 3882893764, 4104413466 }, + { "get_display_mode", 3517174669, 1092104624 }, + { "set_display_mode", 3049004050, 2692197101 }, + { "get_file_mode", 2681044145, 4074825319 }, + { "set_file_mode", 274150415, 3654936397 }, }); mappings.insert("EditorImportPlugin", { { "append_import_external_resource", 3645925746, 320493106 }, diff --git a/editor/project_manager/project_manager.cpp b/editor/project_manager/project_manager.cpp index 588578609b7..660e7ec1d24 100644 --- a/editor/project_manager/project_manager.cpp +++ b/editor/project_manager/project_manager.cpp @@ -1370,7 +1370,7 @@ ProjectManager::ProjectManager() { FileDialog::set_get_thumbnail_callback(callable_mp_static(ProjectManager::_file_dialog_get_thumbnail)); FileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); - FileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); + FileDialog::set_default_display_mode((FileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); int swap_cancel_ok = EDITOR_GET("interface/editor/accept_dialog_cancel_ok_buttons"); if (swap_cancel_ok != 0) { // 0 is auto, set in register_scene based on DisplayServer.