diff options
Diffstat (limited to 'source/blender/collada/MeshImporter.cpp')
-rw-r--r-- | source/blender/collada/MeshImporter.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index febfb772430..bf5a39cfae8 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -63,10 +63,9 @@ extern "C" { // 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) +static const std::string bc_get_dae_name(T *node) { - const std::string& name = node->getName(); - return name.size() ? name.c_str() : node->getOriginalId().c_str(); + return node->getName().size() ? node->getName(): node->getOriginalId(); } static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type) @@ -268,7 +267,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has su { COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives(); - const char *name = bc_get_dae_name(mesh); + const std::string &name = bc_get_dae_name(mesh); for (unsigned i = 0; i < prim_arr.getCount(); i++) { @@ -287,7 +286,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has su int count = vca[j]; if (count < 3) { fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n", - type_str, name); + type_str, name.c_str()); return false; } } @@ -305,7 +304,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has su } if (mesh->getPositions().empty()) { - fprintf(stderr, "Mesh %s has no vertices.\n", name); + fprintf(stderr, "Mesh %s has no vertices.\n", name.c_str()); return false; } @@ -1291,12 +1290,12 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom) COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh *)geom; if (!is_nice_mesh(mesh)) { - fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh)); + fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh).c_str()); return true; } const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId(); - Mesh *me = BKE_mesh_add((char *)str_geom_id.c_str()); + Mesh *me = BKE_mesh_add(G.main, (char *)str_geom_id.c_str()); me->id.us--; // is already 1 here, but will be set later in set_mesh // store the Mesh pointer to link it later with an Object |