SOLVED Checking if Cache/Deform Cache Is Dirty?

Hello! I'm having an issue with detecting whether and input object is dirty or not. For reference here is my scene file: Voronoi Fracture.c4d

My understanding is that the Random Effector is making changes to making changes to the Voronoi Fracture's Cache.

I don't understand why checking GetDirty(DIRTYFLAGS::CACHE) isn't returning dirty in this case. Is there something beyond that should be done?

The other test I was doing was browsing through the cache via GetCache(), GetDown and GetNext and checking each individual part of the Cache for it being dirty. This does correctly return whether it is dirty or not, but this really slow to me, especially for something that would be running so often.

What is the best way to reliably get if the Voronoi Fracture is dirty?

Dan

Hi,

sorry for the late reply.
Did you try using GetHDirty on the cache of the voronoi object?

If you use the Active Object plugin (from our sdk example) you can see that the voronoi object doesn't change its dirty state while every object on the cache does.
efeb136a-9098-4c70-8825-bcff87330750-image.png

I tried it and it seem to work as expected. Using GetHDirty hallow you to store only one value for the whole hierarchy.

Cheers,
Manuel

Here's the code I wrote. From what I can tell it gets the job done but it seems to get slow fast when the caches get big. Is there a better way to do this?

CompleteDirtyCheck(BaseObject* checkobject, DIRTYFLAGS flags, maxon::BaseArray<Int32>* dirtyvalues)
{
    if (checkobject == nullptr)
    {
        return ;
    }
    
    Int32 dvalue = checkobject->GetDirty(flags);
    dirtyvalues->Append(dvalue);
    BaseObject* cache = checkobject->GetCache();
    if (cache == nullptr)
    {
        return;
    }
    maxon::BaseArray<BaseObject*> caches;
    GetChildren(cache, &caches);
    Int32 childcount = caches.GetCount();
    for (Int32 x = 0; x<childcount; x++)
    {
        BaseObject* subcache = caches[x]->GetCache();
        
        CompleteDirtyCheck(subcache,flags,dirtyvalues);
        
        Int32 dirtyvalue = caches[x]->GetDirty(flags);
        dirtyvalues->Append(dirtyvalue);
        BaseObject* deformcache = caches[x]->GetDeformCache();
        if (deformcache!=nullptr)
        {
            
            Int32 dirtyvalue2 = deformcache->GetDirty(flags);
            dirtyvalues->Append(dirtyvalue2);
        }
    }
    

Hi,

sorry for the late reply.
Did you try using GetHDirty on the cache of the voronoi object?

If you use the Active Object plugin (from our sdk example) you can see that the voronoi object doesn't change its dirty state while every object on the cache does.
efeb136a-9098-4c70-8825-bcff87330750-image.png

I tried it and it seem to work as expected. Using GetHDirty hallow you to store only one value for the whole hierarchy.

Cheers,
Manuel

Thanks, that was exactly what I needed!