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 ../../../_images/create.gif
 

Specifies the end frame of the merge range. If not specified, will figure out range from times of caches being merged.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

geometry (g) bool ../../../_images/query.gif
 
Query-only flag used to find the geometry nodes associated with the specified cache files.
startTime (st) time ../../../_images/create.gif
 
Specifies the start frame of the merge range. If not specified, will figure out range from the times of the caches being merged.

Derived from mel command maya.cmds.cacheFileMerge

Example:

import pymel.core as pm

import maya.cmds as cmds

# 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] )

Previous topic

pymel.core.system.cacheFileCombine

Next topic

pymel.core.system.cacheFileTrack

Core

Core Modules

Other Modules

This Page