diff --git a/sdk/jme3-ogretools/src/com/jme3/gde/ogretools/OgreBinaryMeshDataObject.java b/sdk/jme3-ogretools/src/com/jme3/gde/ogretools/OgreBinaryMeshDataObject.java index 1d560bd18..25c708781 100644 --- a/sdk/jme3-ogretools/src/com/jme3/gde/ogretools/OgreBinaryMeshDataObject.java +++ b/sdk/jme3-ogretools/src/com/jme3/gde/ogretools/OgreBinaryMeshDataObject.java @@ -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 newFiles = new ArrayList(); + for (Iterator 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 it = newFiles.iterator(); it.hasNext();) { + FileObject fileObject = it.next(); + assetList.add(fileObject); + } + } }