I wrote a tool (Python function, not scripted plugin) that assigns vert colors via the API, through MFnMesh.setVertexColor(). Works great, really fast. Problem is, it won't undo. Unless I'm missing something, I've deduced that when API calls modify the DG (add\delete nodes\connections, color verts, etc) unless they're authored via a scripted plugin supporting undo (via MDGModifier), you can't undo them. If anyone has a workaround for /that/, I'd love to hear it. But I digress...
So I went about re-authoring this function as a scripted plugin so I can support undo. However, it's still not undoing... properly. It "sort of undo's", more on that below. Other scripted plugins I've written that use the functionality of the methods on a MDGModifier (create, rename, delete, etc), I can get them to undo just fine: http://download.autodesk.com/us/maya/2010help/API/class_m_d_g_modifier.html But the MDGModifier has nothing for setting vert colors, that's where MFnMesh comes in obviously. MFnMesh has a setVertexColors() method: http://download.autodesk.com/us/maya/2010help/API/class_m_fn_mesh.html#7226f44a9d5d14689a8f1f7c822d6d0f It can optionally take a MDGModifier reference. But if I pass one in or not seems to have no effect on the undo operation: No undo whatsoever. So as a workaround, I've gone about authoring code that will remember the previous vert colors & store them (during redoIt()), so that when the command is undone (and the undoIt() method is called), that state is restored. And it works... sort of. The first time yes, but after that it gets pretty hairy. Any thoughts on this? Anyone been successful at passing a MDGModifier reference to a MFnMesh.serVertexColors() method and getting undo to properly work? thanks -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
