From 68901f6bc49a6edb744446f9135a009df6339721 Mon Sep 17 00:00:00 2001 From: "bre..ns" Date: Tue, 17 Jan 2012 02:45:08 +0000 Subject: [PATCH] what, I did not forget this git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9082 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../tools/GenerateTerrainEntropiesAction.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/GenerateTerrainEntropiesAction.java 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 new file mode 100644 index 000000000..93c4a5490 --- /dev/null +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/GenerateTerrainEntropiesAction.java @@ -0,0 +1,44 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.jme3.gde.terraineditor.tools; + +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; + +/** + * + * @author Brent Owens + */ +@org.openide.util.lookup.ServiceProvider(service = ToolAction.class) +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 + } + return true; + } + + @Override + protected void doUndoTool(AbstractSceneExplorerNode rootNode, Object undoObject) { + // no undo, not needed + } + + public Class getNodeClass() { + return JmeTerrainQuad.class; + } + +}