- refresh parent and created folder after model import

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7176 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 86a4ad3718
commit b6386751e4
  1. 20
      sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java

@ -58,12 +58,12 @@ public final class ImportModel implements ActionListener {
dialog.setVisible(true); dialog.setVisible(true);
dialog.toFront(); dialog.toFront();
boolean cancelled = wiz.getValue() != WizardDescriptor.FINISH_OPTION; boolean cancelled = wiz.getValue() != WizardDescriptor.FINISH_OPTION;
((ModelImporterWizardPanel1)panels[0]).cleanup(); ((ModelImporterWizardPanel1) panels[0]).cleanup();
if (!cancelled) { if (!cancelled) {
new Thread(new Runnable() { new Thread(new Runnable() {
public void run() { public void run() {
ProgressHandle handle=ProgressHandleFactory.createHandle("Importing Model.."); ProgressHandle handle = ProgressHandleFactory.createHandle("Importing Model..");
handle.start(); handle.start();
try { try {
copyModel(wiz); copyModel(wiz);
@ -86,7 +86,7 @@ public final class ImportModel implements ActionListener {
if (manager == null) { if (manager == null) {
throw new IllegalStateException("Cannot find project AssetManager!"); throw new IllegalStateException("Cannot find project AssetManager!");
} }
List<FileObject> deleteList=new LinkedList<FileObject>(); List<FileObject> deleteList = new LinkedList<FileObject>();
for (Iterator<AssetKey> it = keyList.iterator(); it.hasNext();) { for (Iterator<AssetKey> it = keyList.iterator(); it.hasNext();) {
AssetKey assetKey = it.next(); AssetKey assetKey = it.next();
File file = new File(path + "/" + assetKey.getFolder() + assetKey.getName()); File file = new File(path + "/" + assetKey.getFolder() + assetKey.getName());
@ -96,8 +96,8 @@ public final class ImportModel implements ActionListener {
destFolder.mkdirs(); destFolder.mkdirs();
FileObject dest = FileUtil.toFileObject(destFolder); FileObject dest = FileUtil.toFileObject(destFolder);
try { try {
FileObject fileObj=source.copy(dest, source.getName(), source.getExt()); FileObject fileObj = source.copy(dest, source.getName(), source.getExt());
if(!(assetKey instanceof TextureKey)){ if (!(assetKey instanceof TextureKey)) {
deleteList.add(fileObj); deleteList.add(fileObj);
} }
} catch (IOException ex) { } catch (IOException ex) {
@ -116,7 +116,7 @@ public final class ImportModel implements ActionListener {
Spatial spat = ((SpatialAssetDataObject) targetModel).loadAsset(); Spatial spat = ((SpatialAssetDataObject) targetModel).loadAsset();
if (spat == null) { if (spat == null) {
throw new IllegalStateException("Cannot load model after copying!"); throw new IllegalStateException("Cannot load model after copying!");
} }
BinaryExporter exp = BinaryExporter.getInstance(); BinaryExporter exp = BinaryExporter.getInstance();
exp.save(spat, outFile); exp.save(spat, outFile);
@ -124,7 +124,7 @@ public final class ImportModel implements ActionListener {
} catch (Exception ex) { } catch (Exception ex) {
Exceptions.printStackTrace(ex); Exceptions.printStackTrace(ex);
} }
if(!keepFiles){ if (!keepFiles) {
for (Iterator<FileObject> it = deleteList.iterator(); it.hasNext();) { for (Iterator<FileObject> it = deleteList.iterator(); it.hasNext();) {
FileObject fileObject = it.next(); FileObject fileObject = it.next();
try { try {
@ -134,8 +134,10 @@ public final class ImportModel implements ActionListener {
} }
} }
} }
FileObject dest = FileUtil.toFileObject(new File(manager.getAssetFolderName() + "/" + importPath).getParentFile()); FileObject importFolder = manager.getAssetFolder().getFileObject(importPath);//FileUtil.toFileObject(new File(manager.getAssetFolderName() + "/" + importPath));
dest.refresh(); FileObject importParentFolder = importFolder.getParent();
importParentFolder.refresh();
importFolder.refresh();
} }
/** /**

Loading…
Cancel
Save