- make NodeUtility create Nodes of all types

- revert some properties changes for JmeTerrainQuad

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8687 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent fd57361a05
commit 155a129452
  1. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainGrid.java
  2. 3
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainQuad.java
  3. 34
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/NodeUtility.java

@ -85,7 +85,7 @@ public class JmeTerrainGrid extends JmeTerrainQuad implements TerrainGridListene
return sheet;
}
createFields(obj.getClass(), set, obj);
// createFields(obj.getClass(), set, obj);
sheet.put(set);
return sheet;

@ -80,7 +80,8 @@ public class JmeTerrainQuad extends JmeNode {
return sheet;
}
createFields(obj.getClass(), set, obj);
set.put(makeProperty(obj, int.class, "getMaxLod", "Max Lod"));
set.put(makeProperty(obj, short.class, "getQuadrant", "setQuadrant", "Quadrant"));
sheet.put(set);
return sheet;

@ -33,6 +33,7 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.scene.Node;
import org.openide.loaders.DataObject;
import org.openide.util.Lookup;
/**
*
@ -41,32 +42,35 @@ import org.openide.loaders.DataObject;
public class NodeUtility {
public static JmeNode createNode(Node node) {
JmeSpatialChildren factory = new JmeSpatialChildren(node);
factory.setReadOnly(true);
JmeNode jmeNode = new JmeNode(node, factory);
return jmeNode;
return findNode(node, null, true);
}
public static JmeNode createNode(Node node, boolean readOnly) {
JmeSpatialChildren factory = new JmeSpatialChildren(node);
factory.setReadOnly(readOnly);
JmeNode jmeNode = new JmeNode(node, factory);
return jmeNode;
return findNode(node, null, readOnly);
}
public static JmeNode createNode(Node node, DataObject dataObject) {
JmeSpatialChildren factory = new JmeSpatialChildren(node);
factory.setDataObject(dataObject);
factory.setReadOnly(true);
JmeNode jmeNode = new JmeNode(node, factory);
return jmeNode;
return findNode(node, dataObject, true);
}
public static JmeNode createNode(Node node, DataObject dataObject, boolean readOnly) {
return findNode(node, dataObject, readOnly);
}
private static JmeNode findNode(Node node, DataObject dataObject, boolean readOnly) {
for (SceneExplorerNode di : Lookup.getDefault().lookupAll(SceneExplorerNode.class)) {
if (di.getExplorerObjectClass().getName().equals(node.getClass().getName())) {
org.openide.nodes.Node[] hack = di.createNodes(node, dataObject, readOnly);
if (hack.length > 0 && hack[0] instanceof JmeNode) {
return (JmeNode) hack[0];
}
}
}
JmeSpatialChildren factory = new JmeSpatialChildren(node);
if (dataObject != null) {
factory.setDataObject(dataObject);
}
factory.setReadOnly(readOnly);
JmeNode jmeNode = new JmeNode(node, factory);
return jmeNode;
return new JmeNode(node, factory);
}
}

Loading…
Cancel
Save