- 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
3.0
nor..67 14 years ago
parent 197d793cc8
commit 58ddf49040
  1. 3
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractNewControlAction.java
  2. 3
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractNewControlWizardAction.java
  3. 3
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractNewSpatialAction.java
  4. 5
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractNewSpatialWizardAction.java
  5. 9
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/AddSkyboxAction.java

@ -31,6 +31,7 @@
*/
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.sceneexplorer.nodes.JmeSpatial;
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
@ -53,10 +54,12 @@ import org.openide.util.Lookup;
public abstract class AbstractNewControlAction implements NewControlAction {
protected String name = "*";
protected ProjectAssetManager pm;
protected abstract Control doCreateControl(Spatial spatial);
protected Action makeAction(final JmeSpatial rootNode, final DataObject dataObject) {
pm = rootNode.getLookup().lookup(ProjectAssetManager.class);
final Spatial spatial = rootNode.getLookup().lookup(Spatial.class);
return new AbstractAction(name) {

@ -31,6 +31,7 @@
*/
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.sceneexplorer.nodes.JmeSpatial;
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
@ -53,12 +54,14 @@ import org.openide.util.Lookup;
public abstract class AbstractNewControlWizardAction implements NewControlAction {
protected String name = "*";
protected ProjectAssetManager pm;
protected abstract Object showWizard(Spatial spatial);
protected abstract Control doCreateControl(Spatial spatial, Object configuration);
protected Action makeAction(final JmeSpatial rootNode, final DataObject dataObject) {
pm = rootNode.getLookup().lookup(ProjectAssetManager.class);
final Spatial spatial = rootNode.getLookup().lookup(Spatial.class);
return new AbstractAction(name) {

@ -31,6 +31,7 @@
*/
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.sceneexplorer.nodes.JmeNode;
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
@ -53,10 +54,12 @@ import org.openide.util.Lookup;
public abstract class AbstractNewSpatialAction implements NewSpatialAction {
protected String name = "*";
protected ProjectAssetManager pm;
protected abstract Spatial doCreateSpatial(Node parent);
protected Action makeAction(final JmeNode rootNode, final DataObject dataObject) {
pm = rootNode.getLookup().lookup(ProjectAssetManager.class);
final Node node = rootNode.getLookup().lookup(Node.class);
return new AbstractAction(name) {

@ -31,6 +31,7 @@
*/
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.sceneexplorer.nodes.JmeNode;
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
@ -53,17 +54,19 @@ import org.openide.util.Lookup;
public abstract class AbstractNewSpatialWizardAction implements NewSpatialAction {
protected String name = "*";
protected ProjectAssetManager pm;
protected abstract Object showWizard(Spatial spatial);
protected abstract Spatial doCreateSpatial(Node parent, Object configuration);
protected Action makeAction(final JmeNode rootNode, final DataObject dataObject) {
pm = rootNode.getLookup().lookup(ProjectAssetManager.class);
final Node node = rootNode.getLookup().lookup(Node.class);
return new AbstractAction(name) {
public void actionPerformed(ActionEvent e) {
final Object obj=showWizard(node);
final Object obj = showWizard(node);
SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception {

@ -4,8 +4,6 @@
*/
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.NewSpatialAction;
import com.jme3.math.Vector3f;
@ -15,12 +13,10 @@ import com.jme3.texture.Texture;
import com.jme3.util.SkyFactory;
import java.awt.Component;
import java.awt.Dialog;
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import javax.swing.JComponent;
import org.openide.DialogDisplayer;
import org.openide.WizardDescriptor;
import org.openide.util.Exceptions;
/**
*
@ -59,7 +55,6 @@ public class AddSkyboxAction extends AbstractNewSpatialWizardAction {
}
public Spatial generateSkybox(WizardDescriptor wiz) {
AssetManager assetManager = SceneApplication.getApplication().getAssetManager();
if ((Boolean) wiz.getProperty("multipleTextures")) {
Texture south = (Texture) wiz.getProperty("textureSouth");
Texture north = (Texture) wiz.getProperty("textureNorth");
@ -68,12 +63,12 @@ public class AddSkyboxAction extends AbstractNewSpatialWizardAction {
Texture top = (Texture) wiz.getProperty("textureTop");
Texture bottom = (Texture) wiz.getProperty("textureBottom");
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 {
Texture textureSingle = (Texture) wiz.getProperty("textureSingle");
Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
boolean useSpheremap = (Boolean) wiz.getProperty("useSpheremap");
return SkyFactory.createSky(assetManager, textureSingle, normalScale, useSpheremap);
return SkyFactory.createSky(pm, textureSingle, normalScale, useSpheremap);
}
}

Loading…
Cancel
Save