Message 1 of 9
Undo and redo heeelllp ;(

Not applicable
12-27-2015
05:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i have some api code that creates a curve:
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.
here is the template code for undo/redo:
# sampleUndoableCommand.py 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