Skip to content

Commit 1ec6241

Browse files
committed
terrain editor : fix the slope tool
1 parent 18eef00 commit 1ec6241

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2011 jMonkeyEngine
2+
* Copyright (c) 2009-2016 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,6 @@
4747
import com.jme3.scene.Spatial;
4848
import com.jme3.scene.control.BillboardControl;
4949
import com.jme3.scene.shape.Line;
50-
import com.jme3.scene.shape.Quad;
5150
import com.jme3.scene.shape.Sphere;
5251
import org.openide.loaders.DataObject;
5352

@@ -118,7 +117,7 @@ private void addLineAndText() {
118117
angleText.setSize(0.5f);
119118
angleText.setCullHint(Spatial.CullHint.Never);
120119
}
121-
120+
122121
@Override
123122
public void actionPrimary(Vector3f point, int textureIndex, AbstractSceneExplorerNode rootNode, DataObject dataObject) {
124123
if (point1 != null && point2 != null && point1.distance(point2) > 0.01f) { // Preventing unexpected behavior, like destroying the terrain
@@ -183,13 +182,13 @@ private void updateAngle() {
183182
@Override
184183
public void actionSecondary(Vector3f point, int textureIndex, AbstractSceneExplorerNode rootNode, DataObject dataObject) {
185184
if (leftCtrl) {
186-
point2 = point;
185+
point2 = new Vector3f(point);
187186
if (markerThird.getParent() == null)
188187
parent.attachChild(markerThird);
189188

190189
markerThird.setLocalTranslation(point);
191190
} else {
192-
point1 = point;
191+
point1 = new Vector3f(point);
193192
if (markerSecondary.getParent() == null)
194193
parent.attachChild(markerSecondary);
195194

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2011 jMonkeyEngine
2+
* Copyright (c) 2009-2016 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -48,8 +48,8 @@
4848
public class SlopeTerrainToolAction extends AbstractTerrainToolAction {
4949

5050
private final Vector3f current;
51-
private Vector3f point1;
52-
private Vector3f point2;
51+
private final Vector3f point1;
52+
private final Vector3f point2;
5353
private final float radius;
5454
private final float weight;
5555
private List<Vector2f> undoLocs;
@@ -60,8 +60,8 @@ public class SlopeTerrainToolAction extends AbstractTerrainToolAction {
6060

6161
public SlopeTerrainToolAction(Vector3f current, Vector3f point1, Vector3f point2, float radius, float weight, boolean precise, boolean lock, Meshes mesh) {
6262
this.current = current.clone();
63-
this.point1 = point1;
64-
this.point2 = point2;
63+
this.point1 = point1.clone();
64+
this.point2 = point2.clone();
6565
this.radius = radius;
6666
this.weight = weight;
6767
this.precise = precise;

0 commit comments

Comments
 (0)