Re: [Maya-Python] Re: How to select with API and undo?

2018-04-09 Thread Marcus Ottosson
Hey Michael, There was a thread recently about the API and undo. - https://groups.google.com/forum/#!topic/python_inside_maya/fqX9mNfg5j0 My takeaway is that you’re exactly right; there is few (if any) ways of integrating with Maya’s undo other than implementing a command plug-in. In the thre

[Maya-Python] Re: How to select with API and undo?

2018-04-09 Thread Michael Boon
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 c

[Maya-Python] Re: How to select with API and undo?

2018-04-09 Thread justin hidair
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 =

[Maya-Python] Re: How to select with API and undo?

2018-04-08 Thread Michael Boon
So far, my best idea is to use PyMel: import pymel.core as pm pmMesh = pm.PyNode(meshFn.fullPathName()) pmFaces = pm.MeshFace(pmMesh, faceIds) pm.select(pmFaces) On Monday, 9 April 2018 15:12:03 UTC+10, Michael Boon wrote: > > It looks like the appropriate C++ function is MGlobal::selectCommand,

[Maya-Python] Re: How to select with API and undo?

2018-04-08 Thread Michael Boon
It looks like the appropriate C++ function is MGlobal::selectCommand, but that isn't available in Python. On Monday, 9 April 2018 14:32:12 UTC+10, Michael Boon wrote: > > Hi, > > If I change the selection using the API, for example: > > import maya.api.OpenMaya as om > # meshFn is a MFnMesh attac