Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2011-06-20 16:43:10 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2011-06-20 16:43:10 +0400
commitd27863733710ab23749b21755be245bc7a303f12 (patch)
tree267f7098f2edc0a5df09c5383c278d4fca42593d /source/blender/collada/MeshImporter.cpp
parent81f5679ff50fde4085b92cb39f98efd8354fc5ef (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/MeshImporter.cpp')
-rw-r--r--source/blender/collada/MeshImporter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 806be14d0ed..d1977d15fb2 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -62,7 +62,7 @@ extern "C" {
#include "MeshImporter.h"
#include "collada_utils.h"
-// works for COLLADAFW::Node, COLLADAFW::Geometry
+// get node name, or fall back to original id if not present (name is optional)
template<class T>
static const char *bc_get_dae_name(T *node)
{
@@ -835,7 +835,6 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
if (*color_texture &&
strlen((*color_texture)->uvname) &&
strcmp(layername, (*color_texture)->uvname) != 0) {
-
texture_face = (MTFace*)CustomData_get_layer_named(&me->fdata, CD_MTFACE,
(*color_texture)->uvname);
strcpy(layername, (*color_texture)->uvname);
@@ -905,7 +904,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
uid_object_map[*geom_uid] = ob;
// name Object
- const std::string& id = node->getOriginalId();
+ const std::string& id = node->getName().size() ? node->getName() : node->getOriginalId();
if (id.length())
rename_id(&ob->id, (char*)id.c_str());
@@ -917,6 +916,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
if (old_mesh->id.us == 0) free_libblock(&G.main->mesh, old_mesh);
char layername[100];
+ layername[0] = '\0';
MTFace *texture_face = NULL;
MTex *color_texture = NULL;
@@ -959,7 +959,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
return true;
}
- const std::string& str_geom_id = mesh->getOriginalId();
+ const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId();
Mesh *me = add_mesh((char*)str_geom_id.c_str());
// store the Mesh pointer to link it later with an Object