- Add ProjectAssetManager accessor to abstract SceneExplorer actions
- Use ProjectAssetManager in SkyBox wizard instead of "dirty" SceneApplication.getApplication().getAssetManager() git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7139 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
197d793cc8
commit
58ddf49040
@ -31,6 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
||||||
|
|
||||||
|
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||||
import com.jme3.gde.core.scene.SceneApplication;
|
import com.jme3.gde.core.scene.SceneApplication;
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
|
import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
|
||||||
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
|
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
|
||||||
@ -53,10 +54,12 @@ import org.openide.util.Lookup;
|
|||||||
public abstract class AbstractNewControlAction implements NewControlAction {
|
public abstract class AbstractNewControlAction implements NewControlAction {
|
||||||
|
|
||||||
protected String name = "*";
|
protected String name = "*";
|
||||||
|
protected ProjectAssetManager pm;
|
||||||
|
|
||||||
protected abstract Control doCreateControl(Spatial spatial);
|
protected abstract Control doCreateControl(Spatial spatial);
|
||||||
|
|
||||||
protected Action makeAction(final JmeSpatial rootNode, final DataObject dataObject) {
|
protected Action makeAction(final JmeSpatial rootNode, final DataObject dataObject) {
|
||||||
|
pm = rootNode.getLookup().lookup(ProjectAssetManager.class);
|
||||||
final Spatial spatial = rootNode.getLookup().lookup(Spatial.class);
|
final Spatial spatial = rootNode.getLookup().lookup(Spatial.class);
|
||||||
return new AbstractAction(name) {
|
return new AbstractAction(name) {
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
||||||
|
|
||||||
|
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||||
import com.jme3.gde.core.scene.SceneApplication;
|
import com.jme3.gde.core.scene.SceneApplication;
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
|
import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
|
||||||
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
|
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
|
||||||
@ -53,12 +54,14 @@ import org.openide.util.Lookup;
|
|||||||
public abstract class AbstractNewControlWizardAction implements NewControlAction {
|
public abstract class AbstractNewControlWizardAction implements NewControlAction {
|
||||||
|
|
||||||
protected String name = "*";
|
protected String name = "*";
|
||||||
|
protected ProjectAssetManager pm;
|
||||||
|
|
||||||
protected abstract Object showWizard(Spatial spatial);
|
protected abstract Object showWizard(Spatial spatial);
|
||||||
|
|
||||||
protected abstract Control doCreateControl(Spatial spatial, Object configuration);
|
protected abstract Control doCreateControl(Spatial spatial, Object configuration);
|
||||||
|
|
||||||
protected Action makeAction(final JmeSpatial rootNode, final DataObject dataObject) {
|
protected Action makeAction(final JmeSpatial rootNode, final DataObject dataObject) {
|
||||||
|
pm = rootNode.getLookup().lookup(ProjectAssetManager.class);
|
||||||
final Spatial spatial = rootNode.getLookup().lookup(Spatial.class);
|
final Spatial spatial = rootNode.getLookup().lookup(Spatial.class);
|
||||||
return new AbstractAction(name) {
|
return new AbstractAction(name) {
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
||||||
|
|
||||||
|
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||||
import com.jme3.gde.core.scene.SceneApplication;
|
import com.jme3.gde.core.scene.SceneApplication;
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.JmeNode;
|
import com.jme3.gde.core.sceneexplorer.nodes.JmeNode;
|
||||||
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
|
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
|
||||||
@ -53,10 +54,12 @@ import org.openide.util.Lookup;
|
|||||||
public abstract class AbstractNewSpatialAction implements NewSpatialAction {
|
public abstract class AbstractNewSpatialAction implements NewSpatialAction {
|
||||||
|
|
||||||
protected String name = "*";
|
protected String name = "*";
|
||||||
|
protected ProjectAssetManager pm;
|
||||||
|
|
||||||
protected abstract Spatial doCreateSpatial(Node parent);
|
protected abstract Spatial doCreateSpatial(Node parent);
|
||||||
|
|
||||||
protected Action makeAction(final JmeNode rootNode, final DataObject dataObject) {
|
protected Action makeAction(final JmeNode rootNode, final DataObject dataObject) {
|
||||||
|
pm = rootNode.getLookup().lookup(ProjectAssetManager.class);
|
||||||
final Node node = rootNode.getLookup().lookup(Node.class);
|
final Node node = rootNode.getLookup().lookup(Node.class);
|
||||||
return new AbstractAction(name) {
|
return new AbstractAction(name) {
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
||||||
|
|
||||||
|
import com.jme3.gde.core.assets.ProjectAssetManager;
|
||||||
import com.jme3.gde.core.scene.SceneApplication;
|
import com.jme3.gde.core.scene.SceneApplication;
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.JmeNode;
|
import com.jme3.gde.core.sceneexplorer.nodes.JmeNode;
|
||||||
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
|
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
|
||||||
@ -53,17 +54,19 @@ import org.openide.util.Lookup;
|
|||||||
public abstract class AbstractNewSpatialWizardAction implements NewSpatialAction {
|
public abstract class AbstractNewSpatialWizardAction implements NewSpatialAction {
|
||||||
|
|
||||||
protected String name = "*";
|
protected String name = "*";
|
||||||
|
protected ProjectAssetManager pm;
|
||||||
|
|
||||||
protected abstract Object showWizard(Spatial spatial);
|
protected abstract Object showWizard(Spatial spatial);
|
||||||
|
|
||||||
protected abstract Spatial doCreateSpatial(Node parent, Object configuration);
|
protected abstract Spatial doCreateSpatial(Node parent, Object configuration);
|
||||||
|
|
||||||
protected Action makeAction(final JmeNode rootNode, final DataObject dataObject) {
|
protected Action makeAction(final JmeNode rootNode, final DataObject dataObject) {
|
||||||
|
pm = rootNode.getLookup().lookup(ProjectAssetManager.class);
|
||||||
final Node node = rootNode.getLookup().lookup(Node.class);
|
final Node node = rootNode.getLookup().lookup(Node.class);
|
||||||
return new AbstractAction(name) {
|
return new AbstractAction(name) {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
final Object obj=showWizard(node);
|
final Object obj = showWizard(node);
|
||||||
SceneApplication.getApplication().enqueue(new Callable<Void>() {
|
SceneApplication.getApplication().enqueue(new Callable<Void>() {
|
||||||
|
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.jme3.gde.terraineditor.sky;
|
package com.jme3.gde.terraineditor.sky;
|
||||||
|
|
||||||
import com.jme3.asset.AssetManager;
|
|
||||||
import com.jme3.gde.core.scene.SceneApplication;
|
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialWizardAction;
|
import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialWizardAction;
|
||||||
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewSpatialAction;
|
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewSpatialAction;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
@ -15,12 +13,10 @@ import com.jme3.texture.Texture;
|
|||||||
import com.jme3.util.SkyFactory;
|
import com.jme3.util.SkyFactory;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dialog;
|
import java.awt.Dialog;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import org.openide.DialogDisplayer;
|
import org.openide.DialogDisplayer;
|
||||||
import org.openide.WizardDescriptor;
|
import org.openide.WizardDescriptor;
|
||||||
import org.openide.util.Exceptions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -59,7 +55,6 @@ public class AddSkyboxAction extends AbstractNewSpatialWizardAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Spatial generateSkybox(WizardDescriptor wiz) {
|
public Spatial generateSkybox(WizardDescriptor wiz) {
|
||||||
AssetManager assetManager = SceneApplication.getApplication().getAssetManager();
|
|
||||||
if ((Boolean) wiz.getProperty("multipleTextures")) {
|
if ((Boolean) wiz.getProperty("multipleTextures")) {
|
||||||
Texture south = (Texture) wiz.getProperty("textureSouth");
|
Texture south = (Texture) wiz.getProperty("textureSouth");
|
||||||
Texture north = (Texture) wiz.getProperty("textureNorth");
|
Texture north = (Texture) wiz.getProperty("textureNorth");
|
||||||
@ -68,12 +63,12 @@ public class AddSkyboxAction extends AbstractNewSpatialWizardAction {
|
|||||||
Texture top = (Texture) wiz.getProperty("textureTop");
|
Texture top = (Texture) wiz.getProperty("textureTop");
|
||||||
Texture bottom = (Texture) wiz.getProperty("textureBottom");
|
Texture bottom = (Texture) wiz.getProperty("textureBottom");
|
||||||
Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
|
Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
|
||||||
return SkyFactory.createSky(assetManager, west, east, north, south, top, bottom, normalScale);
|
return SkyFactory.createSky(pm, west, east, north, south, top, bottom, normalScale);
|
||||||
} else {
|
} else {
|
||||||
Texture textureSingle = (Texture) wiz.getProperty("textureSingle");
|
Texture textureSingle = (Texture) wiz.getProperty("textureSingle");
|
||||||
Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
|
Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
|
||||||
boolean useSpheremap = (Boolean) wiz.getProperty("useSpheremap");
|
boolean useSpheremap = (Boolean) wiz.getProperty("useSpheremap");
|
||||||
return SkyFactory.createSky(assetManager, textureSingle, normalScale, useSpheremap);
|
return SkyFactory.createSky(pm, textureSingle, normalScale, useSpheremap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user