SDK Scenecomposer : now right clicking will cancel current transformation for the Scale, Rotate and Move Tool, looks like the selectTools shortcut
- improved these tool feedback, its easier to begin the tranformation as its start on the first click instead of the first dragg
This commit is contained in:
parent
986950fb1d
commit
a913d8e0c2
@ -60,38 +60,7 @@ public class MoveTool extends SceneEditTool {
|
||||
wasDragging = false;
|
||||
}
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(Vector2f screenCoord, JmeNode rootNode, DataObject currentDataObject, JmeSpatial selectedSpatial) {
|
||||
|
||||
if (pickedMarker == null) {
|
||||
highlightAxisMarker(camera, screenCoord, axisPickType);
|
||||
} else {
|
||||
pickedMarker = null;
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
if (!pressed) {
|
||||
setDefaultAxisMarkerColors();
|
||||
pickedMarker = null; // mouse released, reset selection
|
||||
constraintAxis = Vector3f.UNIT_XYZ; // no constraint
|
||||
if (wasDragging) {
|
||||
actionPerformed(new MoveUndo(toolController.getSelectedSpatial(), startPosition, lastPosition));
|
||||
wasDragging = false;
|
||||
}
|
||||
pickManager.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (toolController.getSelectedSpatial() == null) {
|
||||
return;
|
||||
}
|
||||
@ -119,8 +88,41 @@ public class MoveTool extends SceneEditTool {
|
||||
constraintAxis = Vector3f.UNIT_Z; // move only Z
|
||||
}
|
||||
startPosition = toolController.getSelectedSpatial().getLocalTranslation().clone();
|
||||
|
||||
wasDragging = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
||||
if (pressed) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(Vector2f screenCoord, JmeNode rootNode, DataObject currentDataObject, JmeSpatial selectedSpatial) {
|
||||
|
||||
if (pickedMarker == null) {
|
||||
highlightAxisMarker(camera, screenCoord, axisPickType);
|
||||
} else {
|
||||
pickedMarker = null;
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
if (!pressed) {
|
||||
setDefaultAxisMarkerColors();
|
||||
pickedMarker = null; // mouse released, reset selection
|
||||
constraintAxis = Vector3f.UNIT_XYZ; // no constraint
|
||||
if (wasDragging) {
|
||||
actionPerformed(new MoveUndo(toolController.getSelectedSpatial(), startPosition, lastPosition));
|
||||
wasDragging = false;
|
||||
}
|
||||
pickManager.reset();
|
||||
} else if (wasDragging == true) {
|
||||
if (!pickManager.updatePick(camera, screenCoord)) {
|
||||
return;
|
||||
}
|
||||
@ -135,12 +137,25 @@ public class MoveTool extends SceneEditTool {
|
||||
lastPosition = position;
|
||||
toolController.getSelectedSpatial().setLocalTranslation(position);
|
||||
updateToolsTransformation();
|
||||
|
||||
wasDragging = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draggedSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
if (pressed) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void cancel() {
|
||||
if (wasDragging) {
|
||||
wasDragging = false;
|
||||
toolController.getSelectedSpatial().setLocalTranslation(startPosition);
|
||||
setDefaultAxisMarkerColors();
|
||||
pickedMarker = null; // mouse released, reset selection
|
||||
constraintAxis = Vector3f.UNIT_XYZ; // no constraint
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
protected class MoveUndo extends AbstractUndoableSceneEdit {
|
||||
|
@ -53,38 +53,8 @@ public class RotateTool extends SceneEditTool {
|
||||
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startRotate, lastRotate));
|
||||
wasDragging = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(Vector2f screenCoord, JmeNode rootNode, DataObject currentDataObject, JmeSpatial selectedSpatial) {
|
||||
if (pickedMarker == null) {
|
||||
highlightAxisMarker(camera, screenCoord, axisPickType);
|
||||
pickManager.reset();
|
||||
} else {
|
||||
pickedMarker = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
|
||||
if (!pressed) {
|
||||
setDefaultAxisMarkerColors();
|
||||
pickedMarker = null; // mouse released, reset selection
|
||||
lastScreenCoord = null;
|
||||
|
||||
if (wasDragging) {
|
||||
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startRotate, lastRotate));
|
||||
wasDragging = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (toolController.getSelectedSpatial() == null) {
|
||||
return;
|
||||
}
|
||||
@ -103,7 +73,41 @@ public class RotateTool extends SceneEditTool {
|
||||
pickManager.initiatePick(toolController.getSelectedSpatial(), PickManager.PLANE_YZ, getTransformType(), camera, screenCoord);
|
||||
}
|
||||
startRotate = toolController.getSelectedSpatial().getLocalRotation().clone();
|
||||
wasDragging = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
||||
if (pressed) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(Vector2f screenCoord, JmeNode rootNode, DataObject currentDataObject, JmeSpatial selectedSpatial) {
|
||||
if (pickedMarker == null) {
|
||||
highlightAxisMarker(camera, screenCoord, axisPickType);
|
||||
} else {
|
||||
pickedMarker = null;
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
if (!pressed) {
|
||||
setDefaultAxisMarkerColors();
|
||||
pickedMarker = null; // mouse released, reset selection
|
||||
lastScreenCoord = null;
|
||||
|
||||
if (wasDragging) {
|
||||
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startRotate, lastRotate));
|
||||
wasDragging = false;
|
||||
}
|
||||
pickManager.reset();
|
||||
} else if (wasDragging) {
|
||||
if (!pickManager.updatePick(camera, screenCoord)) {
|
||||
return;
|
||||
}
|
||||
@ -114,13 +118,24 @@ public class RotateTool extends SceneEditTool {
|
||||
lastRotate = rotation;
|
||||
}
|
||||
updateToolsTransformation();
|
||||
wasDragging = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public
|
||||
void draggedSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
public 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 {
|
||||
|
@ -54,38 +54,7 @@ public class ScaleTool extends SceneEditTool {
|
||||
wasDragging = false;
|
||||
}
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(Vector2f screenCoord, JmeNode rootNode, DataObject currentDataObject, JmeSpatial selectedSpatial) {
|
||||
if (pickedMarker == null) {
|
||||
highlightAxisMarker(camera, screenCoord, axisPickType, true);
|
||||
} else {
|
||||
pickedMarker = null;
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
if (!pressed) {
|
||||
setDefaultAxisMarkerColors();
|
||||
pickedMarker = null; // mouse released, reset selection
|
||||
constraintAxis = Vector3f.UNIT_XYZ; // no axis constraint
|
||||
if (wasDragging) {
|
||||
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startScale, lastScale));
|
||||
wasDragging = false;
|
||||
}
|
||||
pickManager.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (toolController.getSelectedSpatial() == null) {
|
||||
return;
|
||||
}
|
||||
@ -109,8 +78,40 @@ public class ScaleTool extends SceneEditTool {
|
||||
constraintAxis = Vector3f.UNIT_Z; // scale only Z
|
||||
}
|
||||
startScale = toolController.getSelectedSpatial().getLocalScale().clone();
|
||||
wasDragging = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject dataObject) {
|
||||
if (pressed) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(Vector2f screenCoord, JmeNode rootNode, DataObject currentDataObject, JmeSpatial selectedSpatial) {
|
||||
if (pickedMarker == null) {
|
||||
highlightAxisMarker(camera, screenCoord, axisPickType, true);
|
||||
} else {
|
||||
pickedMarker = null;
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
if (!pressed) {
|
||||
setDefaultAxisMarkerColors();
|
||||
pickedMarker = null; // mouse released, reset selection
|
||||
constraintAxis = Vector3f.UNIT_XYZ; // no axis constraint
|
||||
if (wasDragging) {
|
||||
actionPerformed(new ScaleUndo(toolController.getSelectedSpatial(), startScale, lastScale));
|
||||
wasDragging = false;
|
||||
}
|
||||
pickManager.reset();
|
||||
} else if (wasDragging) {
|
||||
if (!pickManager.updatePick(camera, screenCoord)) {
|
||||
return;
|
||||
}
|
||||
@ -131,13 +132,24 @@ public class ScaleTool extends SceneEditTool {
|
||||
toolController.getSelectedSpatial().setLocalScale(scale);
|
||||
}
|
||||
updateToolsTransformation();
|
||||
|
||||
wasDragging = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draggedSecondary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) {
|
||||
if (pressed) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void cancel() {
|
||||
if (wasDragging) {
|
||||
wasDragging = false;
|
||||
toolController.getSelectedSpatial().setLocalScale(startScale);
|
||||
setDefaultAxisMarkerColors();
|
||||
pickedMarker = null; // mouse released, reset selection
|
||||
pickManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
private class ScaleUndo extends AbstractUndoableSceneEdit {
|
||||
|
Loading…
x
Reference in New Issue
Block a user