- 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
This commit is contained in:
parent
7f39e256aa
commit
3b6051b65c
@ -32,7 +32,10 @@
|
|||||||
|
|
||||||
package com.jme3.gde.gui.multiview;
|
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.AssetManager;
|
||||||
|
import com.jme3.asset.AssetNotFoundException;
|
||||||
import com.jme3.asset.DesktopAssetManager;
|
import com.jme3.asset.DesktopAssetManager;
|
||||||
import com.jme3.audio.AudioRenderer;
|
import com.jme3.audio.AudioRenderer;
|
||||||
import com.jme3.niftygui.RenderDeviceJme;
|
import com.jme3.niftygui.RenderDeviceJme;
|
||||||
@ -46,9 +49,30 @@ import com.jme3.texture.FrameBuffer;
|
|||||||
import de.lessvoid.nifty.Nifty;
|
import de.lessvoid.nifty.Nifty;
|
||||||
import de.lessvoid.nifty.spi.input.InputSystem;
|
import de.lessvoid.nifty.spi.input.InputSystem;
|
||||||
import de.lessvoid.nifty.tools.TimeProvider;
|
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 {
|
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,
|
public NiftyJmeDisplay(AssetManager assetManager,
|
||||||
InputSystem inputManager,
|
InputSystem inputManager,
|
||||||
AudioRenderer audioRenderer,
|
AudioRenderer audioRenderer,
|
||||||
@ -66,6 +90,9 @@ public class NiftyJmeDisplay extends com.jme3.niftygui.NiftyJmeDisplay implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(RenderManager rm, ViewPort vp) {
|
public void initialize(RenderManager rm, ViewPort vp) {
|
||||||
|
ResourceLocationJmp resourceLocation = new ResourceLocationJmp();
|
||||||
|
ResourceLoader.removeAllResourceLocations();
|
||||||
|
ResourceLoader.addResourceLocation(resourceLocation);
|
||||||
this.renderManager = rm;
|
this.renderManager = rm;
|
||||||
renderDev.setRenderManager(rm);
|
renderDev.setRenderManager(rm);
|
||||||
inited = true;
|
inited = true;
|
||||||
|
@ -244,8 +244,6 @@ public class NiftyPreviewPanel extends PanelView {
|
|||||||
audioRenderer,
|
audioRenderer,
|
||||||
guiViewPort);
|
guiViewPort);
|
||||||
nifty = niftyDisplay.getNifty();
|
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
|
// attach the nifty display to the gui view port as a processor
|
||||||
guiViewPort.addProcessor(niftyDisplay);
|
guiViewPort.addProcessor(niftyDisplay);
|
||||||
@ -273,12 +271,12 @@ public class NiftyPreviewPanel extends PanelView {
|
|||||||
|
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
offPanel.stopPreview();
|
offPanel.stopPreview();
|
||||||
SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
// SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
||||||
|
//
|
||||||
public Object call() throws Exception {
|
// public Object call() throws Exception {
|
||||||
nifty.exit();
|
// nifty.exit();
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user