Hi everyone. I’ve been trying to create a tool that would help simplify caching pipeline in our studio using geometry cache. When trying to apply the cache, if I select the mesh manually and do ‘Import Cache…’ from menu, it works. However I cannot get my script to do it. Been pulling my hairs off for a week would greatly appreciate help
I created cache with ‘1 file per frame’ mode so the xml contains many channels along with the namespace. Here’s 2 of the channels from the XML.
Then I reference the same character with namespace cache000. I assume I need to supply the command with list matching the destination and channel name? I tried something like this but keep getting error.
geoList = [
'cache000:shirt_ply',
'cache000:shirt_ply'
]
cacheList = [
'exFemaleHair006:shirt_plyShape',
'exFemaleHair006:skirt_plyShape'
]
xml = path_to_xml_file
pc.mel.doImportCacheFile(xml, 'mcx', geoList, cacheList)
// Error: line 0: Channel exFemaleHair006:shirt_plyShape was not found. //
// Error: line 0: Channel exFemaleHair006:skirt_plyShape was not found. //
Can someone help point me to the right direction please? Thank you.
Thank you for your suggestion DW. I can’t get doImportCacheFile to work still no matter how I try.
I eventually got the cache working by generating cache separately per geometry and use pymel command cacheFile. However the warning is still there. Am I doing something wrong?
This is what my overall code is for our cache import tool
import maya.cmds as mc
import maya.mel as mel
switch = mel.eval('createHistorySwitch("' + each + '",false);')
cacheNode = mc.cacheFile(f=(targFolder + transformNoNamespace + ".xml"), ia='%s.inp[0]' % switch , attachFile=True)
mc.connectAttr((cacheNode + ".inRange") , (switch + ".playFromCache") , force=True)
f= targFolder + transformNoNamespace + “.xml” —> is basically the path to the xml file. In my case, it’s building it with the names of scene selected geo. each —> Shape nodes. Looping through scene selected geo with mc.ls(sl=True, dag=True, leaf=True, ni= True, long= True)