- fix Ogre binary importer asset list managing

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10236 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 527a7b5321
commit f158717981
  1. 19
      sdk/jme3-ogretools/src/com/jme3/gde/ogretools/OgreBinaryMeshDataObject.java

@ -61,7 +61,7 @@ public class OgreBinaryMeshDataObject extends SpatialAssetDataObject {
listListener.start();
Spatial spatial = mgr.loadModel(assetKey);
//replace transient xml files in list of assets for this model
replaceXmlFiles();
replaceXmlFiles(mgr);
listListener.stop();
savable = spatial;
lock.releaseLock();
@ -81,21 +81,18 @@ public class OgreBinaryMeshDataObject extends SpatialAssetDataObject {
return null;
}
private void replaceXmlFiles() {
List<FileObject> newFiles = new ArrayList<FileObject>();
for (Iterator<FileObject> it = assetList.iterator(); it.hasNext();) {
FileObject fileObject = it.next();
private void replaceXmlFiles(ProjectAssetManager mgr) {
for (int i = 0; i < assetList.size(); i++) {
FileObject fileObject = assetList.get(i);
if (fileObject.hasExt("xml")) {
FileObject binaryFile = fileObject.getParent().getFileObject(fileObject.getName());
if (binaryFile != null) {
newFiles.add(binaryFile);
it.remove();
assetList.remove(i);
assetList.add(i, binaryFile);
assetKeyList.remove(i);
assetKeyList.add(i, new AssetKey(mgr.getRelativeAssetPath(binaryFile.getPath())));
}
}
}
for (Iterator<FileObject> it = newFiles.iterator(); it.hasNext();) {
FileObject fileObject = it.next();
assetList.add(fileObject);
}
}
}

Loading…
Cancel
Save