diff --git a/sdk/jme3-core/src/com/jme3/gde/core/layer.xml b/sdk/jme3-core/src/com/jme3/gde/core/layer.xml
index fe9569bea..af81cc3f9 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/layer.xml
+++ b/sdk/jme3-core/src/com/jme3/gde/core/layer.xml
@@ -16,8 +16,11 @@
+
+
+
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
index 3002b7794..3ece99852 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
@@ -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;
+ }
+
+
}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java
index b003aee2a..ef43f2622 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java
@@ -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() {
+ CameraToolbar.getInstance().toggleOrthoMode(SceneApplication.getApplication().enqueue(new Callable() {
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