SDK:
- add progress indicators for navmesh and terrain entropy generation git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9084 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
68901f6bc4
commit
445cbdc09c
@ -25,6 +25,8 @@ import java.util.List;
|
|||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import jme3tools.optimize.GeometryBatchFactory;
|
import jme3tools.optimize.GeometryBatchFactory;
|
||||||
import org.critterai.nmgen.IntermediateData;
|
import org.critterai.nmgen.IntermediateData;
|
||||||
|
import org.netbeans.api.progress.ProgressHandle;
|
||||||
|
import org.netbeans.api.progress.ProgressHandleFactory;
|
||||||
import org.openide.DialogDisplayer;
|
import org.openide.DialogDisplayer;
|
||||||
import org.openide.WizardDescriptor;
|
import org.openide.WizardDescriptor;
|
||||||
|
|
||||||
@ -61,6 +63,10 @@ public final class NewNavMeshWizardAction extends AbstractNewSpatialWizardAction
|
|||||||
if (configuration == null) {
|
if (configuration == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Generating NavMesh");
|
||||||
|
progressHandle.start();
|
||||||
|
final Geometry navMesh = new Geometry("NavMesh");
|
||||||
|
try {
|
||||||
//TODO: maybe offload to other thread..
|
//TODO: maybe offload to other thread..
|
||||||
WizardDescriptor wizardDescriptor = (WizardDescriptor) configuration;
|
WizardDescriptor wizardDescriptor = (WizardDescriptor) configuration;
|
||||||
|
|
||||||
@ -75,7 +81,6 @@ public final class NewNavMeshWizardAction extends AbstractNewSpatialWizardAction
|
|||||||
Mesh optiMesh = generator.optimize(mesh);
|
Mesh optiMesh = generator.optimize(mesh);
|
||||||
if(optiMesh == null) return null;
|
if(optiMesh == null) return null;
|
||||||
|
|
||||||
final Geometry navMesh = new Geometry("NavMesh");
|
|
||||||
Material material = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md");
|
Material material = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
material.getAdditionalRenderState().setWireframe(true);
|
material.getAdditionalRenderState().setWireframe(true);
|
||||||
material.setColor("Color", ColorRGBA.Green);
|
material.setColor("Color", ColorRGBA.Green);
|
||||||
@ -83,6 +88,9 @@ public final class NewNavMeshWizardAction extends AbstractNewSpatialWizardAction
|
|||||||
navMesh.setMesh(optiMesh);
|
navMesh.setMesh(optiMesh);
|
||||||
navMesh.setCullHint(CullHint.Always);
|
navMesh.setCullHint(CullHint.Always);
|
||||||
navMesh.setModelBound(new BoundingBox());
|
navMesh.setModelBound(new BoundingBox());
|
||||||
|
} finally {
|
||||||
|
progressHandle.finish();
|
||||||
|
}
|
||||||
|
|
||||||
return navMesh;
|
return navMesh;
|
||||||
}
|
}
|
||||||
|
@ -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.JmeTerrainQuad;
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractToolAction;
|
import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractToolAction;
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.actions.ToolAction;
|
import com.jme3.gde.core.sceneexplorer.nodes.actions.ToolAction;
|
||||||
import com.jme3.scene.Geometry;
|
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.jme3.terrain.geomipmap.TerrainQuad;
|
import com.jme3.terrain.geomipmap.TerrainQuad;
|
||||||
|
import org.netbeans.api.progress.ProgressHandle;
|
||||||
|
import org.netbeans.api.progress.ProgressHandleFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -26,9 +27,15 @@ public class GenerateTerrainEntropiesAction extends AbstractToolAction {
|
|||||||
@Override
|
@Override
|
||||||
protected Object doApplyTool(AbstractSceneExplorerNode rootNode) {
|
protected Object doApplyTool(AbstractSceneExplorerNode rootNode) {
|
||||||
Node terrain = rootNode.getLookup().lookup(Node.class);
|
Node terrain = rootNode.getLookup().lookup(Node.class);
|
||||||
|
ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Generating Entropies");
|
||||||
|
progressHandle.start();
|
||||||
|
try {
|
||||||
if (terrain instanceof TerrainQuad) { // it should be terrain anyways
|
if (terrain instanceof TerrainQuad) { // it should be terrain anyways
|
||||||
((TerrainQuad) terrain).generateEntropy(null); //TODO hook up to progress monitor
|
((TerrainQuad) terrain).generateEntropy(null); //TODO hook up to progress monitor
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
progressHandle.finish();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,5 +47,4 @@ public class GenerateTerrainEntropiesAction extends AbstractToolAction {
|
|||||||
public Class<?> getNodeClass() {
|
public Class<?> getNodeClass() {
|
||||||
return JmeTerrainQuad.class;
|
return JmeTerrainQuad.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user