Yeah I was worried that might be the only way to do it without PyMel or cmds. I imagine there are cases where the PyMel solution would be slow enough to warrant writing a plugin command like that.
On Tuesday, 10 April 2018 02:52:45 UTC+10, justin hidair wrote: > > 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/571f4266-faf2-4990-9cd2-c58384bd9646%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.