From beebd0b9dee16b618d15bf0f7deffa5a634dd2b1 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 2 Jul 2018 02:02:32 -0300 Subject: Add a condition to detect duplicates objects, so cases like object-col.323, common in blender, is still detected as collision. --- editor/import/resource_importer_scene.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'editor/import') diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 84a359c0bc..64e5d6fb46 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -224,11 +224,19 @@ String ResourceImporterScene::get_preset_name(int p_idx) const { static bool _teststr(const String &p_what, const String &p_str) { - if (p_what.findn("$" + p_str) != -1) //blender and other stuff + String str = p_str; + + //remove trailing spaces and numbers, some apps like blender add ".number" to duplicates so also compensate for this + while (str.length() && ((str[str.length() - 1] >= '0' && str[str.length() - 1] <= '9') || str[str.length() - 1] <= 32 || str[str.length() - 1] == '.')) { + + str = str.substr(0, str.length() - 1); + } + + if (p_what.findn("$" + str) != -1) //blender and other stuff return true; - if (p_what.to_lower().ends_with("-" + p_str)) //collada only supports "_" and "-" besides letters + if (p_what.to_lower().ends_with("-" + str)) //collada only supports "_" and "-" besides letters return true; - if (p_what.to_lower().ends_with("_" + p_str)) //collada only supports "_" and "-" besides letters + if (p_what.to_lower().ends_with("_" + str)) //collada only supports "_" and "-" besides letters return true; return false; } -- cgit v1.2.3