Add a condition to detect duplicates objects, so cases like object-col.323, common in blender, is still detected as collision.

This commit is contained in:
Juan Linietsky 2018-07-02 02:02:32 -03:00
parent 896e250f2b
commit beebd0b9de
1 changed files with 11 additions and 3 deletions

View File

@ -224,11 +224,19 @@ String ResourceImporterScene::get_preset_name(int p_idx) const {
static bool _teststr(const String &p_what, const String &p_str) { 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; 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 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 true;
return false; return false;
} }