From 39fe8326babf3564aaa1e53ffcde9d4026d6cb9b Mon Sep 17 00:00:00 2001 From: Nehon Date: Sun, 15 Nov 2015 08:51:59 +0100 Subject: [PATCH] Added a progress handle for the environment map generation. --- .../nodes/actions/NewLightPopup.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewLightPopup.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewLightPopup.java index 5588e7bbe..3aff0e247 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewLightPopup.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewLightPopup.java @@ -56,6 +56,8 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; +import org.netbeans.api.progress.ProgressHandle; +import org.netbeans.api.progress.ProgressHandleFactory; import org.openide.loaders.DataObject; import org.openide.util.Lookup; import org.openide.util.actions.Presenter; @@ -196,9 +198,30 @@ public class NewLightPopup extends AbstractAction implements Presenter.Popup { envCam.setPosition(new Vector3f(0, 0, 0)); } LightProbe lightProbe = LightProbeFactory.makeProbe(envCam, node, new JobProgressAdapter() { + + int lastProgress; + + ProgressHandle handle = ProgressHandleFactory.createHandle("Generating environment maps"); + @Override + public void start() { + handle.start(100); + } + + @Override + public void progress(double value) { + lastProgress = (int)(value * 100); + handle.progress(lastProgress); + } + + @Override + public void step(String message) { + handle.progress(message,lastProgress); + } + + @Override public void done(LightProbe t) { - System.err.println("Done computing env maps"); + handle.finish(); ((BoundingSphere)t.getBounds()).setRadius(200); } });