|
|
@ -53,12 +53,36 @@ public class RotateTool extends SceneEditTool { |
|
|
|
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startRotate, lastRotate)); |
|
|
|
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startRotate, lastRotate)); |
|
|
|
wasDragging = false; |
|
|
|
wasDragging = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
pickManager.reset(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (toolController.getSelectedSpatial() == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pickedMarker == null) { |
|
|
|
|
|
|
|
pickedMarker = pickAxisMarker(camera, screenCoord, axisPickType); |
|
|
|
|
|
|
|
if (pickedMarker == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pickedMarker.equals(QUAD_XY)) { |
|
|
|
|
|
|
|
pickManager.initiatePick(toolController.getSelectedSpatial(), PickManager.PLANE_XY, getTransformType(), camera, screenCoord); |
|
|
|
|
|
|
|
} else if (pickedMarker.equals(QUAD_XZ)) { |
|
|
|
|
|
|
|
pickManager.initiatePick(toolController.getSelectedSpatial(), PickManager.PLANE_XZ, getTransformType(), camera, screenCoord); |
|
|
|
|
|
|
|
} else if (pickedMarker.equals(QUAD_YZ)) { |
|
|
|
|
|
|
|
pickManager.initiatePick(toolController.getSelectedSpatial(), PickManager.PLANE_YZ, getTransformType(), camera, screenCoord); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
startRotate = toolController.getSelectedSpatial().getLocalRotation().clone(); |
|
|
|
|
|
|
|
wasDragging = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) { |
|
|
|
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) { |
|
|
|
|
|
|
|
if (pressed) { |
|
|
|
|
|
|
|
cancel(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -67,12 +91,12 @@ public class RotateTool extends SceneEditTool { |
|
|
|
highlightAxisMarker(camera, screenCoord, axisPickType); |
|
|
|
highlightAxisMarker(camera, screenCoord, axisPickType); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
pickedMarker = null; |
|
|
|
pickedMarker = null; |
|
|
|
|
|
|
|
pickManager.reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) { |
|
|
|
public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) { |
|
|
|
|
|
|
|
|
|
|
|
if (!pressed) { |
|
|
|
if (!pressed) { |
|
|
|
setDefaultAxisMarkerColors(); |
|
|
|
setDefaultAxisMarkerColors(); |
|
|
|
pickedMarker = null; // mouse released, reset selection
|
|
|
|
pickedMarker = null; // mouse released, reset selection
|
|
|
@ -82,28 +106,8 @@ public class RotateTool extends SceneEditTool { |
|
|
|
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startRotate, lastRotate)); |
|
|
|
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startRotate, lastRotate)); |
|
|
|
wasDragging = false; |
|
|
|
wasDragging = false; |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
pickManager.reset(); |
|
|
|
} |
|
|
|
} else if (wasDragging) { |
|
|
|
|
|
|
|
|
|
|
|
if (toolController.getSelectedSpatial() == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pickedMarker == null) { |
|
|
|
|
|
|
|
pickedMarker = pickAxisMarker(camera, screenCoord, axisPickType); |
|
|
|
|
|
|
|
if (pickedMarker == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pickedMarker.equals(QUAD_XY)) { |
|
|
|
|
|
|
|
pickManager.initiatePick(toolController.getSelectedSpatial(), PickManager.PLANE_XY, getTransformType(), camera, screenCoord); |
|
|
|
|
|
|
|
} else if (pickedMarker.equals(QUAD_XZ)) { |
|
|
|
|
|
|
|
pickManager.initiatePick(toolController.getSelectedSpatial(), PickManager.PLANE_XZ, getTransformType(), camera, screenCoord); |
|
|
|
|
|
|
|
} else if (pickedMarker.equals(QUAD_YZ)) { |
|
|
|
|
|
|
|
pickManager.initiatePick(toolController.getSelectedSpatial(), PickManager.PLANE_YZ, getTransformType(), camera, screenCoord); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
startRotate = toolController.getSelectedSpatial().getLocalRotation().clone(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!pickManager.updatePick(camera, screenCoord)) { |
|
|
|
if (!pickManager.updatePick(camera, screenCoord)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -114,13 +118,24 @@ public class RotateTool extends SceneEditTool { |
|
|
|
lastRotate = rotation; |
|
|
|
lastRotate = rotation; |
|
|
|
} |
|
|
|
} |
|
|
|
updateToolsTransformation(); |
|
|
|
updateToolsTransformation(); |
|
|
|
wasDragging = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public |
|
|
|
public void draggedSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) { |
|
|
|
void draggedSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) { |
|
|
|
if (pressed) { |
|
|
|
|
|
|
|
cancel(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void cancel() { |
|
|
|
|
|
|
|
if (wasDragging) { |
|
|
|
|
|
|
|
wasDragging = false; |
|
|
|
|
|
|
|
toolController.getSelectedSpatial().setLocalRotation(startRotate); |
|
|
|
|
|
|
|
setDefaultAxisMarkerColors(); |
|
|
|
|
|
|
|
pickedMarker = null; // mouse released, reset selection
|
|
|
|
|
|
|
|
pickManager.reset(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class ScaleUndo extends AbstractUndoableSceneEdit { |
|
|
|
private class ScaleUndo extends AbstractUndoableSceneEdit { |
|
|
|