Convert GPU cache back to mesh?

3,010 views
Skip to first unread message

AK Eric

unread,
Oct 29, 2015, 4:34:45 PM10/29/15
to Python Programming for Autodesk Maya
Just exported some high-res scan mesh via the GPU Cache menu, then had a modeler import that back into their scene as a GPU cache for modeling reference.

They moved it in worldspace, and now want to to 'turn it back into normal (editable) mesh' at that new location.  I figured this would be a no-brainer, but I can't find any menu to do this.  

Am I missing something? :)

thanks

Roy Nieterau

unread,
Oct 29, 2015, 6:03:46 PM10/29/15
to Python Programming for Autodesk Maya
I don't think that's a one-button thing.

Try this:

import maya.cmds as mc

# Get selected leaf shapes (so we can filter to gpuCaches)
selShapes
= mc.ls(sl=1, dag=1, leaf=1, shapes=1, long=True)

# Filter to gpuCache (doesn't work as one-liner above)
gpuCacheShapes
= mc.ls(selShapes, long=True, type='gpuCache')

for gpuCacheShape in gpuCacheShapes:
    transform
= mc.listRelatives(gpuCacheShape, parent=True, fullPath=True)[0]
    filepath
= mc.getAttr(gpuCacheShape + '.cacheFileName')
   
   
# Import everything from filepath and reparent under the transform
    mc
.AbcImport(filepath, mode="import", reparent=transform)
   
   
# Hide the original gpuCache shape?
    mc
.setAttr(gpuCacheShape + '.visibility', 0)
   
   
#(Or delete it?)
   
#mc.delete(gpuCacheShape)

AK Eric

unread,
Oct 29, 2015, 9:15:15 PM10/29/15
to Python Programming for Autodesk Maya
That's great, thanks Roy:  Ironically I found a script someone here at work wrote that basically did the same thing ;)

sib...@gmail.com

unread,
Mar 10, 2019, 3:02:40 PM3/10/19
to Python Programming for Autodesk Maya
Awesome. Thank you
Reply all
Reply to author
Forward
0 new messages