diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/Bundle.properties b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/Bundle.properties index 95dc6d25b..64ee8e3bf 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/Bundle.properties +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/Bundle.properties @@ -57,7 +57,7 @@ TerrainEditorTopComponent.lowerTerrainButton.toolTipText=Lower terrain TerrainEditorTopComponent.lowerTerrainButton.actionCommand=Lower TerrainEditorTopComponent.smoothTerrainButton.toolTipText=Smooth terrain TerrainEditorTopComponent.smoothTerrainButton.actionCommand=Smooth -TerrainEditorTopComponent.roughTerrainButton.toolTipText=Rough terrain +TerrainEditorTopComponent.roughTerrainButton.toolTipText=Rough terrain (not implemented) TerrainEditorTopComponent.roughTerrainButton.actionCommand=Rough TerrainEditorTopComponent.createTerrainButton.toolTipText=Add Terrain TerrainEditorTopComponent.genEntropiesButton.toolTipText=Pre-calculate the terrain entropy values. This will improve launch startup time @@ -104,3 +104,4 @@ TerrainEditorTopComponent.toolHint.none= TerrainEditorTopComponent.toolHint.default=Switch between camera and tool controls by holding down SHIFT TerrainEditorTopComponent.toolHint.smooth= TerrainEditorTopComponent.toolHint.level=Right click to set desired height value, left click to adjust height to that desired value. +TerrainEditorTopComponent.levelTerrainButton.toolTipText=Level terrain diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java index c1aa98dbd..33fca28f5 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java @@ -1294,7 +1294,74 @@ public class TerrainEditorController { * @param heightToolRadius * @param smoothAmount */ - protected void doSmoothTerrain(Vector3f markerLocation, float heightToolRadius, float smoothAmount) { + protected void doSmoothTerrain(Vector3f worldLoc, float radius, float weight) { + Terrain terrain = (Terrain) getTerrain(null); + if (terrain == null) + return; + + setNeedsSave(true); + + int radiusStepsX = (int)(radius / ((Node)terrain).getLocalScale().x); + int radiusStepsZ = (int)(radius / ((Node)terrain).getLocalScale().z); + + float xStepAmount = ((Node)terrain).getLocalScale().x; + float zStepAmount = ((Node)terrain).getLocalScale().z; + + List locs = new ArrayList(); + List heights = new ArrayList(); + + for (int z=-radiusStepsZ; z - + + + diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java index c309651c1..77339598e 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java @@ -470,7 +470,11 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce org.openide.awt.Mnemonics.setLocalizedText(smoothTerrainButton, org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.smoothTerrainButton.text")); // NOI18N smoothTerrainButton.setToolTipText(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.smoothTerrainButton.toolTipText")); // NOI18N smoothTerrainButton.setActionCommand(org.openide.util.NbBundle.getMessage(TerrainEditorTopComponent.class, "TerrainEditorTopComponent.smoothTerrainButton.actionCommand")); // NOI18N - smoothTerrainButton.setEnabled(false); + smoothTerrainButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + smoothTerrainButtonActionPerformed(evt); + } + }); jToolBar1.add(smoothTerrainButton); terrainModButtonGroup.add(roughTerrainButton); @@ -674,6 +678,16 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce toolController.setHeightToolHeight(heightSlider.getValue()); // should always be values upto and over 100, because it will be divided by 100 }//GEN-LAST:event_heightSliderStateChanged + private void smoothTerrainButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smoothTerrainButtonActionPerformed + if (smoothTerrainButton.isSelected()) { + toolController.setTerrainEditButtonState(TerrainEditButton.smoothTerrain); + setHintText(TerrainEditButton.smoothTerrain); + } else { + toolController.setTerrainEditButtonState(TerrainEditButton.none); + setHintText(TerrainEditButton.none); + } + }//GEN-LAST:event_smoothTerrainButtonActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addTextureButton; private javax.swing.JButton createTerrainButton; diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainToolController.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainToolController.java index f1e1d1bce..0ba31e33a 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainToolController.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainToolController.java @@ -99,6 +99,7 @@ public class TerrainToolController extends SceneToolController { public void setHeightToolHeight(float heightToolHeight) { this.heightAmount = heightToolHeight/100f; this.levelAmount = heightToolHeight/200f; + this.smoothAmount = heightToolHeight/200f; this.paintAmount = heightToolHeight/200f; }