diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-07-02 02:02:32 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-07-02 02:02:32 -0300 |
commit | beebd0b9dee16b618d15bf0f7deffa5a634dd2b1 (patch) | |
tree | d978fd30c85d079b7e995507a4f47bb632a8fd3d /editor/import | |
parent | 896e250f2bdeb972ddb7ed646716ac012ded4341 (diff) |
Add a condition to detect duplicates objects, so cases like object-col.323, common in blender, is still detected as collision.
Diffstat (limited to 'editor/import')
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
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; } |