Start a new topic

mgEditorAddUndo in script

Original Post by: lambo75 Mon Aug 12 10:35:24 2013


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.


Original Post by: SteveThompson Mon Aug 12 16:22:36 2013


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

Original Post by: lambo75 Tue Aug 13 06:46:56 2013


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.


Thanks again.

Original Post by: SteveThompson Tue Aug 13 13:08:29 2013


Glad you got it going. Happy Scripting ;)

Login to post a comment