MeshCache is a Maya node used to cache polygon's (mesh) points during an animation playback.
It is based on a thing that Maya does not evaluate data when it is not required.
When you cache a geometry the node saves points' position at frames and then loads them ignoring an evaluation graph of the geometry.
* Plug-in files
meshCache.py the plug-in itself.
meshCache_script.py user's GUI and additional helpful functions.
meshCache_script_2019.py for Maya 2019 (no practice usage, just testing)
meshCache_documentation.html help.
* Install
Just do these simple three steps:
1. Load meshCache.py as a plug-in (through Plug-in Manager) or run the following MEL command:
1 |
loadPlugin "meshCache.py"; // check the correct path to the plug-in
|
2. Load meshCache_script.py.
Python:
1 |
execfile("d:/scripts/meshCache_script.py") # use the correct path to the script
|
MEL:
1 |
python("execfile('d:/scripts/meshCache_script.py')") // the same thing
|
3. Next command adds 'Magic button' on your currently active shelf tab (so if you change the tab and run the command again, you will get another 'Magic button').
1 |
meshCache_install()
|
Once the 'Magic button' is added you should do the first two steps only.
Add the following lines to your userSetup.py to do those steps automatically when Maya loads:
1 2 3 4 5 6 |
import maya.cmds as cmds import sys sys.path.append(PATH_TO_MESHCACHE) # add a directory which contains meshCache files cmds.loadPlugin("meshCache.py") # then load scripts execfile("meshCache_script.py") |
MeshCache node is a general Maya node and it is saved in a scene as usual. If you open that scene without meshCache plug-in you get an error. If you work as an animator, I recommend you remove all meshCache nodes (use GUI button 'Remove all' or the same in 'Magic button' menu) in the final scene to be sure that everybody can open the scene without problems.
You can also set up your Ctrl-S hotkey to save the scene without meshCache nodes.
1 2 3 |
# python function that removes all meshCache nodes, # saves current scene and then restores the removed nodes. meshCache_saveScene() |
This is a bit tricky, but it works quite fine. Anyway this is a common thing if you use custom plug-ins.
* Node attributes
inputMesh input polygon geometry to be cached.
time should be connected to time1.outTime to obtain current frame.
state when off do nothing and return an input geometry.
autoCache when on force write cache at given time (frame).
outputMesh output geometry
* GUI
Description of the parameters of MeshCache GUI.
Geo filter geometry nodes (transforms) or a pattern to filter.
Hide filter nodes (transforms) to be hidden while you are in read cache mode, when the next flag is off.
Use isolateSelect isolate geometry specified with 'geo filter' while in read cache mode.
Set just save current settings.
Make make meshCache node per a geometry in a 'geo filter' list.
Remove All remove all meshCache nodes from the scene and do some cleanup.
Both 'geo filter 'hide filter' can be any 'ls' patterns separated with a space.
'Hide filter' and 'use isolateSelect' are used to hide unnecessary stuff and do not provoke Maya to evaluate graph while you are in read cache mode ('Magic button' is green).
'Hide filter' should contain groups with controls and rigs.
If your characters have the same structure I recommend you fill 'hide filter' to have another additional geometry visibile while you are in read cache mode. Otherwise 'use isolateSelect' is preferred method.
* Magic button
There are three states of this magic:
- grey is a disabled state.
You do not cache anything.
- red is a write cache mode state.
Each frame you visit is cached. So this is a rewrite old cache mode too.
- green is a read cache mode state.
When there is a cache found at a current frame then just read it. When there are no cache found then compute a geometry as usual.
Menu items of the button:
- MeshCache UI.
User's interface.
- Disable All.
Just disable all meshCache nodes.
- Remove All.
Remove all the nodes from the scene and disable MeshCache system.
- Install Ctrl-S hotkey.
This sets up Ctrl-S hotkey to meshCache_saveScene function.
As long as your scene contains a new node (meshCache) you should be sure that everybody can open it without problems.
So when you press Ctrl-S to save the scene, meshCache_saveScene temporary removes all meshCache nodes and then restores them again just after the save.
- Restore Ctrl-S hotkey.
This restores the default state of Ctrl-S hotkey (NameComSave_File command).
Feedback is welcome!
Please use the Feature Requests to give me ideas.
Please use the Support Forum if you have any questions or problems.
Please rate and review in the Review section.