Print at May 19, 2026, 10:50:26 PM

Posted by Keet at Mar 23, 2026, 4:59:07 PM
Re: Modeller 3D plugin
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.
That doesn't sound right. I only ran a few quick (superficial) tests before publishing, and it seemed to work.
I tried it again just now and didn't notice any issues.
Please give me a way to reproduce the problem.
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.
Check if you add movement to the undo queue. You should only add a change to the queue with mouse-up, not every coordinate in the path between the original and end points.

Look at the Terrain Generator where the arrows at the top execute undo/redo.
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).
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.

Hint: RoomsTerrainGeneratorPlugin.java
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 elevationsUndoSupport: investigate and use it!
line 1422 postElevationChange You probably already know that "super" refers to the parent class.)
Dig down and try to follow what happens. Most of the work is already done using the java and Sweet Home 3D libraries. You just have to figure out how to use it smile
----------------------------------------
Dodecagon.nl
1300+ 3D models, manuals, and projects