Maya Programming - gpuCache Import and Export using Python


Hello! I’m hoping I can get some help with some understanding on gpuCache import and export via python.

Is there a python equivalent to gpuCache export and import in MEL? I’ve seen the MEL version and how it works, but I would like to achieve the same effect with a python script. Is this possible? I’ve looked up on other forums but information seems either sparse or poorly explained from what I’ve seen. I’m still pretty fresh to using python inside of Maya so I may just need to improve my understanding some also.

I’m simply trying to create two methods- one that exports an object, and another that imports via python.

Thanks so much for all the help!


Maya python commands are generated based on mel commands. Basically the mel flags become keyword arguments and mel values become python arguments.


gpuCache -startTime 1 -endTime 24 -optimize -optimizationThreshold 40000 -writeMaterials -dataFormat ogawa -directory “dir_path” -fileName “file_name” “object_to_export”


cmds.gpuCache(“object_to_export”, startTime=1, endTime=24, fileName=‘file_name’, directory=‘dir_path’)