SDK:
- enable asset list for binary ogre files git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9479 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
49f6e62048
commit
740a6fcf9a
@ -4,6 +4,7 @@
|
||||
*/
|
||||
package com.jme3.gde.ogretools;
|
||||
|
||||
import com.jme3.asset.AssetKey;
|
||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||
import com.jme3.gde.core.assets.SpatialAssetDataObject;
|
||||
import com.jme3.gde.ogretools.convert.OgreXMLConvert;
|
||||
@ -11,12 +12,16 @@ import com.jme3.gde.ogretools.convert.OgreXMLConvertOptions;
|
||||
import com.jme3.scene.Spatial;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.netbeans.api.progress.ProgressHandle;
|
||||
import org.netbeans.api.progress.ProgressHandleFactory;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.filesystems.FileLock;
|
||||
import org.openide.filesystems.FileObject;
|
||||
import org.openide.filesystems.FileUtil;
|
||||
import org.openide.loaders.DataObjectExistsException;
|
||||
import org.openide.loaders.MultiFileLoader;
|
||||
import org.openide.util.Exceptions;
|
||||
@ -53,7 +58,11 @@ public class OgreBinaryMeshDataObject extends SpatialAssetDataObject {
|
||||
FileLock lock = null;
|
||||
try {
|
||||
lock = getPrimaryFile().lock();
|
||||
listListener.start();
|
||||
Spatial spatial = mgr.loadModel(assetKey);
|
||||
//replace transient xml files in list of assets for this model
|
||||
replaceXmlFiles();
|
||||
listListener.stop();
|
||||
savable = spatial;
|
||||
lock.releaseLock();
|
||||
File deleteFile = new File(options.getDestFile());
|
||||
@ -71,4 +80,22 @@ public class OgreBinaryMeshDataObject extends SpatialAssetDataObject {
|
||||
handle.finish();
|
||||
return null;
|
||||
}
|
||||
|
||||
private void replaceXmlFiles() {
|
||||
List<FileObject> newFiles = new ArrayList<FileObject>();
|
||||
for (Iterator<FileObject> it = assetList.iterator(); it.hasNext();) {
|
||||
FileObject fileObject = it.next();
|
||||
if (fileObject.hasExt("xml")) {
|
||||
FileObject binaryFile = fileObject.getParent().getFileObject(fileObject.getName());
|
||||
if (binaryFile != null) {
|
||||
newFiles.add(binaryFile);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Iterator<FileObject> it = newFiles.iterator(); it.hasNext();) {
|
||||
FileObject fileObject = it.next();
|
||||
assetList.add(fileObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user