AssetConfig: Platform asset config now returned as URL

- Return back DesktopAssetManager constructor with boolean argument - this time it shall use platform config instead of always using Desktop.cfg
experimental
shadowislord 10 years ago
parent d55a859240
commit 40926dc32d
  1. 5
      jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java
  2. 3
      jme3-core/src/main/java/com/jme3/app/Application.java
  3. 5
      jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java
  4. 4
      jme3-core/src/main/java/com/jme3/system/JmeSystem.java
  5. 2
      jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java
  6. 9
      jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java
  7. 5
      jme3-ios/src/main/java/com/jme3/system/ios/JmeIosSystem.java
  8. 2
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/nvcompress/NVCompress.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

@ -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);

@ -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;
@ -81,6 +82,10 @@ public class DesktopAssetManager implements AssetManager {
this(null);
}
public DesktopAssetManager(boolean usePlatformConfig){
this(usePlatformConfig ? JmeSystem.getPlatformAssetConfigURL() : null);
}
public DesktopAssetManager(URL configFile){
if (configFile != null){
loadConfigFile(configFile);

@ -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();
}
/**

@ -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);

@ -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) {

@ -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

@ -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")){

Loading…
Cancel
Save