- Update OgreBinaryMeshDataObject and AbstractBlenderImportDataObject

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10307 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent c994965510
commit f071680b95
  1. 6
      sdk/jme3-blender/src/com/jme3/gde/blender/filetypes/AbstractBlenderImportDataObject.java
  2. 10
      sdk/jme3-ogretools/src/com/jme3/gde/ogretools/OgreBinaryMeshDataObject.java

@ -9,6 +9,7 @@ import com.jme3.gde.blender.BlenderTool;
import com.jme3.gde.core.assets.ProjectAssetManager; import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.gde.core.assets.SpatialAssetDataObject; import com.jme3.gde.core.assets.SpatialAssetDataObject;
import com.jme3.gde.core.util.Beans; import com.jme3.gde.core.util.Beans;
import com.jme3.gde.core.util.SpatialUtil;
import com.jme3.scene.Spatial; import com.jme3.scene.Spatial;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Level; import java.util.logging.Level;
@ -35,6 +36,9 @@ public abstract class AbstractBlenderImportDataObject extends SpatialAssetDataOb
@Override @Override
public Spatial loadAsset() { public Spatial loadAsset() {
if (savable != null) {
return (Spatial) savable;
}
if (SUFFIX == null) { if (SUFFIX == null) {
throw new IllegalStateException("Suffix for blender filetype is null! Set SUFFIX = \"sfx\" in constructor!"); throw new IllegalStateException("Suffix for blender filetype is null! Set SUFFIX = \"sfx\" in constructor!");
} }
@ -73,7 +77,7 @@ public abstract class AbstractBlenderImportDataObject extends SpatialAssetDataOb
replaceFiles(); replaceFiles();
listListener.stop(); listListener.stop();
savable = spatial; savable = spatial;
storeOriginalPathUserData(); SpatialUtil.storeOriginalPathUserData(spatial);
return spatial; return spatial;
} catch (IOException ex) { } catch (IOException ex) {
Exceptions.printStackTrace(ex); Exceptions.printStackTrace(ex);

@ -7,21 +7,18 @@ package com.jme3.gde.ogretools;
import com.jme3.asset.AssetKey; import com.jme3.asset.AssetKey;
import com.jme3.gde.core.assets.ProjectAssetManager; import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.gde.core.assets.SpatialAssetDataObject; import com.jme3.gde.core.assets.SpatialAssetDataObject;
import com.jme3.gde.core.util.SpatialUtil;
import com.jme3.gde.ogretools.convert.OgreXMLConvert; import com.jme3.gde.ogretools.convert.OgreXMLConvert;
import com.jme3.gde.ogretools.convert.OgreXMLConvertOptions; import com.jme3.gde.ogretools.convert.OgreXMLConvertOptions;
import com.jme3.scene.Spatial; import com.jme3.scene.Spatial;
import java.io.File; import java.io.File;
import java.io.IOException; 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.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory; import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.DialogDisplayer; import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor; import org.openide.NotifyDescriptor;
import org.openide.filesystems.FileLock; import org.openide.filesystems.FileLock;
import org.openide.filesystems.FileObject; import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObjectExistsException; import org.openide.loaders.DataObjectExistsException;
import org.openide.loaders.MultiFileLoader; import org.openide.loaders.MultiFileLoader;
import org.openide.util.Exceptions; import org.openide.util.Exceptions;
@ -34,6 +31,9 @@ public class OgreBinaryMeshDataObject extends SpatialAssetDataObject {
@Override @Override
public Spatial loadAsset() { public Spatial loadAsset() {
if (savable != null) {
return (Spatial) savable;
}
ProgressHandle handle = ProgressHandleFactory.createHandle("Converting OgreBinary"); ProgressHandle handle = ProgressHandleFactory.createHandle("Converting OgreBinary");
handle.start(); handle.start();
//mesh //mesh
@ -64,7 +64,7 @@ public class OgreBinaryMeshDataObject extends SpatialAssetDataObject {
replaceXmlFiles(mgr); replaceXmlFiles(mgr);
listListener.stop(); listListener.stop();
savable = spatial; savable = spatial;
storeOriginalPathUserData(); SpatialUtil.storeOriginalPathUserData(spatial);
lock.releaseLock(); lock.releaseLock();
File deleteFile = new File(options.getDestFile()); File deleteFile = new File(options.getDestFile());
deleteFile.delete(); deleteFile.delete();

Loading…
Cancel
Save