From 05d5c611e135b69ba39eef6e18cfa6f42144e08a Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sun, 20 May 2012 19:49:36 +0000 Subject: [PATCH] * AndroidAssetManager no longer fails on missing plugin classes git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9406 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/asset/AndroidAssetManager.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/engine/src/android/com/jme3/asset/AndroidAssetManager.java b/engine/src/android/com/jme3/asset/AndroidAssetManager.java index b8093ac4f..711b55c84 100644 --- a/engine/src/android/com/jme3/asset/AndroidAssetManager.java +++ b/engine/src/android/com/jme3/asset/AndroidAssetManager.java @@ -59,9 +59,10 @@ public class AndroidAssetManager extends DesktopAssetManager { this(null); } - private void registerLoaderSafe(Class loaderClass, String ... extensions) { + private void registerLoaderSafe(String loaderClass, String ... extensions) { try { - registerLoader(loaderClass, extensions); + Class loader = (Class) Class.forName(loaderClass); + registerLoader(loader, extensions); } catch (Exception e){ logger.log(Level.WARNING, "Failed to load AssetLoader", e); } @@ -88,16 +89,16 @@ public class AndroidAssetManager extends DesktopAssetManager { registerLoader(com.jme3.font.plugins.BitmapFontLoader.class, "fnt"); // Less common loaders (especially on Android) - registerLoaderSafe(com.jme3.texture.plugins.DDSLoader.class, "dds"); - registerLoaderSafe(com.jme3.texture.plugins.PFMLoader.class, "pfm"); - registerLoaderSafe(com.jme3.texture.plugins.HDRLoader.class, "hdr"); - registerLoaderSafe(com.jme3.texture.plugins.TGALoader.class, "tga"); - registerLoaderSafe(com.jme3.scene.plugins.OBJLoader.class, "obj"); - registerLoaderSafe(com.jme3.scene.plugins.MTLLoader.class, "mtl"); - registerLoaderSafe(com.jme3.scene.plugins.ogre.MeshLoader.class, "mesh.xml"); - registerLoaderSafe(com.jme3.scene.plugins.ogre.SkeletonLoader.class, "skeleton.xml"); - registerLoaderSafe(com.jme3.scene.plugins.ogre.MaterialLoader.class, "material"); - registerLoaderSafe(com.jme3.scene.plugins.ogre.SceneLoader.class, "scene"); + registerLoaderSafe("com.jme3.texture.plugins.DDSLoader", "dds"); + registerLoaderSafe("com.jme3.texture.plugins.PFMLoader", "pfm"); + registerLoaderSafe("com.jme3.texture.plugins.HDRLoader", "hdr"); + registerLoaderSafe("com.jme3.texture.plugins.TGALoader", "tga"); + registerLoaderSafe("com.jme3.scene.plugins.OBJLoader", "obj"); + registerLoaderSafe("com.jme3.scene.plugins.MTLLoader", "mtl"); + registerLoaderSafe("com.jme3.scene.plugins.ogre.MeshLoader", "mesh.xml"); + registerLoaderSafe("com.jme3.scene.plugins.ogre.SkeletonLoader", "skeleton.xml"); + registerLoaderSafe("com.jme3.scene.plugins.ogre.MaterialLoader", "material"); + registerLoaderSafe("com.jme3.scene.plugins.ogre.SceneLoader", "scene"); logger.info("AndroidAssetManager created.");