Alembic: fixed refcount issue when duplicating imported objects
Duplicating an imported object didn't increment the cache reader's refcount, whereas removing the duplicate did decrement it. This caused problems.
This commit is contained in:
parent
ff1f115706
commit
20621d46d1
@ -121,6 +121,7 @@ struct DerivedMesh *ABC_read_mesh(struct CacheReader *reader,
|
||||
const char **err_str,
|
||||
int flags);
|
||||
|
||||
void CacheReader_incref(struct CacheReader *reader);
|
||||
void CacheReader_free(struct CacheReader *reader);
|
||||
|
||||
struct CacheReader *CacheReader_open_alembic_object(struct AbcArchiveHandle *handle,
|
||||
|
@ -370,4 +370,5 @@ void AbcObjectReader::incref()
|
||||
void AbcObjectReader::decref()
|
||||
{
|
||||
--m_refcount;
|
||||
BLI_assert(m_refcount >= 0);
|
||||
}
|
||||
|
@ -980,6 +980,12 @@ void CacheReader_free(CacheReader *reader)
|
||||
}
|
||||
}
|
||||
|
||||
void CacheReader_incref(CacheReader *reader)
|
||||
{
|
||||
AbcObjectReader *abc_reader = reinterpret_cast<AbcObjectReader *>(reader);
|
||||
abc_reader->incref();
|
||||
}
|
||||
|
||||
CacheReader *CacheReader_open_alembic_object(AbcArchiveHandle *handle, CacheReader *reader, Object *object, const char *object_path)
|
||||
{
|
||||
if (object_path[0] == '\0') {
|
||||
|
@ -4386,6 +4386,12 @@ static void transformcache_copy(bConstraint *con, bConstraint *srccon)
|
||||
|
||||
BLI_strncpy(dst->object_path, src->object_path, sizeof(dst->object_path));
|
||||
dst->cache_file = src->cache_file;
|
||||
|
||||
#ifdef WITH_ALEMBIC
|
||||
if (dst->reader) {
|
||||
CacheReader_incref(dst->reader);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void transformcache_free(bConstraint *con)
|
||||
|
Loading…
Reference in New Issue
Block a user