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 f92bd326a..663ddb39f 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 @@ -48,6 +48,8 @@ import com.jme3.scene.Node; import com.jme3.scene.Spatial; import com.jme3.scene.Spatial.CullHint; import com.jme3.system.AppSettings; +import com.jme3.system.awt.AwtPanel; +import com.jme3.system.awt.AwtPanelsContext; import java.io.IOException; import java.util.Collection; import java.util.Iterator; @@ -108,11 +110,14 @@ public class SceneApplication extends Application implements LookupProvider, Loo private ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Opening SceneViewer.."); private String lastError = ""; private boolean started = false; + private AwtPanel panel; + private ViewPort overlayView; public SceneApplication() { progressHandle.start(7); try { AppSettings newSetting = new AppSettings(true); + newSetting.setCustomRenderer(AwtPanelsContext.class); newSetting.setFrameRate(30); setSettings(newSetting); @@ -123,9 +128,9 @@ public class SceneApplication extends Application implements LookupProvider, Loo //add listener for project selection nodeSelectionResult = Utilities.actionsGlobalContext().lookupResult(JmeSpatial.class); nodeSelectionResult.addLookupListener(this); +// createCanvas(); +// startCanvas(true); - createCanvas(); - startCanvas(true); progressHandle.progress("initialize Base Application", 1); } catch (Exception e) { getProgressHandle().finish(); @@ -136,6 +141,20 @@ public class SceneApplication extends Application implements LookupProvider, Loo SceneViewerTopComponent.showOpenGLError(e.toString()); Exceptions.printStackTrace(e); } + start(); + } + + public AwtPanel getMainPanel() { + if (panel == null) { + panel = ((AwtPanelsContext) getContext()).createPanel(true); + panel.attachTo(viewPort, guiViewPort, overlayView); + ((AwtPanelsContext) getContext()).setInputSource(panel); + } + return panel; + } + + public ViewPort getOverlayView(){ + return overlayView; } private void loadFPSText() { @@ -160,6 +179,11 @@ public class SceneApplication extends Application implements LookupProvider, Loo public void initialize() { try { super.initialize(); + { + overlayView = getRenderManager().createMainView("Overlay", cam); + overlayView.setClearFlags(false, true, false); + guiViewPort.setClearFlags(false, false, false); + } getProgressHandle().progress("Setup Camera Controller", 2); //create camera controler camController = new SceneCameraController(cam, inputManager); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java index 8bd821e4a..aaab81d9b 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java @@ -29,8 +29,8 @@ import com.jme3.gde.core.scene.SceneApplication; import com.jme3.gde.core.scene.SceneRequest; import com.jme3.input.awt.AwtKeyInput; import com.jme3.input.event.KeyInputEvent; -import com.jme3.system.JmeCanvasContext; -import java.awt.Canvas; +import com.jme3.system.awt.AwtPanel; +import com.jme3.system.awt.AwtPanelsContext; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseWheelEvent; @@ -64,7 +64,8 @@ public final class SceneViewerTopComponent extends TopComponent { private static final String PREFERRED_ID = "SceneViewerTopComponent"; private SceneApplication app; private HelpCtx helpContext = new HelpCtx("com.jme3.gde.core.sceneviewer"); - private Canvas oglCanvas; +// private Canvas oglCanvas; + private AwtPanel oglCanvas; public SceneViewerTopComponent() { initComponents(); @@ -75,7 +76,8 @@ public final class SceneViewerTopComponent extends TopComponent { setIcon(ImageUtilities.loadImage(ICON_PATH, true)); try { app = SceneApplication.getApplication(); - oglCanvas = ((JmeCanvasContext) app.getContext()).getCanvas(); +// oglCanvas = ((JmeCanvasContext) app.getContext()).getCanvas(); + oglCanvas = app.getMainPanel(); oGLPanel.add(oglCanvas); } catch (Exception e) { @@ -292,6 +294,7 @@ public final class SceneViewerTopComponent extends TopComponent { @Override public void componentOpened() { super.componentOpened(); + oglCanvas.setActiveUpdates(true); } @Override @@ -307,6 +310,7 @@ public final class SceneViewerTopComponent extends TopComponent { @Override public void componentClosed() { super.componentClosed(); + oglCanvas.setActiveUpdates(false); SceneRequest req = SceneApplication.getApplication().getCurrentSceneRequest(); if (req != null) { SceneApplication.getApplication().closeScene(req); diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerToolController.java b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerToolController.java index 49836898e..162c228a3 100644 --- a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerToolController.java +++ b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerToolController.java @@ -65,8 +65,8 @@ public class SceneComposerToolController extends SceneToolController { // a node in a viewport that will always render on top onTopToolsNode = new Node("OverlayNode"); - overlayView = SceneApplication.getApplication().getRenderManager().createMainView("Overlay", this.cameraController.getCamera()); - overlayView.setClearFlags(false, true, false); + overlayView = SceneApplication.getApplication().getOverlayView(); +// overlayView.setClearFlags(false, true, false); overlayView.attachScene(onTopToolsNode); }