[Python] Maya fileCache Command Problem


#1

Hello everyone,

I’m trying to create a geometry cache file using a Python script. The animation gets exported, but there’s no animation when I import it back. When I export the geometry cache, the following warning appears :

Warning: line 0: Geometry cache may be static. ‘pCubeShape1’ does not appear to have animation on its construction history or control points.

I’ve tried to export the geometry cache manually, but it didn’t work the first time until I realized that I needed to change the Store points in option to World instead of Local. Unfortunatelly, I didn’t find a way to change this option using Python.

If someone has any solution to this problem, it would be very appreciated. Here’s my code :

selecteds = cmds.ls(sl=True)
            
for selected in selecteds:
    wsShapePos = cmds.xform(selected, q=True, ws=True, t=True)
    wsShapeRot = cmds.xform(selected, q=True, ws=True, ro=True)
                
    cmds.xform(selected, ws=True, t=wsShapePos)
    cmds.xform(selected, ws=True, ro=wsShapeRot)
                
shapes = cmds.listRelatives(selecteds, s=True)
            
cacheFiles = cmds.cacheFile(f=asset.name, dir=path, points=shapes, st=1, et=120)

Thank you.

Anthony