I wrote some API code that I have been testing in the script editor:
It is suppose to separate the first 10 polygons of a 10*10 plane.
import maya.OpenMaya as OpenMaya
selection = OpenMaya.MSelectionList()
OpenMaya.MGlobal.getActiveSelectionList( selection )
dagPath = OpenMaya.MDagPath()
component = OpenMaya.MObject()
iter = OpenMaya.MItSelectionList( selection )
iter.getDagPath( dagPath, component )
meshFn = OpenMaya.MFnMesh( dagPath )
trans = OpenMaya.MFloatVector()
faces = OpenMaya.MIntArray()
for i in range (10):
faces.append(i)
meshFn.extractFaces( faces, trans )
meshFn.updateSurface()
After executing the code the 10 faces show up in Polygons->Border Edges which is expected.
If I try to separate the polygons using Mesh->Separate it does not work.
If you try to move the separated faces, Maya freaks out in the view port (That is the technical term).
For it to work I have to delete history on the plane then use Mesh->Separate. Don't think I should have to delete history for it to work. ( I am assuming separate command is heavily involved in MFnMesh since their is no function for separate).
I notice strange results from a couple other functions like duplicateFaces.
Thanks in advance,
-Brian