From 27da3a106be53aeef7bdc1cb9325d52f95ddfb0c Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Mon, 11 Jun 2012 17:49:23 +0000 Subject: [PATCH] SDK: ModelImportTool - fix relative path creation by using correct ProjectAssetManager git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9481 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/com/jme3/gde/modelimporter/ImportModel.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java index 452eb4724..c7dd9cf34 100644 --- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java +++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ImportModel.java @@ -76,6 +76,7 @@ public final class ImportModel implements ActionListener { boolean keepFiles = (Boolean) wiz.getProperty("keepfiles"); List assetList = (List) wiz.getProperty("assetfiles"); String importPath = (String) wiz.getProperty("destpath"); + ProjectAssetManager importManager = (ProjectAssetManager) wiz.getProperty("manager"); ProjectAssetManager manager = context.getLookup().lookup(ProjectAssetManager.class); if (manager == null) { throw new IllegalStateException("Cannot find project AssetManager!"); @@ -84,7 +85,7 @@ public final class ImportModel implements ActionListener { for (Iterator it = assetList.iterator(); it.hasNext();) { FileObject source = it.next(); try { - String folderName = importPath + "/" + manager.getRelativeAssetPath(source.getParent().getPath()); + String folderName = importPath + "/" + importManager.getRelativeAssetPath(source.getParent().getPath()); FileObject dest = manager.getAssetFolder().getFileObject(folderName); if (dest == null) { dest = FileUtil.createFolder(manager.getAssetFolder(), folderName); @@ -100,6 +101,7 @@ public final class ImportModel implements ActionListener { fileObj.delete(); fileObj = source.copy(dest, source.getName(), source.getExt()); } else { + fileObj = null; } } else { fileObj = source.copy(dest, source.getName(), source.getExt()); @@ -109,9 +111,11 @@ public final class ImportModel implements ActionListener { AssetData data = obj.getLookup().lookup(AssetData.class); if (data != null) { AssetKey assetKey = data.getAssetKey(); - if (!(assetKey instanceof TextureKey) && fileObj != null) { + if (!(assetKey instanceof TextureKey)) { deleteList.add(fileObj); } + } else{ + deleteList.add(fileObj); } } } catch (Exception ex) {