Browse Source

terrain editor : fix the slope tool

Dokthar 9 years ago
parent
commit
1ec6241cdb

+ 4 - 5
jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/SlopeTerrainTool.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2011 jMonkeyEngine
+ * Copyright (c) 2009-2016 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,6 @@ import com.jme3.scene.Node;
 import com.jme3.scene.Spatial;
 import com.jme3.scene.control.BillboardControl;
 import com.jme3.scene.shape.Line;
-import com.jme3.scene.shape.Quad;
 import com.jme3.scene.shape.Sphere;
 import org.openide.loaders.DataObject;
 
@@ -118,7 +117,7 @@ public class SlopeTerrainTool extends TerrainTool {
         angleText.setSize(0.5f);
         angleText.setCullHint(Spatial.CullHint.Never);
     }
-
+    
     @Override
     public void actionPrimary(Vector3f point, int textureIndex, AbstractSceneExplorerNode rootNode, DataObject dataObject) {
         if (point1 != null && point2 != null && point1.distance(point2) > 0.01f) { // Preventing unexpected behavior, like destroying the terrain
@@ -183,13 +182,13 @@ public class SlopeTerrainTool extends TerrainTool {
     @Override
     public void actionSecondary(Vector3f point, int textureIndex, AbstractSceneExplorerNode rootNode, DataObject dataObject) {
         if (leftCtrl) {
-            point2 = point;
+            point2 = new Vector3f(point);
             if (markerThird.getParent() == null)
                 parent.attachChild(markerThird);
 
             markerThird.setLocalTranslation(point);
         } else {
-            point1 = point;
+            point1 = new Vector3f(point);
             if (markerSecondary.getParent() == null)
                 parent.attachChild(markerSecondary);
 

+ 5 - 5
jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/SlopeTerrainToolAction.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2011 jMonkeyEngine
+ * Copyright (c) 2009-2016 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -48,8 +48,8 @@ import java.util.List;
 public class SlopeTerrainToolAction extends AbstractTerrainToolAction {
 
     private final Vector3f current;
-    private Vector3f point1;
-    private Vector3f point2;
+    private final Vector3f point1;
+    private final Vector3f point2;
     private final float radius;
     private final float weight;
     private List<Vector2f> undoLocs;
@@ -60,8 +60,8 @@ public class SlopeTerrainToolAction extends AbstractTerrainToolAction {
 
     public SlopeTerrainToolAction(Vector3f current, Vector3f point1, Vector3f point2, float radius, float weight, boolean precise, boolean lock, Meshes mesh) {
         this.current = current.clone();
-        this.point1 = point1;
-        this.point2 = point2;
+        this.point1 = point1.clone();
+        this.point2 = point2.clone();
         this.radius = radius;
         this.weight = weight;
         this.precise = precise;