diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-02-23 12:16:37 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-04-06 17:04:31 +0300 |
commit | aba7759992a8a098d6876d6da186f0635a80e7ae (patch) | |
tree | 345fba48e0a21881324fc9fe307e3eaf730188b1 /source/blender/alembic | |
parent | 2c688bac197173f8d12019811f7e4d8482e930a5 (diff) |
Alembic: don't call object.getFullName() multiple times.
Diffstat (limited to 'source/blender/alembic')
-rw-r--r-- | source/blender/alembic/intern/alembic_capi.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index ada1f5baaa8..91e1c8f9736 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -416,8 +416,10 @@ static bool 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; } @@ -513,15 +515,10 @@ static bool 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; |