Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Exclude sets of nodes from cached playback Maya 2022 and higher

2 REPLIES 2
Reply
Message 1 of 3
brent8S64J
178 Views, 2 Replies

Exclude sets of nodes from cached playback Maya 2022 and higher

Does anyone know of a way to exclude sets of nodes from cached playback?  I'm trying to add support for a suite of tools for Maya 2022 and higher, and I'll need to either have frame caching off by default for the whole project, or find a way to have frame caching ignore given sets of nodes.  I'd like to leave the option open to the animators to use Frame Caching if possible, has anyone experimented with this?

 

- Many thanks

2 REPLIES 2
Message 2 of 3
Kahylan
in reply to: brent8S64J

Hi!

 

I looked into this a while back, when I wanted to see if I could exclude a specific dynamic part of my rig from cached playback.

 

The command cmds.cacheEvaluator seems to allow the exclusion of specific nodes by using the Built-in Action "disableEvaluationCache" but the problem with this command is, that the Built-in filters are very limited.

 

I found this documentation:

https://download.autodesk.com/us/company/files/MayaCachedPlayback/2022/MayaCachedPlaybackWhitePaper....

 

Which seems to imply that you can use the API Class "MPxCacheConfigRuleFilter" to create custom filters for the command. But sadly I could not find any examples of this class being used and no documentation on it outside of the C++ API, which I'm not familiar with.

So that was where I decided that for my purposes it wasn't worth looking into this any further, and I just created a read me that told animators to just have cached Playback turned off when animating the dynamic parts.

 

I still thought I'd mention it, maybe this is a good starting point for you. If you find a solution, I would be thrilled to hear how you achieved it.

 

I hope it helps!

 

Message 3 of 3
brent8S64J
in reply to: brent8S64J

I've got to put a pin in this for now because I don't know C++ yet.  Here's how far I've gotten with the help of AI and the docs - seems like there's a way to do it - the key, as usual, is to believe in ourselves.

import maya.OpenMayaMPx as OpenMayaMPx  
import maya.api.OpenMaya as OpenMaya  
import maya.cmds 
import timeFilter

"""
# something in this??
import maya.plugin.evaluator.CacheEvaluatorManager
maya.plugin.evaluator.CacheEvaluatorManager.CACHE_STANDARD_MODE_EVAL.insert(0, CacheConfigRuleFilter)
maya.plugin.evaluator.CacheEvaluatorManager.TODO()
dir(maya.plugin.evaluator.CacheEvaluatorManager)
"""

class CacheConfigRuleFilter(OpenMayaMPx.MPxCacheConfigRuleFilter):
    def __init__(self):
        super(CacheConfigRuleFilter, self).__init__()

    def isMatch(self, evalNode):
        # Check if the node is connected to a node called "timeFilter"
        if timeFilter.IsFiltered("evalNode"):
            return True
        return False

cmds.cacheEvaluator("pCube1", query=True, cacheName="evaluation")

       
def registerCustomFilter():
    # Create an instance of the custom caching rule filter
    customFilter = CacheConfigRuleFilter()
    # Register the custom filter with the cache configuration system
    # registry = OpenMaya.MCacheConfigRuleRegistry.getInstance() <- No
    # registry.addCustomRuleFilter(customFilter) < - ??
    # registry.registerFilter("custom", customFilter)

    
    
def applyCustomCacheConfigRuleFilter():
    # Apply the custom filter using cmds.cacheEvaluator command
    maya.cmds.cacheEvaluator(
        newFilter='custom',
        newFilterParam='',
        newAction='disableEvaluationCache'
    )

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report