- make "Add Asset" action of AssetPack browser more robust
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8383 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
7e9f4b51b6
commit
82de99ca94
@ -8,6 +8,7 @@ import com.jme3.gde.assetpack.AssetConfiguration;
|
||||
import com.jme3.gde.assetpack.AssetPackLoader;
|
||||
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||
import com.jme3.gde.core.scene.SceneApplication;
|
||||
import com.jme3.gde.core.scene.SceneRequest;
|
||||
import com.jme3.scene.Spatial;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
@ -30,7 +31,11 @@ public final class AddAssetAction implements Action {
|
||||
|
||||
public void actionPerformed(ActionEvent ev) {
|
||||
ProjectAssetManager pm = context.getLookup().lookup(ProjectAssetManager.class);
|
||||
ProjectAssetManager scenePm = SceneApplication.getApplication().getCurrentSceneRequest().getManager();
|
||||
SceneRequest req = SceneApplication.getApplication().getCurrentSceneRequest();
|
||||
ProjectAssetManager scenePm = null;
|
||||
if (req != null) {
|
||||
scenePm = req.getManager();
|
||||
}
|
||||
if (pm == null) {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "AssetManager not found!");
|
||||
return;
|
||||
@ -46,7 +51,7 @@ public final class AddAssetAction implements Action {
|
||||
Spatial model = AssetPackLoader.loadAssetPackModel(pm, conf);
|
||||
if (model != null) {
|
||||
SceneComposerTopComponent.findInstance().addModel(model);
|
||||
AssetPackLoader.addModelFiles(pm, scenePm,conf);
|
||||
AssetPackLoader.addModelFiles(pm, scenePm, conf);
|
||||
} else {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Error loading model");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user