diff --git a/jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java b/jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java index fc6ef7683..bbbfaca7a 100644 --- a/jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java +++ b/jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java @@ -20,6 +20,7 @@ import com.jme3.util.AndroidScreenshots; import java.io.File; import java.io.IOException; import java.io.OutputStream; +import java.net.URL; import java.nio.ByteBuffer; import java.util.logging.Level; @@ -36,8 +37,8 @@ public class JmeAndroidSystem extends JmeSystemDelegate { } @Override - public String getPlatformAssetConfigPath() { - return "com/jme3/asset/Android.cfg"; + public URL getPlatformAssetConfigURL() { + return Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Android.cfg"); } @Override diff --git a/jme3-core/src/main/java/com/jme3/app/Application.java b/jme3-core/src/main/java/com/jme3/app/Application.java index 2bcd6a4d9..81fdb6d3b 100644 --- a/jme3-core/src/main/java/com/jme3/app/Application.java +++ b/jme3-core/src/main/java/com/jme3/app/Application.java @@ -193,8 +193,7 @@ public class Application implements SystemListener { } } if (assetCfgUrl == null) { - String assetCfg = JmeSystem.getPlatformAssetConfigPath(); - assetCfgUrl = Thread.currentThread().getContextClassLoader().getResource(assetCfg); + assetCfgUrl = JmeSystem.getPlatformAssetConfigURL(); } if (assetManager == null){ assetManager = JmeSystem.newAssetManager(assetCfgUrl); diff --git a/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java b/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java index 21b9808d8..bbf4f9472 100644 --- a/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java +++ b/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java @@ -45,6 +45,7 @@ import com.jme3.shader.Glsl150ShaderGenerator; import com.jme3.shader.Shader; import com.jme3.shader.ShaderGenerator; import com.jme3.shader.ShaderKey; +import com.jme3.system.JmeSystem; import com.jme3.texture.Texture; import java.io.IOException; import java.io.InputStream; @@ -80,6 +81,10 @@ public class DesktopAssetManager implements AssetManager { public DesktopAssetManager(){ this(null); } + + public DesktopAssetManager(boolean usePlatformConfig){ + this(usePlatformConfig ? JmeSystem.getPlatformAssetConfigURL() : null); + } public DesktopAssetManager(URL configFile){ if (configFile != null){ diff --git a/jme3-core/src/main/java/com/jme3/system/JmeSystem.java b/jme3-core/src/main/java/com/jme3/system/JmeSystem.java index a29262726..1ec695388 100644 --- a/jme3-core/src/main/java/com/jme3/system/JmeSystem.java +++ b/jme3-core/src/main/java/com/jme3/system/JmeSystem.java @@ -167,9 +167,9 @@ public class JmeSystem { return systemDelegate.newAudioRenderer(settings); } - public static String getPlatformAssetConfigPath() { + public static URL getPlatformAssetConfigURL() { checkDelegate(); - return systemDelegate.getPlatformAssetConfigPath(); + return systemDelegate.getPlatformAssetConfigURL(); } /** diff --git a/jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java b/jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java index a129f6423..a3f75bd9a 100644 --- a/jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java +++ b/jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java @@ -193,7 +193,7 @@ public abstract class JmeSystemDelegate { return sb.toString(); } - public abstract String getPlatformAssetConfigPath(); + public abstract URL getPlatformAssetConfigURL(); public abstract JmeContext newContext(AppSettings settings, JmeContext.Type contextType); diff --git a/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java b/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java index f719a04ef..37a01e8ed 100644 --- a/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java +++ b/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java @@ -33,18 +33,13 @@ package com.jme3.system; import com.jme3.app.SettingsDialog; import com.jme3.app.SettingsDialog.SelectionListener; -import com.jme3.asset.AssetManager; import com.jme3.asset.AssetNotFoundException; -import com.jme3.asset.DesktopAssetManager; import com.jme3.audio.AudioRenderer; import com.jme3.audio.openal.AL; import com.jme3.audio.openal.ALAudioRenderer; import com.jme3.audio.openal.ALC; import com.jme3.audio.openal.EFX; import com.jme3.system.JmeContext.Type; -import com.jme3.texture.Image; -import com.jme3.texture.image.DefaultImageRaster; -import com.jme3.texture.image.ImageRaster; import com.jme3.util.Screenshots; import java.awt.EventQueue; import java.awt.Graphics2D; @@ -75,8 +70,8 @@ import javax.swing.SwingUtilities; public class JmeDesktopSystem extends JmeSystemDelegate { @Override - public String getPlatformAssetConfigPath() { - return "com/jme3/asset/Desktop.cfg"; + public URL getPlatformAssetConfigURL() { + return Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/Desktop.cfg"); } private static BufferedImage verticalFlip(BufferedImage original) { diff --git a/jme3-ios/src/main/java/com/jme3/system/ios/JmeIosSystem.java b/jme3-ios/src/main/java/com/jme3/system/ios/JmeIosSystem.java index 1ffb097f7..904db71cf 100644 --- a/jme3-ios/src/main/java/com/jme3/system/ios/JmeIosSystem.java +++ b/jme3-ios/src/main/java/com/jme3/system/ios/JmeIosSystem.java @@ -38,6 +38,7 @@ import com.jme3.system.JmeSystemDelegate; import com.jme3.system.NullContext; import java.io.IOException; import java.io.OutputStream; +import java.net.URL; import java.nio.ByteBuffer; import java.util.logging.Logger; @@ -48,8 +49,8 @@ import java.util.logging.Logger; public class JmeIosSystem extends JmeSystemDelegate { @Override - public String getPlatformAssetConfigPath() { - return "com/jme3/asset/IOS.cfg"; + public URL getPlatformAssetConfigURL() { + return Thread.currentThread().getContextClassLoader().getResource("com/jme3/asset/IOS.cfg"); } @Override diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/nvcompress/NVCompress.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/nvcompress/NVCompress.java index 46e2be144..12d3071e4 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/nvcompress/NVCompress.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/nvcompress/NVCompress.java @@ -454,7 +454,7 @@ public class NVCompress extends javax.swing.JFrame { manager = JmeSystem.newAssetManager(); manager.registerLocator(input.getParent().toString(), - FileLocator.class.getName()); + FileLocator.class); String format = (String) cmbCompressType.getSelectedItem(); if (format.equals("PNG-RGBE")){