Re: Modeller 3D plugin
I tried it again: start with the default cube. Select a corner and drag it a little outside. Undo (either the button or ctrl+Z). It does revert but the undo button should be greyed out now (nothing left to undo). Clicking undo acts like a redo, once undo again works. From that moment on multiple undo's seems to change the coordinates slightly. Repeats do the same.That doesn't sound right. I only ran a few quick (superficial) tests before publishing, and it seemed to work.With a single change ctrl+Z should revert that last change. Since there was only one change pressing ctrl+Z again should do nothing, but it executes some weird other changes and never reverts to the original.
I tried it again just now and didn't notice any issues.
Please give me a way to reproduce the problem.
That shouldn't keep you from "reviewing" the undo/redo code. It keeps the overall code for Sweet Home 3D the same where possible. It's also a good way to learn how a professional did it. You have to look for when the status of the model is stored to the queue. From there you can follow how that is done. Same for the redo. You can learn a lot from this.You're right. The main difference is that TerrenGenerator was created by a professional (Emmanuel), while this one was made by someone with no training in the field (I'm not a programmer).Look at the Terrain Generator where the arrows at the top execute undo/redo.
Code: Select all
import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoManager;
import javax.swing.undo.UndoableEditSupport;
line 431 // Manage local undo / redo actions with a separated undo manager
line 770 [i]elevationsUndoSupport[/i]: investigate and use it!
line 1422 [i]postElevationChange[/i] You probably already know that "super" refers to the parent class.)