SDK : MoveTool fixed imports and formatted the file
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9599 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
458ce63d15
commit
25efcd4f7b
@ -21,7 +21,6 @@ import com.jme3.scene.Geometry;
|
|||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.scene.shape.Quad;
|
import com.jme3.scene.shape.Quad;
|
||||||
import com.jme3.util.TempVars;
|
|
||||||
import org.openide.loaders.DataObject;
|
import org.openide.loaders.DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +44,6 @@ public class MoveTool extends SceneEditTool {
|
|||||||
private final Quaternion XY = new Quaternion().fromAngleAxis(0, new Vector3f(1, 0, 0));
|
private final Quaternion XY = new Quaternion().fromAngleAxis(0, new Vector3f(1, 0, 0));
|
||||||
private final Quaternion YZ = new Quaternion().fromAngleAxis(-FastMath.PI / 2, new Vector3f(0, 1, 0));
|
private final Quaternion YZ = new Quaternion().fromAngleAxis(-FastMath.PI / 2, new Vector3f(0, 1, 0));
|
||||||
private final Quaternion XZ = new Quaternion().fromAngleAxis(FastMath.PI / 2, new Vector3f(1, 0, 0));
|
private final Quaternion XZ = new Quaternion().fromAngleAxis(FastMath.PI / 2, new Vector3f(1, 0, 0));
|
||||||
|
|
||||||
//temp vars
|
//temp vars
|
||||||
private Quaternion rot = new Quaternion();
|
private Quaternion rot = new Quaternion();
|
||||||
private Vector3f newPos = new Vector3f();
|
private Vector3f newPos = new Vector3f();
|
||||||
@ -69,10 +67,6 @@ public class MoveTool extends SceneEditTool {
|
|||||||
displayPlanes();
|
displayPlanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
public void actionPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
||||||
if (!pressed) {
|
if (!pressed) {
|
||||||
@ -88,15 +82,13 @@ public class MoveTool extends SceneEditTool {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(Vector2f screenCoord, JmeNode rootNode, DataObject currentDataObject, JmeSpatial selectedSpatial) {
|
public void mouseMoved(Vector2f screenCoord, JmeNode rootNode, DataObject currentDataObject, JmeSpatial selectedSpatial) {
|
||||||
if (pickedPlane == null) {
|
if (pickedPlane == null) {
|
||||||
highlightAxisMarker(camera, screenCoord, axisPickType);
|
highlightAxisMarker(camera, screenCoord, axisPickType);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pickedPlane = null;
|
pickedPlane = null;
|
||||||
offset = null;
|
offset = null;
|
||||||
}
|
}
|
||||||
@ -115,21 +107,24 @@ public class MoveTool extends SceneEditTool {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toolController.getSelectedSpatial() == null)
|
if (toolController.getSelectedSpatial() == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pickedPlane == null) {
|
if (pickedPlane == null) {
|
||||||
pickedPlane = pickAxisMarker(camera, screenCoord, axisPickType);
|
pickedPlane = pickAxisMarker(camera, screenCoord, axisPickType);
|
||||||
if (pickedPlane == null)
|
if (pickedPlane == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
startLoc = toolController.getSelectedSpatial().getLocalTranslation().clone();
|
startLoc = toolController.getSelectedSpatial().getLocalTranslation().clone();
|
||||||
rot = rot.set(toolController.getSelectedSpatial().getWorldRotation());
|
rot = rot.set(toolController.getSelectedSpatial().getWorldRotation());
|
||||||
if (pickedPlane.equals(new Vector3f(1,1,0)))
|
if (pickedPlane.equals(new Vector3f(1, 1, 0))) {
|
||||||
plane.setLocalRotation(rot.multLocal(XY));
|
plane.setLocalRotation(rot.multLocal(XY));
|
||||||
else if (pickedPlane.equals(new Vector3f(1,0,1)))
|
} else if (pickedPlane.equals(new Vector3f(1, 0, 1))) {
|
||||||
plane.setLocalRotation(rot.multLocal(XZ));
|
plane.setLocalRotation(rot.multLocal(XZ));
|
||||||
else if (pickedPlane.equals(new Vector3f(0,1,1)))
|
} else if (pickedPlane.equals(new Vector3f(0, 1, 1))) {
|
||||||
plane.setLocalRotation(rot.multLocal(YZ));
|
plane.setLocalRotation(rot.multLocal(YZ));
|
||||||
|
}
|
||||||
plane.setLocalTranslation(startLoc);
|
plane.setLocalTranslation(startLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +178,6 @@ public class MoveTool extends SceneEditTool {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draggedSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
public void draggedSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MoveUndo extends AbstractUndoableSceneEdit {
|
private class MoveUndo extends AbstractUndoableSceneEdit {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user