diff --git a/sdk/jme3-navmesh-gen/src/com/jme3/gde/nmgen/wizard/NewNavMeshWizardAction.java b/sdk/jme3-navmesh-gen/src/com/jme3/gde/nmgen/wizard/NewNavMeshWizardAction.java index f4aac9718..f11c4efa8 100644 --- a/sdk/jme3-navmesh-gen/src/com/jme3/gde/nmgen/wizard/NewNavMeshWizardAction.java +++ b/sdk/jme3-navmesh-gen/src/com/jme3/gde/nmgen/wizard/NewNavMeshWizardAction.java @@ -25,6 +25,8 @@ import java.util.List; import javax.swing.JComponent; import jme3tools.optimize.GeometryBatchFactory; import org.critterai.nmgen.IntermediateData; +import org.netbeans.api.progress.ProgressHandle; +import org.netbeans.api.progress.ProgressHandleFactory; import org.openide.DialogDisplayer; import org.openide.WizardDescriptor; @@ -61,28 +63,34 @@ public final class NewNavMeshWizardAction extends AbstractNewSpatialWizardAction if (configuration == null) { return null; } - //TODO: maybe offload to other thread.. - WizardDescriptor wizardDescriptor = (WizardDescriptor) configuration; + ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Generating NavMesh"); + progressHandle.start(); + final Geometry navMesh = new Geometry("NavMesh"); + try { + //TODO: maybe offload to other thread.. + WizardDescriptor wizardDescriptor = (WizardDescriptor) configuration; - NavMeshGenerator generator = (NavMeshGenerator) wizardDescriptor.getProperty("generator"); - IntermediateData id = new IntermediateData(); + NavMeshGenerator generator = (NavMeshGenerator) wizardDescriptor.getProperty("generator"); + IntermediateData id = new IntermediateData(); - generator.setIntermediateData(null); + generator.setIntermediateData(null); - Mesh mesh = new Mesh(); + Mesh mesh = new Mesh(); - GeometryBatchFactory.mergeGeometries(findGeometries(rootNode, new LinkedList(), generator), mesh); - Mesh optiMesh = generator.optimize(mesh); - if(optiMesh == null) return null; + GeometryBatchFactory.mergeGeometries(findGeometries(rootNode, new LinkedList(), generator), mesh); + Mesh optiMesh = generator.optimize(mesh); + if(optiMesh == null) return null; - final Geometry navMesh = new Geometry("NavMesh"); - Material material = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md"); - material.getAdditionalRenderState().setWireframe(true); - material.setColor("Color", ColorRGBA.Green); - navMesh.setMaterial(material); - navMesh.setMesh(optiMesh); - navMesh.setCullHint(CullHint.Always); - navMesh.setModelBound(new BoundingBox()); + Material material = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md"); + material.getAdditionalRenderState().setWireframe(true); + material.setColor("Color", ColorRGBA.Green); + navMesh.setMaterial(material); + navMesh.setMesh(optiMesh); + navMesh.setCullHint(CullHint.Always); + navMesh.setModelBound(new BoundingBox()); + } finally { + progressHandle.finish(); + } return navMesh; } diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/GenerateTerrainEntropiesAction.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/GenerateTerrainEntropiesAction.java index 93c4a5490..1c43d256e 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/GenerateTerrainEntropiesAction.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/GenerateTerrainEntropiesAction.java @@ -8,9 +8,10 @@ import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; 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.Geometry; import com.jme3.scene.Node; import com.jme3.terrain.geomipmap.TerrainQuad; +import org.netbeans.api.progress.ProgressHandle; +import org.netbeans.api.progress.ProgressHandleFactory; /** * @@ -22,12 +23,18 @@ public class GenerateTerrainEntropiesAction extends AbstractToolAction { public GenerateTerrainEntropiesAction() { name = "Generate Entropies"; } - + @Override protected Object doApplyTool(AbstractSceneExplorerNode rootNode) { Node terrain = rootNode.getLookup().lookup(Node.class); - if (terrain instanceof TerrainQuad) { // it should be terrain anyways - ((TerrainQuad)terrain).generateEntropy(null); //TODO hook up to progress monitor + ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Generating Entropies"); + progressHandle.start(); + try { + if (terrain instanceof TerrainQuad) { // it should be terrain anyways + ((TerrainQuad) terrain).generateEntropy(null); //TODO hook up to progress monitor + } + } finally { + progressHandle.finish(); } return true; } @@ -40,5 +47,4 @@ public class GenerateTerrainEntropiesAction extends AbstractToolAction { public Class getNodeClass() { return JmeTerrainQuad.class; } - }