- use OgreMaterialKey in ogre mesh and scene loader so one can add MaterialExtensionSets via an AssetEventListener

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7790 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 9a3353698a
commit 42feb50b76
  1. 4
      engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java
  2. 6
      engine/src/ogre/com/jme3/scene/plugins/ogre/SceneLoader.java

@ -31,6 +31,7 @@
*/ */
package com.jme3.scene.plugins.ogre; package com.jme3.scene.plugins.ogre;
import com.jme3.scene.plugins.ogre.matext.OgreMaterialKey;
import com.jme3.animation.AnimControl; import com.jme3.animation.AnimControl;
import com.jme3.animation.BoneAnimation; import com.jme3.animation.BoneAnimation;
import com.jme3.animation.SkeletonControl; import com.jme3.animation.SkeletonControl;
@ -46,7 +47,6 @@ import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.scene.Geometry; import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh; import com.jme3.scene.Mesh;
import com.jme3.scene.Node; import com.jme3.scene.Node;
import com.jme3.scene.Spatial.CullHint;
import com.jme3.scene.UserData; import com.jme3.scene.UserData;
import com.jme3.scene.VertexBuffer; import com.jme3.scene.VertexBuffer;
import com.jme3.scene.VertexBuffer.Format; import com.jme3.scene.VertexBuffer.Format;
@ -788,7 +788,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
materialList = meshKey.getMaterialList(); materialList = meshKey.getMaterialList();
} else { } else {
try { try {
materialList = (MaterialList) assetManager.loadAsset(folderName + meshName + ".material"); materialList = (MaterialList) assetManager.loadAsset(new OgreMaterialKey(folderName + meshName + ".material"));
} catch (AssetNotFoundException e) { } catch (AssetNotFoundException e) {
logger.log(Level.WARNING, "Cannot locate {0}{1}.material for model {2}{3}.{4}", new Object[]{folderName, meshName, folderName, meshName, ext}); logger.log(Level.WARNING, "Cannot locate {0}{1}.material for model {2}{3}.{4}", new Object[]{folderName, meshName, folderName, meshName, ext});
} }

@ -32,9 +32,9 @@
package com.jme3.scene.plugins.ogre; package com.jme3.scene.plugins.ogre;
import com.jme3.scene.plugins.ogre.matext.OgreMaterialKey;
import com.jme3.material.MaterialList; import com.jme3.material.MaterialList;
import com.jme3.asset.AssetInfo; import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetKey;
import com.jme3.asset.AssetLoader; import com.jme3.asset.AssetLoader;
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import com.jme3.asset.AssetNotFoundException; import com.jme3.asset.AssetNotFoundException;
@ -215,7 +215,7 @@ public class SceneLoader extends DefaultHandler implements AssetLoader {
assert elementStack.peek().equals("item"); assert elementStack.peek().equals("item");
String matFile = folderName+attribs.getValue("name"); String matFile = folderName+attribs.getValue("name");
try { try {
materialList = (MaterialList) assetManager.loadAsset(matFile); materialList = (MaterialList) assetManager.loadAsset(new OgreMaterialKey(matFile));
} catch (AssetNotFoundException ex){ } catch (AssetNotFoundException ex){
materialList = null; materialList = null;
logger.log(Level.WARNING, "Cannot locate material file: {0}", matFile); logger.log(Level.WARNING, "Cannot locate material file: {0}", matFile);
@ -350,7 +350,7 @@ public class SceneLoader extends DefaultHandler implements AssetLoader {
try { try {
materialList = (MaterialList) materialList = (MaterialList)
assetManager.loadAsset(new AssetKey(sceneName+".material")); assetManager.loadAsset(new OgreMaterialKey(sceneName+".material"));
} catch (AssetNotFoundException ex){ } catch (AssetNotFoundException ex){
logger.log(Level.WARNING, "Cannot locate material file {0}", ex.getMessage()); logger.log(Level.WARNING, "Cannot locate material file {0}", ex.getMessage());
} }

Loading…
Cancel
Save