From 470083caed3c4d806425027863bce0b61278976a Mon Sep 17 00:00:00 2001 From: Martin Capitanio Date: Wed, 5 Jul 2023 06:32:47 +0200 Subject: [PATCH] Fix import hints that are followed by dot.number. Fixes #78881. --- doc/classes/String.xml | 2 +- doc/classes/StringName.xml | 2 +- editor/import/resource_importer_scene.cpp | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/classes/String.xml b/doc/classes/String.xml index ac571e20bb2..0e4964d0240 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -1054,7 +1054,7 @@ - Returns a copy of the string with all characters that are not allowed in [member Node.name] removed ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]). + Returns a copy of the string with all characters that are not allowed in [member Node.name] ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]) replaced with underscores. diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml index 557f94b84a5..c78039dd349 100644 --- a/doc/classes/StringName.xml +++ b/doc/classes/StringName.xml @@ -961,7 +961,7 @@ - Returns a copy of the string with all characters that are not allowed in [member Node.name] removed ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]). + Returns a copy of the string with all characters that are not allowed in [member Node.name] ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]) replaced with underscores. diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 15bb504d8d4..1b519e6cb1b 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -312,8 +312,9 @@ String ResourceImporterScene::get_preset_name(int p_idx) const { static bool _teststr(const String &p_what, const String &p_str) { String what = p_what; - //remove trailing spaces and numbers, some apps like blender add ".number" to duplicates so also compensate for this - while (what.length() && (is_digit(what[what.length() - 1]) || what[what.length() - 1] <= 32 || what[what.length() - 1] == '.')) { + // Remove trailing spaces and numbers, some apps like blender add ".number" to duplicates + // (dot is replaced with _ as invalid character) so also compensate for this. + while (what.length() && (is_digit(what[what.length() - 1]) || what[what.length() - 1] <= 32 || what[what.length() - 1] == '_')) { what = what.substr(0, what.length() - 1); } @@ -332,8 +333,9 @@ static bool _teststr(const String &p_what, const String &p_str) { static String _fixstr(const String &p_what, const String &p_str) { String what = p_what; - //remove trailing spaces and numbers, some apps like blender add ".number" to duplicates so also compensate for this - while (what.length() && (is_digit(what[what.length() - 1]) || what[what.length() - 1] <= 32 || what[what.length() - 1] == '.')) { + // Remove trailing spaces and numbers, some apps like blender add ".number" to duplicates + // (dot is replaced with _ as invalid character) so also compensate for this. + while (what.length() && (is_digit(what[what.length() - 1]) || what[what.length() - 1] <= 32 || what[what.length() - 1] == '_')) { what = what.substr(0, what.length() - 1); }