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 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,6 +63,10 @@ public final class NewNavMeshWizardAction extends AbstractNewSpatialWizardAction
|
||||
if (configuration == null) {
|
||||
return null;
|
||||
}
|
||||
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;
|
||||
|
||||
@ -75,7 +81,6 @@ public final class NewNavMeshWizardAction extends AbstractNewSpatialWizardAction
|
||||
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);
|
||||
@ -83,6 +88,9 @@ public final class NewNavMeshWizardAction extends AbstractNewSpatialWizardAction
|
||||
navMesh.setMesh(optiMesh);
|
||||
navMesh.setCullHint(CullHint.Always);
|
||||
navMesh.setModelBound(new BoundingBox());
|
||||
} finally {
|
||||
progressHandle.finish();
|
||||
}
|
||||
|
||||
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.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;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -26,8 +27,14 @@ public class GenerateTerrainEntropiesAction extends AbstractToolAction {
|
||||
@Override
|
||||
protected Object doApplyTool(AbstractSceneExplorerNode rootNode) {
|
||||
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
|
||||
((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;
|
||||
}
|
||||
@ -40,5 +47,4 @@ public class GenerateTerrainEntropiesAction extends AbstractToolAction {
|
||||
public Class<?> getNodeClass() {
|
||||
return JmeTerrainQuad.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user