pymel.core.system.cacheFileMerge¶
- cacheFileMerge(*args, **kwargs)¶
If selected/specified caches can be successfully merged, will return the start/end frames of the new cache followed by the start/end frames of any gaps in the merged cache for which no data should be written to file. In query mode, will return the names of geometry associated with the specified cache file nodes.
Flags:
Long Name / Short Name Argument Types Properties endTime / et time Specifies the end frame of the merge range. If not specified, will figure out range from times of caches being merged. geometry / g bool Query-only flag used to find the geometry nodes associated with the specified cache files. startTime / st time Specifies the start frame of the merge range. If not specified, will figure out range from the times of the caches being merged. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.cacheFileMerge
Example:
import pymel.core as pm # Find associated geometry nodes # geom = pm.cacheFileMerge('cache1', 'cache2' ,query=True, geometry=True) # Validate merging of caches and find out start/end times. # This will give a warning if there is a gap letting you know that # simulation data will fill the gap. # startEndTimes = pm.cacheFileMerge('cache1', 'cache2') # Result: { 0, 20, 5, 10 } start = startEndTimes[0] end = startEndTimes[1] gapStart = startEndTimes[2] gapEnd = startEndTimes[3] # Create a new merged cache, using simulation data to fill in # any gaps between cache1 and cache2. # cacheFiles = pm.cacheFile(fileName='mergedCache', startTime=start, endTime=end, points=geom[0]) switch = maya.mel.eval('createHistorySwitch("pPlaneShape1", false)'); pm.cacheFile( attachFile=True, f=cacheFiles[0], ia='%s.inp[0]' % switch) pm.setAttr( '%s.playFromCache' % switch, 1 ) # Alternatively, can use append to make sure that we interpolate # for the frames in the gap between cache1 and cache2. # cacheFiles = pm.cacheFile(fileName='mergedCache', startTime=start, endTime=gapStart, points=geom[0]) switch = maya.mel.eval('createHistorySwitch("pPlane1", false)'); pm.cacheFile( attachFile=True, f=cacheFiles[0], ia='%s.inp[0]' % switch) pm.setAttr( '%s.playFromCache' % switch, 1 ) pm.cacheFile( replaceCachedFrame=True, startTime=gapEnd, endTime=end, points=geom[0] )