From 9bd9e1dc08d09c7066363cf560cdb68659c2ffd9 Mon Sep 17 00:00:00 2001 From: "bre..ns" Date: Tue, 16 Aug 2011 16:14:46 +0000 Subject: [PATCH] fixed add terrain bug, now they all use the same action git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8022 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/nbproject/build-impl.xml | 2477 +++++++++-------- engine/nbproject/genfiles.properties | 22 +- .../gde/terraineditor/AddTerrainAction.java | 80 +- .../TerrainEditorController.java | 12 +- 4 files changed, 1301 insertions(+), 1290 deletions(-) diff --git a/engine/nbproject/build-impl.xml b/engine/nbproject/build-impl.xml index b3a1529f7..9333659d2 100644 --- a/engine/nbproject/build-impl.xml +++ b/engine/nbproject/build-impl.xml @@ -1,1238 +1,1239 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.core.dir - Must set src.core-data.dir - Must set src.core-plugins.dir - Must set src.terrain.dir - Must set src.networking.dir - Must set src.desktop.dir - Must set src.desktop-fx.dir - Must set src.games.dir - Must set src.jbullet.dir - Must set src.niftygui.dir - Must set src.jogg.dir - Must set src.lwjgl-oal.dir - Must set src.lwjgl-ogl.dir - Must set src.ogre.dir - Must set src.blender.dir - Must set src.pack.dir - Must set src.jheora.dir - Must set src.test.dir - Must set src.tools.dir - Must set src.xml.dir - Must set test.test.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - - - - - - java -cp "${run.classpath.with.dist.jar}" ${main.class} - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - - - - - - - - Must select one file in the IDE or set profile.class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.core.dir + Must set src.core-data.dir + Must set src.core-plugins.dir + Must set src.terrain.dir + Must set src.networking.dir + Must set src.desktop.dir + Must set src.desktop-fx.dir + Must set src.games.dir + Must set src.jbullet.dir + Must set src.niftygui.dir + Must set src.jogg.dir + Must set src.lwjgl-oal.dir + Must set src.lwjgl-ogl.dir + Must set src.ogre.dir + Must set src.blender.dir + Must set src.pack.dir + Must set src.jheora.dir + Must set src.test.dir + Must set src.tools.dir + Must set src.xml.dir + Must set test.test.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + Must select one file in the IDE or set profile.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/nbproject/genfiles.properties b/engine/nbproject/genfiles.properties index f24a52947..3718a4f12 100644 --- a/engine/nbproject/genfiles.properties +++ b/engine/nbproject/genfiles.properties @@ -1,11 +1,11 @@ -build.xml.data.CRC32=52f8cb9e -build.xml.script.CRC32=34d4c2f2 -build.xml.stylesheet.CRC32=958a1d3e -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=8a1eda4b -nbproject/build-impl.xml.script.CRC32=047b53c9 -nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45 -nbproject/profiler-build-impl.xml.data.CRC32=aff514c1 -nbproject/profiler-build-impl.xml.script.CRC32=abda56ed -nbproject/profiler-build-impl.xml.stylesheet.CRC32=f10cf54c@1.11.1 +build.xml.data.CRC32=52f8cb9e +build.xml.script.CRC32=34d4c2f2 +build.xml.stylesheet.CRC32=958a1d3e +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=8a1eda4b +nbproject/build-impl.xml.script.CRC32=fc0d2890 +nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45 +nbproject/profiler-build-impl.xml.data.CRC32=aff514c1 +nbproject/profiler-build-impl.xml.script.CRC32=abda56ed +nbproject/profiler-build-impl.xml.stylesheet.CRC32=f10cf54c@1.11.1 diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/AddTerrainAction.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/AddTerrainAction.java index 653413a8a..9a35e4975 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/AddTerrainAction.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/AddTerrainAction.java @@ -13,6 +13,7 @@ import com.jme3.gde.core.sceneexplorer.nodes.actions.NewSpatialAction; import com.jme3.renderer.Camera; import com.jme3.scene.Node; import com.jme3.scene.Spatial; +import com.jme3.terrain.Terrain; import com.jme3.terrain.geomipmap.TerrainLodControl; import com.jme3.terrain.geomipmap.TerrainQuad; import com.jme3.terrain.heightmap.AbstractHeightMap; @@ -73,11 +74,11 @@ public class AddTerrainAction extends AbstractNewSpatialWizardAction { } return null; } - + protected Spatial generateTerrain(Node parent, final WizardDescriptor wizardDescriptor) throws IOException { org.openide.nodes.Node selectedNode = (org.openide.nodes.Node) wizardDescriptor.getProperty("main_node"); final Spatial spatial = selectedNode.getLookup().lookup(Spatial.class); - final ProjectAssetManager manager = selectedNode.getLookup().lookup(ProjectAssetManager.class); + String sceneName = selectedNode.getLookup().lookup(DataObject.class).getName(); @@ -92,45 +93,51 @@ public class AddTerrainAction extends AbstractNewSpatialWizardAction { heightmapData = heightmap.getHeightMap(); } - // eg. Scenes/newScene1.j3o - TerrainQuad terrain = null; - - terrain = new TerrainQuad("terrain-" + sceneName, patchSize, totalSize, heightmapData); //TODO make this pluggable for different Terrain implementations + return doCreateTerrain(parent, totalSize, patchSize, alphaTextureSize, heightmapData, sceneName, selectedNode); + } + + + protected Spatial doCreateTerrain(Node parent, + int totalSize, + int patchSize, + int alphaTextureSize, + float[] heightmapData, + String sceneName, + org.openide.nodes.Node selectedNode) throws IOException + { + final ProjectAssetManager manager = selectedNode.getLookup().lookup(ProjectAssetManager.class); + + Terrain terrain = new TerrainQuad("terrain-"+sceneName, patchSize, totalSize, heightmapData); //TODO make this pluggable for different Terrain implementations com.jme3.material.Material mat = new com.jme3.material.Material(manager, "Common/MatDefs/Terrain/TerrainLighting.j3md"); String assetFolder = ""; - if (manager != null && manager instanceof ProjectAssetManager) { - assetFolder = ((ProjectAssetManager) manager).getAssetFolderName(); - } + if (manager != null && manager instanceof ProjectAssetManager) + assetFolder = ((ProjectAssetManager)manager).getAssetFolderName(); // write out 3 alpha blend images - for (int i = 0; i < TerrainEditorController.NUM_ALPHA_TEXTURES; i++) { + for (int i=0; i cameras = new ArrayList(); - cameras.add(SceneApplication.getApplication().getCamera()); - TerrainLodControl control = new TerrainLodControl(terrain, cameras); - //terrain.addControl(control); // removing this until we figure out a way to have it get the cameras when saved/loaded + TerrainLodControl control = new TerrainLodControl(terrain, SceneApplication.getApplication().getCamera()); + ((Node)terrain).addControl(control); - return terrain; - //createTerrainButton.setEnabled(false); // only let the user add one terrain + parent.attachChild((Node)terrain); + //setNeedsSave(true); + //addSpatialUndo(parent, (Node)terrain, jmeNodeParent); + + return (Spatial)terrain; } /** diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java index 21dbfee16..201cddb34 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java @@ -629,7 +629,9 @@ public class TerrainEditorController { Terrain terrain = SceneApplication.getApplication().enqueue(new Callable() { public Terrain call() throws Exception { - return doCreateTerrain(parent, totalSize, patchSize, alphaTextureSize, heightmapData, sceneName, jmeNodeParent); + //return doCreateTerrain(parent, totalSize, patchSize, alphaTextureSize, heightmapData, sceneName, jmeNodeParent); + AddTerrainAction a = new AddTerrainAction(); + return (Terrain) a.doCreateTerrain(parent, totalSize, patchSize, alphaTextureSize, heightmapData, sceneName, jmeRootNode); } }).get(); return terrain; @@ -638,11 +640,11 @@ public class TerrainEditorController { } catch (ExecutionException ex) { Exceptions.printStackTrace(ex); } - //doCreateTerrain(totalSize, patchSize, alphaTextureSize, heightmapData, sceneName, defaultTextureScale); + return null; // if failed } - private Terrain doCreateTerrain(Node parent, + /*private Terrain doCreateTerrain(Node parent, int totalSize, int patchSize, int alphaTextureSize, @@ -677,7 +679,7 @@ public class TerrainEditorController { Texture tex = manager.loadAsset(new TextureKey(alphaBlendFileName, false)); if (i == 0) mat.setTexture("AlphaMap", tex); - else if (i == 1) // add these in when they are supported + else if (i == 1) mat.setTexture("AlphaMap_1", tex); else if (i == 2) mat.setTexture("AlphaMap_2", tex); @@ -707,7 +709,7 @@ public class TerrainEditorController { addSpatialUndo(parent, (Node)terrain, jmeNodeParent); return terrain; - } + }*/ private void addSpatialUndo(final Node undoParent, final Spatial undoSpatial, final AbstractSceneExplorerNode parentNode) { //add undo