Skip to content

Commit 7cf1ec1

Browse files
committed
Add 3-to-4 renames for project settings in project.godot
In the ConfigFile format, the first subpath is the category and is not part of the line that the regex would match. Fixes #66125.
1 parent 6eb25f2 commit 7cf1ec1

File tree

3 files changed

+62
-3
lines changed

3 files changed

+62
-3
lines changed

editor/project_converter_3_to_4.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class ProjectConverter3To4::RegExContainer {
153153
LocalVector<RegEx *> enum_regexes;
154154
LocalVector<RegEx *> gdscript_function_regexes;
155155
LocalVector<RegEx *> project_settings_regexes;
156+
LocalVector<RegEx *> project_godot_regexes;
156157
LocalVector<RegEx *> input_map_regexes;
157158
LocalVector<RegEx *> gdscript_properties_regexes;
158159
LocalVector<RegEx *> gdscript_signals_regexes;
@@ -173,10 +174,14 @@ class ProjectConverter3To4::RegExContainer {
173174
for (unsigned int current_index = 0; RenamesMap3To4::gdscript_function_renames[current_index][0]; current_index++) {
174175
gdscript_function_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::gdscript_function_renames[current_index][0] + "\\b")));
175176
}
176-
// Project Settings.
177+
// Project Settings in scripts.
177178
for (unsigned int current_index = 0; RenamesMap3To4::project_settings_renames[current_index][0]; current_index++) {
178179
project_settings_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::project_settings_renames[current_index][0] + "\\b")));
179180
}
181+
// Project Settings in project.godot.
182+
for (unsigned int current_index = 0; RenamesMap3To4::project_godot_renames[current_index][0]; current_index++) {
183+
project_godot_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::project_godot_renames[current_index][0] + "\\b")));
184+
}
180185
// Input Map.
181186
for (unsigned int current_index = 0; RenamesMap3To4::input_map_renames[current_index][0]; current_index++) {
182187
input_map_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::input_map_renames[current_index][0] + "\\b")));
@@ -253,6 +258,9 @@ class ProjectConverter3To4::RegExContainer {
253258
for (RegEx *regex : project_settings_regexes) {
254259
memdelete(regex);
255260
}
261+
for (RegEx *regex : project_godot_regexes) {
262+
memdelete(regex);
263+
}
256264
for (RegEx *regex : input_map_regexes) {
257265
memdelete(regex);
258266
}
@@ -405,7 +413,7 @@ bool ProjectConverter3To4::convert() {
405413

406414
custom_rename(lines, "\\.shader", ".gdshader");
407415
} else if (file_name.ends_with("project.godot")) {
408-
rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines);
416+
rename_common(RenamesMap3To4::project_godot_renames, reg_container.project_godot_regexes, lines);
409417
rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines);
410418
rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines);
411419
} else if (file_name.ends_with(".csproj")) {
@@ -577,7 +585,7 @@ bool ProjectConverter3To4::validate_conversion() {
577585

578586
changed_elements.append_array(check_for_custom_rename(lines, "\\.shader", ".gdshader"));
579587
} else if (file_name.ends_with("project.godot")) {
580-
changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines));
588+
changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_godot_renames, reg_container.project_godot_regexes, lines));
581589
changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines));
582590
changed_elements.append_array(check_for_rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines));
583591
} else if (file_name.ends_with(".csproj")) {
@@ -1106,6 +1114,7 @@ bool ProjectConverter3To4::test_array_names() {
11061114
valid = valid && test_single_array(RenamesMap3To4::shaders_renames, true);
11071115
valid = valid && test_single_array(RenamesMap3To4::gdscript_signals_renames);
11081116
valid = valid && test_single_array(RenamesMap3To4::project_settings_renames);
1117+
valid = valid && test_single_array(RenamesMap3To4::project_godot_renames);
11091118
valid = valid && test_single_array(RenamesMap3To4::input_map_renames);
11101119
valid = valid && test_single_array(RenamesMap3To4::builtin_types_renames);
11111120
valid = valid && test_single_array(RenamesMap3To4::color_renames);

editor/renames_map_3_to_4.cpp

+49
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,9 @@ const char *RenamesMap3To4::csharp_signals_renames[][2] = {
12891289
};
12901290

12911291
const char *RenamesMap3To4::project_settings_renames[][2] = {
1292+
// Project setting paths in scripts include the category, but in project.godot,
1293+
// the category is the section delimiter, so we need to support the paths without it.
1294+
// The project.godot remaps are defined in the project_godot_renames, keep them in sync!
12921295
{ "audio/channel_disable_threshold_db", "audio/buses/channel_disable_threshold_db" },
12931296
{ "audio/channel_disable_time", "audio/buses/channel_disable_time" },
12941297
{ "audio/default_bus_layout", "audio/buses/default_bus_layout" },
@@ -1298,6 +1301,10 @@ const char *RenamesMap3To4::project_settings_renames[][2] = {
12981301
{ "audio/output_latency", "audio/driver/output_latency" },
12991302
{ "audio/output_latency.web", "audio/driver/output_latency.web" },
13001303
{ "audio/video_delay_compensation_ms", "audio/video/video_delay_compensation_ms" },
1304+
{ "display/window/size/width", "display/window/size/viewport_width" },
1305+
{ "display/window/size/height", "display/window/size/viewport_height" },
1306+
{ "display/window/size/test_width", "display/window/size/window_width_override" },
1307+
{ "display/window/size/test_height", "display/window/size/window_height_override" },
13011308
{ "display/window/vsync/use_vsync", "display/window/vsync/vsync_mode" },
13021309
{ "editor/main_run_args", "editor/run/main_run_args" },
13031310
{ "gui/common/swap_ok_cancel", "gui/common/swap_cancel_ok" },
@@ -1325,10 +1332,52 @@ const char *RenamesMap3To4::project_settings_renames[][2] = {
13251332
{ "rendering/quality/shadow_atlas/size.mobile", "rendering/lights_and_shadows/shadow_atlas/size.mobile" },
13261333
{ "rendering/vram_compression/import_etc2", "rendering/textures/vram_compression/import_etc2_astc" },
13271334
{ "rendering/vram_compression/import_s3tc", "rendering/textures/vram_compression/import_s3tc_bptc" },
1335+
1336+
{ nullptr, nullptr },
1337+
};
1338+
1339+
const char *RenamesMap3To4::project_godot_renames[][2] = {
1340+
// Should be kept in sync with project_settings_renames.
1341+
{ "channel_disable_threshold_db", "buses/channel_disable_threshold_db" },
1342+
{ "channel_disable_time", "buses/channel_disable_time" },
1343+
{ "default_bus_layout", "buses/default_bus_layout" },
1344+
// { "driver", "driver/driver" }, -- Risk of conflicts.
1345+
{ "enable_audio_input", "driver/enable_input" },
1346+
// { "mix_rate", "driver/mix_rate" }, -- Risk of conflicts.
1347+
{ "output_latency", "driver/output_latency" },
1348+
{ "output_latency.web", "driver/output_latency.web" },
1349+
{ "video_delay_compensation_ms", "video/video_delay_compensation_ms" },
13281350
{ "window/size/width", "window/size/viewport_width" },
13291351
{ "window/size/height", "window/size/viewport_height" },
13301352
{ "window/size/test_width", "window/size/window_width_override" },
13311353
{ "window/size/test_height", "window/size/window_height_override" },
1354+
{ "window/vsync/use_vsync", "window/vsync/vsync_mode" },
1355+
{ "main_run_args", "run/main_run_args" },
1356+
{ "common/swap_ok_cancel", "common/swap_cancel_ok" },
1357+
{ "limits/debugger_stdout/max_chars_per_second", "limits/debugger/max_chars_per_second" },
1358+
{ "limits/debugger_stdout/max_errors_per_second", "limits/debugger/max_errors_per_second" },
1359+
{ "limits/debugger_stdout/max_messages_per_frame", "limits/debugger/max_queued_messages" },
1360+
{ "limits/debugger_stdout/max_warnings_per_second", "limits/debugger/max_warnings_per_second" },
1361+
{ "ssl/certificates", "tls/certificate_bundle_override" },
1362+
{ "2d/thread_model", "2d/run_on_thread" }, // TODO: Not sure.
1363+
{ "environment/default_clear_color", "environment/defaults/default_clear_color" },
1364+
{ "environment/default_environment", "environment/defaults/default_environment" },
1365+
{ "quality/depth_prepass/disable_for_vendors", "driver/depth_prepass/disable_for_vendors" },
1366+
{ "quality/depth_prepass/enable", "driver/depth_prepass/enable" },
1367+
{ "quality/shading/force_blinn_over_ggx", "shading/overrides/force_blinn_over_ggx" },
1368+
{ "quality/shading/force_blinn_over_ggx.mobile", "shading/overrides/force_blinn_over_ggx.mobile" },
1369+
{ "quality/shading/force_lambert_over_burley", "shading/overrides/force_lambert_over_burley" },
1370+
{ "quality/shading/force_lambert_over_burley.mobile", "shading/overrides/force_lambert_over_burley.mobile" },
1371+
{ "quality/shading/force_vertex_shading", "shading/overrides/force_vertex_shading" },
1372+
{ "quality/shading/force_vertex_shading.mobile", "shading/overrides/force_vertex_shading.mobile" },
1373+
{ "quality/shadow_atlas/quadrant_0_subdiv", "lights_and_shadows/shadow_atlas/quadrant_0_subdiv" },
1374+
{ "quality/shadow_atlas/quadrant_1_subdiv", "lights_and_shadows/shadow_atlas/quadrant_1_subdiv" },
1375+
{ "quality/shadow_atlas/quadrant_2_subdiv", "lights_and_shadows/shadow_atlas/quadrant_2_subdiv" },
1376+
{ "quality/shadow_atlas/quadrant_3_subdiv", "lights_and_shadows/shadow_atlas/quadrant_3_subdiv" },
1377+
{ "quality/shadow_atlas/size", "lights_and_shadows/shadow_atlas/size" },
1378+
{ "quality/shadow_atlas/size.mobile", "lights_and_shadows/shadow_atlas/size.mobile" },
1379+
{ "vram_compression/import_etc2", "textures/vram_compression/import_etc2_astc" },
1380+
{ "vram_compression/import_s3tc", "textures/vram_compression/import_s3tc_bptc" },
13321381

13331382
{ nullptr, nullptr },
13341383
};

editor/renames_map_3_to_4.h

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct RenamesMap3To4 {
4242
static const char *gdscript_signals_renames[][2];
4343
static const char *csharp_signals_renames[][2];
4444
static const char *project_settings_renames[][2];
45+
static const char *project_godot_renames[][2];
4546
static const char *input_map_renames[][2];
4647
static const char *builtin_types_renames[][2];
4748
static const char *shaders_renames[][2];

0 commit comments

Comments
 (0)