From 7d07cedc4ceaec2b3761c9670d5d3fde11701356 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sun, 6 Sep 2015 20:19:04 +0200 Subject: [PATCH] Fixed Issue #46 : The MaterialViewer will now simply ignore not available textures instead of crashing --- .../gde/materials/multiview/widgets/TexturePanel.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java index b414a1126..0129535e4 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java @@ -10,15 +10,19 @@ */ package com.jme3.gde.materials.multiview.widgets; +import com.jme3.asset.AssetNotFoundException; import com.jme3.gde.core.assets.ProjectAssetManager; import com.jme3.gde.core.properties.TexturePropertyEditor; import com.jme3.gde.core.properties.preview.DDSPreview; import com.jme3.gde.materials.MaterialProperty; +import com.jme3.gde.materials.multiview.MaterialEditorTopComponent; import com.jme3.texture.Texture; import java.awt.Component; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.Icon; import javax.swing.SwingUtilities; import jme3tools.converters.ImageToAwt; @@ -50,7 +54,7 @@ public class TexturePanel extends MaterialPropertyWidget { exec.execute(new Runnable() { public void run() { - + try{ Texture tex = manager.loadTexture(textureName); if (textureName.toLowerCase().endsWith(".dds")) { if (ddsPreview == null) { @@ -65,6 +69,9 @@ public class TexturePanel extends MaterialPropertyWidget { } }); } + } catch (AssetNotFoundException a) { + Logger.getLogger(MaterialEditorTopComponent.class.getName()).log(Level.WARNING, "Could not load texture {0}", textureName); + } } }); }