summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon MacPherson <gordon@gordonite.tech>2023-02-22 01:01:33 +0000
committerGordon MacPherson <gordon@gordonite.tech>2023-02-22 02:10:55 +0000
commit8a86d8411ee3230e0b86311477c879ac76305570 (patch)
treef84c1aff6b280185b43a131d33dd120a12443cb9
parente13fae1414b0369fdd3f51b4e3529fd3f272b0e1 (diff)
Implement automatic rename for project
- Import must rename nodes/root_type="Spatial" to "Node3D": - Resolves ownership issues with calling: scene->replace_by(base_node); when the original root type was Spatial.
-rw-r--r--editor/project_converter_3_to_4.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp
index d1f3c3902a..0e7476d045 100644
--- a/editor/project_converter_3_to_4.cpp
+++ b/editor/project_converter_3_to_4.cpp
@@ -410,6 +410,12 @@ bool ProjectConverter3To4::convert() {
rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines);
} else if (file_name.ends_with(".csproj")) {
// TODO
+ } else if (file_name.ends_with(".import")) {
+ for (int x = 0; x < lines.size(); x++) {
+ if (lines[x].contains("nodes/root_type=\"Spatial\"")) {
+ lines.set(x, "nodes/root_type=\"Node3D\"");
+ }
+ }
} else {
ERR_PRINT(file_name + " is not supported!");
continue;
@@ -636,7 +642,7 @@ Vector<String> ProjectConverter3To4::check_for_files() {
String file_name = dir->_get_next();
while (file_name != "") {
- if (file_name == ".git" || file_name == ".import" || file_name == ".godot") {
+ if (file_name == ".git" || file_name == ".godot") {
file_name = dir->_get_next();
continue;
}
@@ -644,7 +650,7 @@ Vector<String> ProjectConverter3To4::check_for_files() {
directories_to_check.append(current_dir.path_join(file_name) + "/");
} else {
bool proper_extension = false;
- if (file_name.ends_with(".gd") || file_name.ends_with(".shader") || file_name.ends_with(".gdshader") || file_name.ends_with(".tscn") || file_name.ends_with(".tres") || file_name.ends_with(".godot") || file_name.ends_with(".cs") || file_name.ends_with(".csproj"))
+ if (file_name.ends_with(".gd") || file_name.ends_with(".shader") || file_name.ends_with(".gdshader") || file_name.ends_with(".tscn") || file_name.ends_with(".tres") || file_name.ends_with(".godot") || file_name.ends_with(".cs") || file_name.ends_with(".csproj") || file_name.ends_with(".import"))
proper_extension = true;
if (proper_extension) {