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

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

Loading…
Cancel
Save