diff options
Diffstat (limited to 'editor/project_converter_3_to_4.cpp')
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 6abf0ccacc..e4b6ef23b5 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -165,6 +165,7 @@ public: LocalVector<RegEx *> gdscript_signals_regexes; LocalVector<RegEx *> shaders_regexes; LocalVector<RegEx *> builtin_types_regexes; + LocalVector<RegEx *> theme_override_regexes; LocalVector<RegEx *> csharp_function_regexes; LocalVector<RegEx *> csharp_properties_regexes; LocalVector<RegEx *> csharp_signal_regexes; @@ -208,6 +209,10 @@ public: for (unsigned int current_index = 0; RenamesMap3To4::builtin_types_renames[current_index][0]; current_index++) { builtin_types_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::builtin_types_renames[current_index][0] + "\\b"))); } + // Theme overrides. + for (unsigned int current_index = 0; RenamesMap3To4::theme_override_renames[current_index][0]; current_index++) { + theme_override_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::theme_override_renames[current_index][0] + "\\b"))); + } // CSharp function renames. for (unsigned int current_index = 0; RenamesMap3To4::csharp_function_renames[current_index][0]; current_index++) { csharp_function_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::csharp_function_renames[current_index][0] + "\\b"))); @@ -282,6 +287,9 @@ public: for (RegEx *regex : builtin_types_regexes) { memdelete(regex); } + for (RegEx *regex : theme_override_regexes) { + memdelete(regex); + } for (RegEx *regex : csharp_function_regexes) { memdelete(regex); } @@ -387,6 +395,7 @@ bool ProjectConverter3To4::convert() { rename_common(RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, source_lines); rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, source_lines); rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, source_lines); + rename_common(RenamesMap3To4::theme_override_renames, reg_container.theme_override_regexes, source_lines); custom_rename(source_lines, "\\.shader", ".gdshader"); } else if (file_name.ends_with(".tscn")) { @@ -404,6 +413,7 @@ bool ProjectConverter3To4::convert() { rename_common(RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, source_lines); rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, source_lines); rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, source_lines); + rename_common(RenamesMap3To4::theme_override_renames, reg_container.theme_override_regexes, source_lines); custom_rename(source_lines, "\\.shader", ".gdshader"); } else if (file_name.ends_with(".cs")) { // TODO, C# should use different methods. @@ -566,6 +576,7 @@ bool ProjectConverter3To4::validate_conversion() { changed_elements.append_array(check_for_rename_common(RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines)); changed_elements.append_array(check_for_rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines)); changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::theme_override_renames, reg_container.theme_override_regexes, lines)); changed_elements.append_array(check_for_custom_rename(lines, "\\.shader", ".gdshader")); } else if (file_name.ends_with(".tscn")) { @@ -583,6 +594,7 @@ bool ProjectConverter3To4::validate_conversion() { changed_elements.append_array(check_for_rename_common(RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines)); changed_elements.append_array(check_for_rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines)); changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::theme_override_renames, reg_container.theme_override_regexes, lines)); changed_elements.append_array(check_for_custom_rename(lines, "\\.shader", ".gdshader")); } else if (file_name.ends_with(".cs")) { @@ -768,6 +780,8 @@ bool ProjectConverter3To4::test_conversion(RegExContainer ®_container) { valid = valid && test_conversion_basic("Transform", "Transform3D", RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, "builtin type"); + valid = valid && test_conversion_basic("custom_constants/margin_right", "theme_override_constants/margin_right", RenamesMap3To4::theme_override_renames, reg_container.theme_override_regexes, "theme overrides"); + // Custom Renames. valid = valid && test_conversion_with_regex("(Connect(A,B,C,D,E,F,G) != OK):", "(Connect(A, new Callable(B, C), D, E, F, G) != OK):", &ProjectConverter3To4::rename_csharp_functions, "custom rename csharp", reg_container); |