diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2011-06-20 16:43:10 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2011-06-20 16:43:10 +0400 |
commit | d27863733710ab23749b21755be245bc7a303f12 (patch) | |
tree | 267f7098f2edc0a5df09c5383c278d4fca42593d /source/blender/collada/DocumentImporter.cpp | |
parent | 81f5679ff50fde4085b92cb39f98efd8354fc5ef (diff) |
Fix [#26912] [Collada] Screw up with names/ids on import
Reported by Valeriy Firsov
Use the node name if it exists, fall back to id otherwise.
Diffstat (limited to 'source/blender/collada/DocumentImporter.cpp')
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 0502102f7c4..78ee444bb4e 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -441,7 +441,8 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren // check if object is not NULL if (!ob) return; - rename_id(&ob->id, (char*)node->getOriginalId().c_str()); + std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId(); + rename_id(&ob->id, (char*)nodename.c_str()); object_map[node->getUniqueId()] = ob; node_map[node->getUniqueId()] = node; @@ -523,7 +524,7 @@ bool DocumentImporter::writeMaterial( const COLLADAFW::Material* cmat ) if(mImportStage!=General) return true; - const std::string& str_mat_id = cmat->getOriginalId(); + const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId(); Material *ma = add_material((char*)str_mat_id.c_str()); this->uid_effect_map[cmat->getInstantiatedEffect()] = ma; |