Cleanup: Alembic, deduplicate CacheObjectPath creation
No functionnal changes.
This commit is contained in:
@@ -87,6 +87,16 @@ BLI_INLINE CacheArchiveHandle *handle_from_archive(ArchiveReader *archive)
|
||||
return reinterpret_cast<CacheArchiveHandle *>(archive);
|
||||
}
|
||||
|
||||
/* Add the object's path to list of object paths. No duplication is done, callers are
|
||||
* responsible for ensuring that only unique paths are added to the list.
|
||||
*/
|
||||
static void add_object_path(ListBase *object_paths, const IObject &object)
|
||||
{
|
||||
CacheObjectPath *abc_path = MEM_cnew<CacheObjectPath>("CacheObjectPath");
|
||||
BLI_strncpy(abc_path->path, object.getFullName().c_str(), sizeof(abc_path->path));
|
||||
BLI_addtail(object_paths, abc_path);
|
||||
}
|
||||
|
||||
//#define USE_NURBS
|
||||
|
||||
/* NOTE: this function is similar to visit_objects below, need to keep them in
|
||||
@@ -134,10 +144,7 @@ static bool gather_objects_paths(const IObject &object, ListBase *object_paths)
|
||||
}
|
||||
|
||||
if (get_path) {
|
||||
CacheObjectPath *abc_path = MEM_cnew<CacheObjectPath>("CacheObjectPath");
|
||||
|
||||
BLI_strncpy(abc_path->path, object.getFullName().c_str(), sizeof(abc_path->path));
|
||||
BLI_addtail(object_paths, abc_path);
|
||||
add_object_path(object_paths, object);
|
||||
}
|
||||
|
||||
return parent_is_part_of_this_object;
|
||||
@@ -357,9 +364,7 @@ static std::pair<bool, AbcObjectReader *> visit_object(
|
||||
readers.push_back(reader);
|
||||
reader->incref();
|
||||
|
||||
CacheObjectPath *abc_path = MEM_cnew<CacheObjectPath>("CacheObjectPath");
|
||||
BLI_strncpy(abc_path->path, full_name.c_str(), sizeof(abc_path->path));
|
||||
BLI_addtail(&settings.cache_file->object_paths, abc_path);
|
||||
add_object_path(&settings.cache_file->object_paths, object);
|
||||
|
||||
/* We can now assign this reader as parent for our children. */
|
||||
if (nonclaiming_child_readers.size() + assign_as_parent.size() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user