fixed terrain editor errors

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8636 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 13 years ago
parent 35560cd836
commit 8f61aa757c
  1. 6
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorController.java
  2. 16
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java

@ -344,12 +344,14 @@ public class TerrainEditorController implements NodeListener {
return null; return null;
} }
private Float doGetTextureScale(int layer) { protected Float doGetTextureScale(int layer) {
Terrain terrain = (Terrain) getTerrain(null); Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null) if (terrain == null)
return 1f; return 1f;
MatParam matParam = null; MatParam matParam = null;
matParam = terrain.getMaterial().getParam("DiffuseMap_"+layer+"_scale"); matParam = terrain.getMaterial().getParam("DiffuseMap_"+layer+"_scale");
if (matParam == null)
return -1f;
return (Float) matParam.getValue(); return (Float) matParam.getValue();
} }
@ -1017,7 +1019,7 @@ public class TerrainEditorController implements NodeListener {
return -1; return -1;
} }
private int doGetNumUsedTextures() { protected int doGetNumUsedTextures() {
Terrain terrain = (Terrain) getTerrain(null); Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null) if (terrain == null)
return 0; return 0;

@ -131,7 +131,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
private CreateTerrainWizardAction terrainWizard; private CreateTerrainWizardAction terrainWizard;
private SkyboxWizardAction skyboxWizard; private SkyboxWizardAction skyboxWizard;
private JmeSpatial selectedSpat; private JmeSpatial selectedSpat;
private TerrainNodeListener terrainDeletedNodeListener; //private TerrainNodeListener terrainDeletedNodeListener;
private boolean availableNormalTextures; private boolean availableNormalTextures;
private HelpCtx ctx = new HelpCtx("sdk.terrain_editor"); private HelpCtx ctx = new HelpCtx("sdk.terrain_editor");
private DDSPreview ddsPreview; private DDSPreview ddsPreview;
@ -1012,8 +1012,8 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
request.setToolNode(new Node("TerrainEditorToolNode")); request.setToolNode(new Node("TerrainEditorToolNode"));
SceneApplication.getApplication().openScene(request); SceneApplication.getApplication().openScene(request);
terrainDeletedNodeListener = new TerrainNodeListener(); //terrainDeletedNodeListener = new TerrainNodeListener();
editorController.enableTextureButtons(); //editorController.enableTextureButtons();
} }
@ -1022,7 +1022,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
if (request.equals(sentRequest)) { if (request.equals(sentRequest)) {
currentRequest = request; currentRequest = request;
Logger.getLogger(TerrainEditorTopComponent.class.getName()).finer("Terrain sceneRequested " + request.getWindowTitle()); //Logger.getLogger(TerrainEditorTopComponent.class.getName()).finer("Terrain sceneRequested " + request.getWindowTitle());
setSceneInfo(currentRequest.getJmeNode(), true); setSceneInfo(currentRequest.getJmeNode(), true);
@ -1033,7 +1033,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
if (terrain != null) { if (terrain != null) {
// add the terrain root save node // add the terrain root save node
// ugh! wtf, why is this fixing the material problem?
((Node) terrain).setMaterial(terrain.getMaterial()); ((Node) terrain).setMaterial(terrain.getMaterial());
// it appears when loading the actual applied material on the terrain // it appears when loading the actual applied material on the terrain
// does not reflect the material that we get from the terrain. // does not reflect the material that we get from the terrain.
@ -1048,9 +1047,6 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
toolController.cleanup(); toolController.cleanup();
} }
//for (int i=0; i<textureTable.getModel().getRowCount(); i++)
// ((TextureTableModel)textureTable.getModel()).removeRow(i);
toolController = new TerrainToolController(currentRequest.getToolNode(), currentRequest.getManager().getManager(), request.getJmeNode()); toolController = new TerrainToolController(currentRequest.getToolNode(), currentRequest.getManager().getManager(), request.getJmeNode());
camController = new TerrainCameraController(SceneApplication.getApplication().getCamera()); camController = new TerrainCameraController(SceneApplication.getApplication().getCamera());
camController.setMaster(this); camController.setMaster(this);
@ -1104,6 +1100,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
public void sceneClosed(SceneRequest request) { public void sceneClosed(SceneRequest request) {
if (request.equals(currentRequest)) { if (request.equals(currentRequest)) {
setActivatedNodes(new org.openide.nodes.Node[]{});
SceneApplication.getApplication().removeSceneListener(this); SceneApplication.getApplication().removeSceneListener(this);
setSceneInfo(null, false); setSceneInfo(null, false);
currentRequest = null; currentRequest = null;
@ -1135,6 +1132,9 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
*/ */
protected void reinitTextureTable() { protected void reinitTextureTable() {
if (toolController == null)
return; // we are not initialized yet
clearTextureTable(); clearTextureTable();
getTableModel().initModel(); getTableModel().initModel();

Loading…
Cancel
Save