Hey @a_block ,
I finally got some time to try again, and I actually had two problems
First, I'm adding that object as a dependent because one of my modifiers need it, and it was sending a Join modeling command to read it as a single polygon. The command was invalidating the cache, entering a loop. Now I first clone it before join, and the cache flag remains intact.
Just looking at the CACHE dirty count of the object was not enough to detect if the deform cache was dirty, I need to look at it's cache dirty cache count. Sounds weird but works, and makes sense to me.
if ( distributionObject != nullptr )
{
// Check deformed cache
auto distributionObjectCache = distributionObject->GetCache( hh );
if ( distributionObjectCache != nullptr )
{
auto dirtyCount = distributionObjectCache->GetDirty( DIRTYFLAGS_CACHE );
if ( distributionObjectDirtyCount_ != dirtyCount )
{
dirty = true;
distributionObjectDirtyCount_ = dirtyCount;
}
}
}
op->AddDependence( hh, distributionObject, DIRTYFLAGS_DATA | DIRTYFLAGS_CACHE );
}