diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java index 5ad1a0678..2fbf628eb 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java @@ -32,10 +32,12 @@ package com.jme3.gde.terraineditor.tools; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractStatefulGLToolAction; import com.jme3.scene.Node; import com.jme3.scene.Spatial; import com.jme3.terrain.Terrain; +import org.openide.loaders.DataObject; /** * Helps find the terrain in the scene @@ -69,4 +71,17 @@ public abstract class AbstractTerrainToolAction extends AbstractStatefulGLToolAc return null; } + + @Override + protected void setModified(final AbstractSceneExplorerNode rootNode, final DataObject dataObject) { + if (dataObject.isModified()) + return; + java.awt.EventQueue.invokeLater(new Runnable() { + + public void run() { + dataObject.setModified(true); + //rootNode.refresh(true); // we don't need to refresh the whole tree when we edit the terrain + } + }); + } } diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/LevelTerrainTool.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/LevelTerrainTool.java index 0bbf46402..15526a28a 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/LevelTerrainTool.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/LevelTerrainTool.java @@ -66,7 +66,9 @@ public class LevelTerrainTool extends TerrainTool { if (radius == 0 || weight == 0) return; if (desiredHeight == null) - desiredHeight = point.clone(); + desiredHeight = markerSecondary.getWorldTranslation().clone(); + else + desiredHeight.y = markerSecondary.getWorldTranslation().y; if (toolParams.absolute) desiredHeight.y = toolParams.height; LevelTerrainToolAction action = new LevelTerrainToolAction(point, radius, weight, desiredHeight, toolParams.precision, getMesh()); diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/PaintTerrainToolAction.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/PaintTerrainToolAction.java index a9cdcff7f..e1e63dec0 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/PaintTerrainToolAction.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/PaintTerrainToolAction.java @@ -166,7 +166,7 @@ public class PaintTerrainToolAction extends AbstractTerrainToolAction { int maxy = (int) Math.min(height,(uv.y*height + radius*height)); float radiusSquared = radius*radius; - float radiusFalloff = radius*fadeFalloff; + float radiusFalloff = radiusSquared*fadeFalloff; // go through each pixel, in the radius of the tool, in the image for (int y = miny; y < maxy; y++){ for (int x = minx; x < maxx; x++){ @@ -178,14 +178,15 @@ public class PaintTerrainToolAction extends AbstractTerrainToolAction { manipulatePixel(image, x, y, color, false); // gets the color at that location (false means don't write to the buffer) // calculate the fade falloff intensity - float intensity = 0.1f; - if (dist > radiusFalloff) { + float intensity = (1.0f-(dist/radiusSquared))*fadeFalloff; + /*if (dist > radiusFalloff) { float dr = radius - radiusFalloff; // falloff to radius length float d2 = dist - radiusFalloff; // dist minus falloff d2 = d2/dr; // dist percentage of falloff length intensity = 1-d2; // fade out more the farther away it is - } - + }*/ + + //if (dragged) // intensity = intensity*0.1f; // magical divide it by 10 to reduce its intensity when mouse is dragged