yo,
i have this code that i need to create a curve with the api:
import maya.OpenMaya as om
positions=[(1,2,3),(0,2,3),(2,3,4),(5,2,4)]
curveFn = om.MFnNurbsCurve()
arr = om.MPointArray()
for pos in positions:
arr.append(*pos)
obj = curveFn.createWithEditPoints(
arr,
3,
om.MFnNurbsCurve.kOpen,
False,
False,
True
)
but i want to implement undo functionality. I have an example piece of template code that is setup for undo/redo but i just dont know how and where to add my curve creation code to this to make it undoable. the Dag and dg node stuff is mind blowing
here is the template code for undo/redo:
import sys
import maya.OpenMayaMPx as OpenMayaMPx
kPluginCmdName = 'myUndoableCommandName'
class MyUndoableCommand( OpenMayaMPx.MPxCommand ):
def __init__(self):
OpenMayaMPx.MPxCommand.__init__(self)
def doIt(self, args):
self.redoIt()
def redoIt(self):
pass
def undoIt(self):
pass
def isUndoable(self):
return True
if anyone could help me out id really appreciate it thanks!!,
Sam