SDK : added possibility to switch to front, left, top, etc... views

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7919 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 0de5fe39a3
commit 2b8ad73f7e
  1. 3
      sdk/jme3-core/src/com/jme3/gde/core/layer.xml
  2. 15
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
  3. 133
      sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java
  4. 160
      sdk/jme3-core/src/com/jme3/gde/core/scene/controller/toolbars/CameraToolbar.java
  5. 7
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java
  6. 31
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/actions/SwitchBackViewAction.java
  7. 31
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/actions/SwitchBottomViewAction.java
  8. 18
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/actions/SwitchFrontViewAction.java
  9. 31
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/actions/SwitchLeftViewAction.java
  10. 31
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/actions/SwitchRightViewAction.java
  11. 31
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/actions/SwitchTopViewAction.java
  12. 3
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/actions/ToggleOrthoPerspAction.java
  13. 16
      sdk/jme3-core/src/com/jme3/gde/core/util/CameraUtil.java

@ -16,8 +16,11 @@
<file name="com-jme3-gde-core-sceneviewer-actions-SwitchFrontViewAction.instance">
<attr name="iconBase" stringvalue="com/jme3/gde/core/sceneviewer/actions/32_bit.png"/>
<attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
<attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
<attr name="noIconInMenu" boolvalue="false"/>
</file>
<file name="com-jme3-gde-core-sceneviewer-actions-SwitchFrontViewAction.instance"/>
<file name="com-jme3-gde-core-sceneviewer-actions-SwitchToFrontViewAction.instance_hidden"/>
</folder>
<folder name="jMonkeyPlatform">
<file name="com-jme3-gde-core-assets-actions-OpenModel.instance">

@ -28,6 +28,7 @@ import com.jme3.app.Application;
import com.jme3.app.StatsView;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.gde.core.scene.controller.AbstractCameraController;
import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
import com.jme3.gde.core.scene.processors.WireProcessor;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
@ -89,6 +90,7 @@ public class SceneApplication extends Application implements LookupProvider, Loo
private Node statsGuiNode = new Node("Stats Gui Node");
protected Node toolsNode = new Node("Tools Node");
private SceneCameraController camController;
private AbstractCameraController activeCamController=null;
//preview variables
protected float secondCounter = 0.0f;
protected BitmapText fpsText;
@ -134,7 +136,8 @@ public class SceneApplication extends Application implements LookupProvider, Loo
}
}
public SceneCameraController getCamController() {
public SceneCameraController getActiveCameraController() {
stateManager.getState(null);
return camController;
}
@ -532,4 +535,14 @@ public class SceneApplication extends Application implements LookupProvider, Loo
public ProgressHandle getProgressHandle() {
return progressHandle;
}
public AbstractCameraController getActiveCamController() {
return activeCamController;
}
public void setActiveCamController(AbstractCameraController activeCamController) {
this.activeCamController = activeCamController;
}
}

@ -30,6 +30,7 @@ import com.jme3.app.state.AppStateManager;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.scene.controller.toolbars.CameraToolbar;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.core.util.CameraUtil.View;
import com.jme3.input.InputManager;
import com.jme3.input.RawInputListener;
import com.jme3.input.controls.ActionListener;
@ -80,24 +81,11 @@ public abstract class AbstractCameraController extends AbstractAppState implemen
protected boolean checkDraggedR = false;
protected boolean checkReleaseLeft = false;
protected boolean checkReleaseRight = false;
protected CameraToolbar camToolbar = new CameraToolbar();
public AbstractCameraController(Camera cam, InputManager inputManager) {
this.cam = cam;
this.inputManager = inputManager;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc != null) {
svtc.addAdditionnalToolbar(camToolbar);
}
}
});
}
public void setMaster(Object component) {
@ -108,12 +96,35 @@ public abstract class AbstractCameraController extends AbstractAppState implemen
inputManager.addRawInputListener(this);
inputManager.addListener(this, "MouseAxisX", "MouseAxisY", "MouseAxisX-", "MouseAxisY-", "MouseWheel", "MouseWheel-", "MouseButtonLeft", "MouseButtonMiddle", "MouseButtonRight");
SceneApplication.getApplication().getStateManager().attach(this);
SceneApplication.getApplication().setActiveCamController(this);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc != null) {
svtc.addAdditionnalToolbar(CameraToolbar.getInstance());
}
}
});
}
public void disable() {
inputManager.removeRawInputListener(this);
inputManager.removeListener(this);
SceneApplication.getApplication().getStateManager().detach(this);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc != null) {
svtc.removeAdditionnalToolbar(CameraToolbar.getInstance());
}
}
});
}
public void setCamFocus(final Vector3f focus) {
@ -149,6 +160,17 @@ public abstract class AbstractCameraController extends AbstractAppState implemen
Quaternion curRot = cam.getRotation().clone();
cam.setRotation(rot.mult(curRot));
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc != null) {
CameraToolbar.getInstance().switchToView(View.User);
}
}
});
}
protected void panCamera(float left, float up) {
@ -183,7 +205,7 @@ public abstract class AbstractCameraController extends AbstractAppState implemen
public void toggleOrthoPerspMode() {
try {
camToolbar.toggleOrthoMode(SceneApplication.getApplication().enqueue(new Callable<Boolean>() {
CameraToolbar.getInstance().toggleOrthoMode(SceneApplication.getApplication().enqueue(new Callable<Boolean>() {
public Boolean call() throws Exception {
return doToggleOrthoPerspMode();
@ -196,6 +218,47 @@ public abstract class AbstractCameraController extends AbstractAppState implemen
}
}
public void switchToView(final View view) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
float dist = cam.getLocation().distance(focus);
switch (view) {
case Front:
cam.setLocation(new Vector3f(focus.x, focus.y, focus.z+dist));
cam.lookAt(focus, Vector3f.UNIT_Y);
break;
case Left:
cam.setLocation(new Vector3f(focus.x+dist, focus.y, focus.z));
cam.lookAt(focus, Vector3f.UNIT_Y);
break;
case Right:
cam.setLocation(new Vector3f(focus.x-dist, focus.y, focus.z));
cam.lookAt(focus, Vector3f.UNIT_Y);
break;
case Back:
cam.setLocation(new Vector3f(focus.x, focus.y, focus.z-dist));
cam.lookAt(focus, Vector3f.UNIT_Y);
break;
case Top:
cam.setLocation(new Vector3f(focus.x, focus.y+dist, focus.z));
cam.lookAt(focus, Vector3f.UNIT_Z.mult(-1));
break;
case Bottom:
cam.setLocation(new Vector3f(focus.x, focus.y-dist, focus.z));
cam.lookAt(focus, Vector3f.UNIT_Z);
break;
case User:
default:
}
return null;
}
});
CameraToolbar.getInstance().switchToView(view);
}
protected boolean doToggleOrthoPerspMode() {
float aspect = (float) cam.getWidth() / cam.getHeight();
@ -214,50 +277,8 @@ public abstract class AbstractCameraController extends AbstractAppState implemen
cam.setFrustumPerspective(45f, aspect, 1, 1000);
return false;
}
}
/*public void onAction(String string, boolean bln, float f) {
if ("MouseButtonLeft".equals(string)) {
if (bln) {
leftMouse = true;
moved = false;
} else {
if (leftMouse)
checkReleaseLeft = true;
leftMouse = false;
if (!moved) {
if (checkClick == false)
checkClick = true;
checkDragged = false;
} else {
checkDragged = true;
checkClick = false;
}
}
}
if ("MouseButtonRight".equals(string)) {
if (bln) {
rightMouse = true;
movedR = false;
} else {
if (rightMouse)
checkReleaseRight = true;
rightMouse = false;
if (!movedR) {
if (checkClickR == false)
checkClickR = true;
checkDraggedR = false;
} else {
checkDraggedR = true;
checkClickR = false;
}
}
}
}*/
public void onAnalog(String string, float f1, float f) {
if ("MouseAxisX".equals(string)) {
moved = true;

@ -4,7 +4,15 @@
*/
package com.jme3.gde.core.scene.controller.toolbars;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.core.sceneviewer.actions.SwitchBackViewAction;
import com.jme3.gde.core.sceneviewer.actions.SwitchBottomViewAction;
import com.jme3.gde.core.sceneviewer.actions.SwitchFrontViewAction;
import com.jme3.gde.core.sceneviewer.actions.SwitchLeftViewAction;
import com.jme3.gde.core.sceneviewer.actions.SwitchRightViewAction;
import com.jme3.gde.core.sceneviewer.actions.SwitchTopViewAction;
import com.jme3.gde.core.sceneviewer.actions.ToggleOrthoPerspAction;
import com.jme3.gde.core.util.CameraUtil.View;
import javax.swing.ImageIcon;
import org.openide.util.NbBundle;
@ -14,18 +22,39 @@ import org.openide.util.NbBundle;
*/
public class CameraToolbar extends javax.swing.JToolBar {
protected boolean isUserView = true;
private static CameraToolbar instance;
ImageIcon userIcon = new ImageIcon(getClass().getResource("/com/jme3/gde/core/scene/controller/toolbars/user.png"));
//toolbar actions
private ToggleOrthoPerspAction toggleOrthoPerspAction;
private SwitchFrontViewAction switchFrontViewAction;
private SwitchLeftViewAction switchLeftViewAction;
private SwitchRightViewAction switchRightViewAction;
private SwitchTopViewAction switchTopViewAction;
private SwitchBackViewAction switchBackViewAction;
private SwitchBottomViewAction switchBottomViewAction;
/**
* Creates new form NewJPanel
*/
public CameraToolbar() {
protected CameraToolbar() {
toggleOrthoPerspAction = new ToggleOrthoPerspAction();
switchFrontViewAction = new SwitchFrontViewAction();
switchLeftViewAction = new SwitchLeftViewAction();
switchBackViewAction = new SwitchBackViewAction();
switchBottomViewAction = new SwitchBottomViewAction();
switchTopViewAction = new SwitchTopViewAction();
switchRightViewAction = new SwitchRightViewAction();
initComponents();
}
public static CameraToolbar getInstance() {
if (instance == null) {
instance = new CameraToolbar();
}
return instance;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
@ -152,27 +181,70 @@ private void viewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
}//GEN-LAST:event_viewButtonActionPerformed
private void frontMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_frontMenuItemActionPerformed
toggleFrontView();
SceneViewerTopComponent.findInstance().requestActive();
final java.awt.event.ActionEvent e = evt;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
switchFrontViewAction.actionPerformed(e);
}
});
}//GEN-LAST:event_frontMenuItemActionPerformed
private void leftMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_leftMenuItemActionPerformed
toggleLeftView();
SceneViewerTopComponent.findInstance().requestActive();
final java.awt.event.ActionEvent e = evt;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
switchLeftViewAction.actionPerformed(e);
}
});
}//GEN-LAST:event_leftMenuItemActionPerformed
private void rightMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rightMenuItemActionPerformed
toggleRightView();
SceneViewerTopComponent.findInstance().requestActive();
final java.awt.event.ActionEvent e = evt;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
switchRightViewAction.actionPerformed(e);
}
});
}//GEN-LAST:event_rightMenuItemActionPerformed
private void topMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_topMenuItemActionPerformed
toggleTopView();
SceneViewerTopComponent.findInstance().requestActive();
final java.awt.event.ActionEvent e = evt;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
switchTopViewAction.actionPerformed(e);
}
});
}//GEN-LAST:event_topMenuItemActionPerformed
private void backMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backMenuItemActionPerformed
toggleBackView();
SceneViewerTopComponent.findInstance().requestActive();
final java.awt.event.ActionEvent e = evt;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
switchBackViewAction.actionPerformed(e);
}
});
}//GEN-LAST:event_backMenuItemActionPerformed
private void bottomMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bottomMenuItemActionPerformed
toggleBottomView();
SceneViewerTopComponent.findInstance().requestActive();
final java.awt.event.ActionEvent e = evt;
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
switchBottomViewAction.actionPerformed(e);
}
});
}//GEN-LAST:event_bottomMenuItemActionPerformed
private void enableOrthoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableOrthoActionPerformed
@ -190,39 +262,47 @@ private void enableOrthoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
private javax.swing.JPopupMenu viewMenu;
// End of variables declaration//GEN-END:variables
public void toggleFrontView() {
viewButton.setIcon(frontMenuItem.getIcon());
viewButton.setText(frontMenuItem.getText());
}
public void toggleUserView() {
viewButton.setIcon(userIcon);
viewButton.setText(NbBundle.getMessage(CameraToolbar.class, "CameraToolbar.viewButton.label"));
}
public void toggleLeftView() {
viewButton.setIcon(leftMenuItem.getIcon());
viewButton.setText(leftMenuItem.getText());
}
public void toggleRightView() {
viewButton.setIcon(rightMenuItem.getIcon());
viewButton.setText(rightMenuItem.getText());
}
public void toggleBackView() {
viewButton.setIcon(backMenuItem.getIcon());
viewButton.setText(backMenuItem.getText());
}
public void toggleTopView() {
viewButton.setIcon(topMenuItem.getIcon());
viewButton.setText(topMenuItem.getText());
}
public void toggleBottomView() {
viewButton.setIcon(bottomMenuItem.getIcon());
viewButton.setText(bottomMenuItem.getText());
public void switchToView(View view) {
switch (view) {
case Front:
viewButton.setIcon(frontMenuItem.getIcon());
viewButton.setText(frontMenuItem.getText());
isUserView = false;
break;
case Left:
viewButton.setIcon(leftMenuItem.getIcon());
viewButton.setText(leftMenuItem.getText());
isUserView = false;
break;
case Right:
viewButton.setIcon(rightMenuItem.getIcon());
viewButton.setText(rightMenuItem.getText());
isUserView = false;
break;
case Back:
viewButton.setIcon(backMenuItem.getIcon());
viewButton.setText(backMenuItem.getText());
isUserView = false;
break;
case Top:
viewButton.setIcon(topMenuItem.getIcon());
viewButton.setText(topMenuItem.getText());
isUserView = false;
break;
case Bottom:
viewButton.setIcon(bottomMenuItem.getIcon());
viewButton.setText(bottomMenuItem.getText());
isUserView = false;
break;
case User:
default:
if (!isUserView) {
viewButton.setIcon(userIcon);
viewButton.setText(NbBundle.getMessage(CameraToolbar.class, "CameraToolbar.viewButton.label"));
isUserView = true;
}
}
}
public void toggleOrthoMode(boolean enabled) {

@ -94,7 +94,7 @@ public final class SceneViewerTopComponent extends TopComponent {
if (e.getWheelRotation() < 0) {
action = "MouseWheel";
}
app.getCamController().onAnalog(action, e.getWheelRotation(), 0);
app.getActiveCamController().onAnalog(action, e.getWheelRotation(), 0);
}
});
@ -327,7 +327,10 @@ public final class SceneViewerTopComponent extends TopComponent {
public void addAdditionnalToolbar(JToolBar tb){
// jToolBar1.add(tb,4);
jToolBar1.add(tb,4);
}
public void removeAdditionnalToolbar(JToolBar tb){
jToolBar1.remove(tb);
}
}

@ -0,0 +1,31 @@
package com.jme3.gde.core.sceneviewer.actions;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.core.util.CameraUtil.View;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionRegistration;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionID;
import org.openide.util.NbBundle.Messages;
@ActionID(category = "SceneComposer",
id = "com.jme3.gde.core.sceneviewer.actions.SwitchBackViewAction")
@ActionRegistration(displayName = "#CTL_SwitchBackViewAction")
@ActionReferences({
@ActionReference(path = "Shortcuts", name = "END")
})
@Messages("CTL_SwitchBackViewAction=Switch to back view")
public final class SwitchBackViewAction implements ActionListener {
public void actionPerformed(ActionEvent e) {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc.hasFocus()) {
SceneApplication.getApplication().getActiveCamController().switchToView(View.Back);
}
}
}

@ -0,0 +1,31 @@
package com.jme3.gde.core.sceneviewer.actions;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.core.util.CameraUtil.View;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionRegistration;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionID;
import org.openide.util.NbBundle.Messages;
@ActionID(category = "SceneComposer",
id = "com.jme3.gde.core.sceneviewer.actions.SwitchBottomViewAction")
@ActionRegistration(displayName = "#CTL_SwitchBottomViewAction")
@ActionReferences({
@ActionReference(path = "Shortcuts", name = "HOME")
})
@Messages("CTL_SwitchBottomViewAction=Switch to bottom view")
public final class SwitchBottomViewAction implements ActionListener {
public void actionPerformed(ActionEvent e) {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc.hasFocus()) {
SceneApplication.getApplication().getActiveCamController().switchToView(View.Bottom);
}
}
}

@ -1,6 +1,9 @@
package com.jme3.gde.core.sceneviewer.actions;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.core.util.CameraUtil.View;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionRegistration;
@ -10,23 +13,20 @@ import org.openide.awt.ActionID;
import org.openide.util.NbBundle.Messages;
@ActionID(category = "SceneComposer",
id = "com.jme3.gde.core.sceneviewer.actions.SwitchFrontViewAcction")
@ActionRegistration(displayName = "#CTL_SwitchFrontViewAcction")
id = "com.jme3.gde.core.sceneviewer.actions.SwitchFrontViewAction")
@ActionRegistration(displayName = "#CTL_SwitchFrontViewAction")
@ActionReferences({
@ActionReference(path = "Actions/jMonkeyPlatform"),
@ActionReference(path = "Shortcuts", name = "NUMPAD1")
})
@Messages("CTL_SwitchFrontViewAcction=Switch to front view")
@Messages("CTL_SwitchFrontViewAction=Switch to front view")
public final class SwitchFrontViewAction implements ActionListener {
public void actionPerformed(ActionEvent e) {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc.hasFocus()) {
System.out.println("front view");
SceneApplication.getApplication().getActiveCamController().switchToView(View.Front);
}
}
}

@ -0,0 +1,31 @@
package com.jme3.gde.core.sceneviewer.actions;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.core.util.CameraUtil.View;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionRegistration;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionID;
import org.openide.util.NbBundle.Messages;
@ActionID(category = "SceneComposer",
id = "com.jme3.gde.core.sceneviewer.actions.SwitchLeftViewAction")
@ActionRegistration(displayName = "#CTL_SwitchLeftViewAction")
@ActionReferences({
@ActionReference(path = "Shortcuts", name = "NUMPAD3")
})
@Messages("CTL_SwitchLeftViewAction=Switch to left view")
public final class SwitchLeftViewAction implements ActionListener {
public void actionPerformed(ActionEvent e) {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc.hasFocus()) {
SceneApplication.getApplication().getActiveCamController().switchToView(View.Left);
}
}
}

@ -0,0 +1,31 @@
package com.jme3.gde.core.sceneviewer.actions;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.core.util.CameraUtil.View;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionRegistration;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionID;
import org.openide.util.NbBundle.Messages;
@ActionID(category = "SceneComposer",
id = "com.jme3.gde.core.sceneviewer.actions.SwitchRightViewAction")
@ActionRegistration(displayName = "#CTL_SwitchRightViewAction")
@ActionReferences({
@ActionReference(path = "Shortcuts", name = "PAGE_DOWN")
})
@Messages("CTL_SwitchRightViewAction=Switch to right vue")
public final class SwitchRightViewAction implements ActionListener {
public void actionPerformed(ActionEvent e) {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc.hasFocus()) {
SceneApplication.getApplication().getActiveCamController().switchToView(View.Right);
}
}
}

@ -0,0 +1,31 @@
package com.jme3.gde.core.sceneviewer.actions;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.gde.core.util.CameraUtil.View;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionRegistration;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionID;
import org.openide.util.NbBundle.Messages;
@ActionID(category = "SceneComposer",
id = "com.jme3.gde.core.sceneviewer.actions.SwitchTopViewAction")
@ActionRegistration(displayName = "#CTL_SwitchTopViewAction")
@ActionReferences({
@ActionReference(path = "Shortcuts", name = "NUMPAD7")
})
@Messages("CTL_SwitchTopViewAction=Switch to top view")
public final class SwitchTopViewAction implements ActionListener {
public void actionPerformed(ActionEvent e) {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc.hasFocus()) {
SceneApplication.getApplication().getActiveCamController().switchToView(View.Top);
}
}
}

@ -1,6 +1,7 @@
package com.jme3.gde.core.sceneviewer.actions;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.scene.SceneRequest;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -27,7 +28,7 @@ public final class ToggleOrthoPerspAction implements ActionListener {
SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
if (svtc.hasFocus()) {
SceneApplication.getApplication().getCamController().toggleOrthoPerspMode();
SceneApplication.getApplication().getActiveCamController().toggleOrthoPerspMode();
}
}

@ -0,0 +1,16 @@
package com.jme3.gde.core.util;
/**
*
* @author Nehon
*/
public class CameraUtil {
public enum View{
Front,Left,Right,Top,Bottom,Back,User
}
}
Loading…
Cancel
Save