how about dat ? It requires a command tho .

import maya.api.OpenMaya as om


''' following the declaration of a class for a command '''

def doIt(self):
    compFn = om.MFnSingleIndexedComponent()
    compObj = compFn.create(om.MFn.kMeshPolygonComponent)
    compFn.addElements(faceIds)
    sList = om.MSelectionList()
    sList.add((meshFn.getPath(), compObj))
    om.MGlobal.setActiveSelectionList(sList)

def undoIt(self):
    #add cached previous selection
    if not len(previous_cached):
        #
        sList = om.MSelectionList()
        
        om.MGlobal.setActiveSelectionList(sList)
    else:
        #
        compFn = om.MFnSingleIndexedComponent()
        compObj = compFn.create(om.MFn.kMeshPolygonComponent)
        compFn.addElements(previous_cached)
        sList = om.MSelectionList()
        sList.add((meshFn.getPath(), compObj))
        om.MGlobal.setActiveSelectionList(sList)



-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/99efae63-0273-4a34-a2f6-781cc2751fb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to