- add percentage progress to "generate terrain entropies" (broken?)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9085 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 445cbdc09c
commit ce80432d42
  1. 27
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/GenerateTerrainEntropiesAction.java

@ -9,6 +9,7 @@ import com.jme3.gde.core.sceneexplorer.nodes.JmeTerrainQuad;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractToolAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.ToolAction;
import com.jme3.scene.Node;
import com.jme3.terrain.ProgressMonitor;
import com.jme3.terrain.geomipmap.TerrainQuad;
import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory;
@ -27,11 +28,33 @@ public class GenerateTerrainEntropiesAction extends AbstractToolAction {
@Override
protected Object doApplyTool(AbstractSceneExplorerNode rootNode) {
Node terrain = rootNode.getLookup().lookup(Node.class);
ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Generating Entropies");
final ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Generating Terrain Entropies");
progressHandle.start();
try {
if (terrain instanceof TerrainQuad) { // it should be terrain anyways
((TerrainQuad) terrain).generateEntropy(null); //TODO hook up to progress monitor
((TerrainQuad) terrain).generateEntropy(new ProgressMonitor() {
private float progress = 0;
private float max = 0;
public void incrementProgress(float f) {
progress += f;
progressHandle.progress((int) progress);
}
public void setMonitorMax(float f) {
max = f;
progressHandle.switchToDeterminate((int) (f));
}
public float getMonitorMax() {
return max;
}
public void progressComplete() {
progressHandle.finish();
}
});
}
} finally {
progressHandle.finish();

Loading…
Cancel
Save