[Bf-blender-cvs] [2074d26943] temp-sybren-alembic: Alembic: don't call object.getFullName() multiple times.
Sybren A. Stüvel
noreply at git.blender.org
Fri Feb 24 17:06:09 CET 2017
Commit: 2074d2694348d40e20c0f05d2e1ed43cd7d143bd
Author: Sybren A. Stüvel
Date: Thu Feb 23 10:16:37 2017 +0100
Branches: temp-sybren-alembic
https://developer.blender.org/rB2074d2694348d40e20c0f05d2e1ed43cd7d143bd
Alembic: don't call object.getFullName() multiple times.
===================================================================
M source/blender/alembic/intern/alembic_capi.cc
===================================================================
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index b95c0b2249..565867a23a 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -381,8 +381,10 @@ static int visit_object(const IObject &object,
GHash *readers_map,
ImportSettings &settings)
{
+ const char *full_name = object.getFullName().c_str();
+
if (!object.valid()) {
- std::cerr << " - " << object.getFullName() << ": object is invalid, skipping it and all its children.\n";
+ std::cerr << " - " << full_name << ": object is invalid, skipping it and all its children.\n";
return false;
}
@@ -520,15 +522,10 @@ static int visit_object(const IObject &object,
AlembicObjectPath *abc_path = static_cast<AlembicObjectPath *>(
MEM_callocN(sizeof(AlembicObjectPath), "AlembicObjectPath"));
-
- BLI_strncpy(abc_path->path, object.getFullName().c_str(), PATH_MAX);
-
+ BLI_strncpy(abc_path->path, full_name, PATH_MAX);
BLI_addtail(&settings.cache_file->object_paths, abc_path);
- /* Cast to `void *` explicitly to avoid compiler errors because it
- * is a `const char *` which the compiler cast to `const void *`
- * instead of the expected `void *`. */
- BLI_ghash_insert(readers_map, (void *)object.getFullName().c_str(), reader);
+ BLI_ghash_insert(readers_map, const_cast<char *>(full_name), reader);
}
return parent_is_part_of_this_object;
More information about the Bf-blender-cvs
mailing list