I have written a script that modifies multiple polygon vertex normals but would like to be able to undo all the modifications if required.
Before modifying the vertex normals I store the all the vertex records and their original i, j and k values so that I can pass it to an undoModifyVertexNormals function called by mgEditorAddUndo. However, when I call the registered undo from the Edit > Undo menu nothing happens. I'm assuming that this is because when the script finished running the editorContext goes out of scope so nothing can be called. Am I right in thinking this is why the undo doesn't function and is there a way around this?
Thanks for any help you can give.
Can you please post the script so we can look at it?
The sample Creator scripts included in the OpenFlight API SDK do just this so maybe we'll get a clue if we can see your code.
Thanks for your reply Steve. I hadn't even thought of looking at the example scripts to see if this had been used (schoolboy error I know) so I now have it working. I hadn't set up the undoFunction to receive the editor context, just the undo data so, as far as the undo function was concerned, it was just receiving odd data for the editor context and no undo data at all.
Glad you got it going. Happy Scripting ;)