- fixes in nifty locator in SDK.. still problematic as nifty only provides static access to the locator..

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8745 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 7f39e256aa
commit 3b6051b65c
  1. 27
      sdk/jme3-gui/src/com/jme3/gde/gui/multiview/NiftyJmeDisplay.java
  2. 16
      sdk/jme3-gui/src/com/jme3/gde/gui/multiview/NiftyPreviewPanel.java

@ -32,7 +32,10 @@
package com.jme3.gde.gui.multiview;
import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetKey;
import com.jme3.asset.AssetManager;
import com.jme3.asset.AssetNotFoundException;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.audio.AudioRenderer;
import com.jme3.niftygui.RenderDeviceJme;
@ -46,9 +49,30 @@ import com.jme3.texture.FrameBuffer;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.spi.input.InputSystem;
import de.lessvoid.nifty.tools.TimeProvider;
import de.lessvoid.nifty.tools.resourceloader.ResourceLoader;
import de.lessvoid.nifty.tools.resourceloader.ResourceLocation;
import java.io.InputStream;
import java.net.URL;
public class NiftyJmeDisplay extends com.jme3.niftygui.NiftyJmeDisplay implements SceneProcessor {
protected class ResourceLocationJmp implements ResourceLocation {
public InputStream getResourceAsStream(String path) {
AssetKey<Object> key = new AssetKey<Object>(path);
AssetInfo info = assetManager.locateAsset(key);
if (info != null){
return info.openStream();
}else{
throw new AssetNotFoundException(path);
}
}
public URL getResource(String path) {
throw new UnsupportedOperationException();
}
}
public NiftyJmeDisplay(AssetManager assetManager,
InputSystem inputManager,
AudioRenderer audioRenderer,
@ -66,6 +90,9 @@ public class NiftyJmeDisplay extends com.jme3.niftygui.NiftyJmeDisplay implement
@Override
public void initialize(RenderManager rm, ViewPort vp) {
ResourceLocationJmp resourceLocation = new ResourceLocationJmp();
ResourceLoader.removeAllResourceLocations();
ResourceLoader.addResourceLocation(resourceLocation);
this.renderManager = rm;
renderDev.setRenderManager(rm);
inited = true;

@ -244,8 +244,6 @@ public class NiftyPreviewPanel extends PanelView {
audioRenderer,
guiViewPort);
nifty = niftyDisplay.getNifty();
//TODO: assetManager isn't used for loading xml??
de.lessvoid.nifty.tools.resourceloader.ResourceLoader.addResourceLocation(new FileSystemLocation(new File(pm.getAssetFolderName())));
// attach the nifty display to the gui view port as a processor
guiViewPort.addProcessor(niftyDisplay);
@ -273,12 +271,12 @@ public class NiftyPreviewPanel extends PanelView {
public void cleanup() {
offPanel.stopPreview();
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
nifty.exit();
return null;
}
});
// SceneApplication.getApplication().enqueue(new Callable<Object>() {
//
// public Object call() throws Exception {
// nifty.exit();
// return null;
// }
// });
}
}

Loading…
Cancel
Save