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
This commit is contained in:
parent
77b827ce6b
commit
27da3a106b
@ -76,6 +76,7 @@ public final class ImportModel implements ActionListener {
|
|||||||
boolean keepFiles = (Boolean) wiz.getProperty("keepfiles");
|
boolean keepFiles = (Boolean) wiz.getProperty("keepfiles");
|
||||||
List<FileObject> assetList = (List<FileObject>) wiz.getProperty("assetfiles");
|
List<FileObject> assetList = (List<FileObject>) wiz.getProperty("assetfiles");
|
||||||
String importPath = (String) wiz.getProperty("destpath");
|
String importPath = (String) wiz.getProperty("destpath");
|
||||||
|
ProjectAssetManager importManager = (ProjectAssetManager) wiz.getProperty("manager");
|
||||||
ProjectAssetManager manager = context.getLookup().lookup(ProjectAssetManager.class);
|
ProjectAssetManager manager = context.getLookup().lookup(ProjectAssetManager.class);
|
||||||
if (manager == null) {
|
if (manager == null) {
|
||||||
throw new IllegalStateException("Cannot find project AssetManager!");
|
throw new IllegalStateException("Cannot find project AssetManager!");
|
||||||
@ -84,7 +85,7 @@ public final class ImportModel implements ActionListener {
|
|||||||
for (Iterator<FileObject> it = assetList.iterator(); it.hasNext();) {
|
for (Iterator<FileObject> it = assetList.iterator(); it.hasNext();) {
|
||||||
FileObject source = it.next();
|
FileObject source = it.next();
|
||||||
try {
|
try {
|
||||||
String folderName = importPath + "/" + manager.getRelativeAssetPath(source.getParent().getPath());
|
String folderName = importPath + "/" + importManager.getRelativeAssetPath(source.getParent().getPath());
|
||||||
FileObject dest = manager.getAssetFolder().getFileObject(folderName);
|
FileObject dest = manager.getAssetFolder().getFileObject(folderName);
|
||||||
if (dest == null) {
|
if (dest == null) {
|
||||||
dest = FileUtil.createFolder(manager.getAssetFolder(), folderName);
|
dest = FileUtil.createFolder(manager.getAssetFolder(), folderName);
|
||||||
@ -100,6 +101,7 @@ public final class ImportModel implements ActionListener {
|
|||||||
fileObj.delete();
|
fileObj.delete();
|
||||||
fileObj = source.copy(dest, source.getName(), source.getExt());
|
fileObj = source.copy(dest, source.getName(), source.getExt());
|
||||||
} else {
|
} else {
|
||||||
|
fileObj = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileObj = source.copy(dest, source.getName(), source.getExt());
|
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);
|
AssetData data = obj.getLookup().lookup(AssetData.class);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
AssetKey assetKey = data.getAssetKey();
|
AssetKey assetKey = data.getAssetKey();
|
||||||
if (!(assetKey instanceof TextureKey) && fileObj != null) {
|
if (!(assetKey instanceof TextureKey)) {
|
||||||
deleteList.add(fileObj);
|
deleteList.add(fileObj);
|
||||||
}
|
}
|
||||||
|
} else{
|
||||||
|
deleteList.add(fileObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user