From 4bbadc5ecfcd2eb97bb8121b318c2e09d07767d9 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Mon, 17 Oct 2011 23:30:18 +0000 Subject: [PATCH] - fix empty asset list in ModelImportTool when reloading model with key settings git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8436 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../modelimporter/ModelImporterVisualPanel1.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.java b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.java index 498474988..4d12054dc 100644 --- a/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.java +++ b/sdk/jme3-model-importer/src/com/jme3/gde/modelimporter/ModelImporterVisualPanel1.java @@ -76,10 +76,12 @@ public final class ModelImporterVisualPanel1 extends JPanel implements AssetEven } public synchronized void loadModel(File path, AssetKey modelKey) { + ProjectAssetManager manager = new ProjectAssetManager(FileUtil.toFileObject(path).getParent()); + manager.setAssetEventListener(this); try { - ProjectAssetManager manager = new ProjectAssetManager(FileUtil.toFileObject(path).getParent()); - manager.setAssetEventListener(this); - requestedAssets.clear(); + if (modelKey != mainKey) { + requestedAssets.clear(); + } if (currentModel != null) { offPanel.detach(currentModel); currentModel = null; @@ -109,8 +111,6 @@ public final class ModelImporterVisualPanel1 extends JPanel implements AssetEven NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notifyLater(msg); } - manager.setAssetEventListener(null); - manager.clearCache(); } catch (Exception e) { Message msg = new NotifyDescriptor.Message( "Error importing file!\n" @@ -119,6 +119,8 @@ public final class ModelImporterVisualPanel1 extends JPanel implements AssetEven DialogDisplayer.getDefault().notifyLater(msg); Exceptions.printStackTrace(e); } + manager.setAssetEventListener(null); + manager.clearCache(); } private void updateProperties(final AssetKey key) { @@ -140,7 +142,9 @@ public final class ModelImporterVisualPanel1 extends JPanel implements AssetEven && !"glsllib".equalsIgnoreCase(ak.getExtension()) && !"frag".equalsIgnoreCase(ak.getExtension()) && !"vert".equalsIgnoreCase(ak.getExtension())) { - requestedAssets.add(ak); + if (!requestedAssets.contains(ak)) { + requestedAssets.add(ak); + } } }