MUIDrawManager & Cached Playback position issue

MUIDrawManager & Cached Playback position issue

chirieacam
Enthusiast Enthusiast
443 Views
1 Reply
Message 1 of 2

MUIDrawManager & Cached Playback position issue

chirieacam
Enthusiast
Enthusiast

Hi,

 

I'm using MUIDrawManager inside MPxDrawOverride to draw shapes, lines, etc.

Everything works correctly when cached playback is off, but when it is on the drawn elements' position are not updated, they are kept at the position they were before enabling the caching.

 

What we can do to fix that? I tested all the footprints nodes and they also do not change position during cached playback.

 

 

0 Likes
Accepted solutions (1)
444 Views
1 Reply
Reply (1)
Message 2 of 2

chirieacam
Enthusiast
Enthusiast
Accepted solution

I found the fix by reading the Maya Cached Playback whitepaper. Cached playback is not enabled by default for custom locators, so we need to override getCacheSetup:

void MyNode::getCacheSetup(
    const MEvaluationNode& evalNode,
    MNodeCacheDisablingInfo& disablingInfo,
    MNodeCacheSetupInfo& cacheSetupInfo,
    MObjectArray& monitoredAttributes ) const
{
    MPxNode::getCacheSetup(evalNode, disablingInfo, cacheSetupInfo, monitoredAttributes);
    
    assert(!disablingInfo.getCacheDisabled());

    cacheSetupInfo.setPreference(MNodeCacheSetupInfo::kWantToCacheByDefault, true);
}
0 Likes