- fix +material issue for .scene loader
- check for actual name in AssetKey when warning about missing ogre material file

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9559 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 6c12291559
commit 558dc2bcbb
  1. 16
      sdk/jme3-ogrexml/src/com/jme3/gde/ogrexml/OgreSceneDataObject.java
  2. 8
      sdk/jme3-ogrexml/src/com/jme3/gde/ogrexml/OgreXMLDataObject.java

@ -61,17 +61,15 @@ public class OgreSceneDataObject extends SpatialAssetDataObject {
return null;
}
String name = getPrimaryFile().getName();
FileObject sourceMatFile = getPrimaryFile().getParent().getFileObject(name, "material");
if (sourceMatFile != null && sourceMatFile.isValid()) {
try {
sourceMatFile.copy(sourceMatFile.getParent(), "+" + sourceMatFile.getName(), sourceMatFile.getExt());
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
} else {
String matName = null;//((OgreSceneKey)getAssetKey()).getMaterialName();
if(matName == null){
matName = name;
}
FileObject sourceMatFile = getPrimaryFile().getParent().getFileObject(matName, "material");
if (sourceMatFile == null || !sourceMatFile.isValid()) {
Confirmation msg = new NotifyDescriptor.Confirmation(
"No material file found for " + getPrimaryFile().getNameExt() + "\n"
+ "A file named " + name + ".material should be in the same folder.\n"
+ "A file named " + matName + ".material should be in the same folder.\n"
+ "Press OK to import mesh only.",
NotifyDescriptor.OK_CANCEL_OPTION,
NotifyDescriptor.WARNING_MESSAGE);

@ -85,11 +85,15 @@ public class OgreXMLDataObject extends SpatialAssetDataObject {
if(idx!=-1){
name = name.substring(0, idx);
}
FileObject sourceMatFile = getPrimaryFile().getParent().getFileObject(name, "material");
String matName = ((OgreMeshKey)getAssetKey()).getMaterialName();
if(matName == null){
matName = name;
}
FileObject sourceMatFile = getPrimaryFile().getParent().getFileObject(matName, "material");
if (sourceMatFile == null || !sourceMatFile.isValid()) {
Confirmation msg = new NotifyDescriptor.Confirmation(
"No material file found for " + getPrimaryFile().getNameExt() + "\n"
+ "A file named " + name + ".material should be in the same folder.\n"
+ "A file named " + matName + ".material should be in the same folder.\n"
+ "Press OK to import mesh only.",
NotifyDescriptor.OK_CANCEL_OPTION,
NotifyDescriptor.WARNING_MESSAGE);

Loading…
Cancel
Save