From 67adc1737c070d6166d6b175c801dc2e92534ccd Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Mon, 28 Mar 2011 13:25:36 +0000 Subject: [PATCH] - add workaround for previews (SceneViewer opens when preview is needed) git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7134 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/com/jme3/gde/core/scene/OffScenePanel.java | 9 +++++++++ .../gde/materials/multiview/MaterialOpenSupport.java | 8 +++++--- .../gde/modelimporter/ModelImporterVisualPanel1.java | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/OffScenePanel.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/OffScenePanel.java index 8180664b8..e511da190 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/OffScenePanel.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/OffScenePanel.java @@ -37,6 +37,7 @@ */ package com.jme3.gde.core.scene; +import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent; import com.jme3.light.PointLight; import com.jme3.math.ColorRGBA; import com.jme3.math.FastMath; @@ -125,6 +126,14 @@ public class OffScenePanel extends javax.swing.JPanel implements SceneProcessor } public void startPreview() { + java.awt.EventQueue.invokeLater(new Runnable() { + + public void run() { + if(!SceneViewerTopComponent.findInstance().isOpened()){ + SceneViewerTopComponent.findInstance().open(); + } + } + }); SceneApplication.getApplication().enqueue(new Callable() { public Object call() throws Exception { diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialOpenSupport.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialOpenSupport.java index ce1aecc5d..62d945c89 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialOpenSupport.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/MaterialOpenSupport.java @@ -2,9 +2,9 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ - package com.jme3.gde.materials.multiview; +import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent; import com.jme3.gde.materials.JMEMaterialDataObject; import org.openide.cookies.CloseCookie; import org.openide.cookies.OpenCookie; @@ -22,9 +22,11 @@ public class MaterialOpenSupport extends OpenSupport implements OpenCookie, Clos } protected CloneableTopComponent createCloneableTopComponent() { + if (!SceneViewerTopComponent.findInstance().isOpened()) { + SceneViewerTopComponent.findInstance().open(); + } JMEMaterialDataObject dobj = (JMEMaterialDataObject) entry.getDataObject(); MaterialEditorTopComponent tc = new MaterialEditorTopComponent(dobj); return tc; } - -} \ No newline at end of file +} diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.java b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.java index 143c95638..6e5522e62 100644 --- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.java +++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.java @@ -77,7 +77,7 @@ public final class ModelImporterVisualPanel1 extends JPanel implements AssetEven currentModel = (Spatial) manager.loadAsset(mainKey); if (currentModel != null) { offPanel.attach(currentModel); - }else{ + } else { Message msg = new NotifyDescriptor.Message( "Cannot import this file!", NotifyDescriptor.ERROR_MESSAGE); @@ -104,6 +104,7 @@ public final class ModelImporterVisualPanel1 extends JPanel implements AssetEven public void assetRequested(AssetKey ak) { if (!"j3md".equalsIgnoreCase(ak.getExtension()) + && !"glsllib".equalsIgnoreCase(ak.getExtension()) && !"frag".equalsIgnoreCase(ak.getExtension()) && !"vert".equalsIgnoreCase(ak.getExtension())) { requestedAssets.add(ak);