Merge pull request #144 from davidB/fix_sdk_addControlToLink

Fix sdk add control to link
experimental
normen 11 years ago
commit e90ff15688
  1. 22
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java
  2. 14
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkNode.java
  3. 1
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBone.java
  4. 1
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeNode.java
  5. 1
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatial.java

@ -65,34 +65,22 @@ public abstract class AbstractSceneExplorerNode extends AbstractNode implements
private final List<Property<?>> sceneProperties = Collections.synchronizedList(new LinkedList<Property<?>>());
public AbstractSceneExplorerNode() {
super(Children.LEAF, new DynamicLookup(new InstanceContent()));
lookupContents = ((DynamicLookup) getLookup()).getInstanceContent();
this(Children.LEAF, null);
}
public AbstractSceneExplorerNode(Children children, DataObject dataObject) {
super(children, new ProxyLookup(dataObject.getLookup(), new DynamicLookup(new InstanceContent())));
super(children, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new DynamicLookup(new InstanceContent())));
this.dataObject = dataObject;
this.jmeChildren = children;
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
}
public AbstractSceneExplorerNode(DataObject dataObject) {
super(Children.LEAF, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new DynamicLookup(new InstanceContent())));
this.dataObject = dataObject;
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
this(Children.LEAF, dataObject);
}
public AbstractSceneExplorerNode(Children children) {
//TODO: OMG!
super(children, children instanceof JmeSpatialChildren
? (((JmeSpatialChildren) children).getDataObject() != null
? new ProxyLookup(((JmeSpatialChildren) children).getDataObject().getLookup(), new DynamicLookup(new InstanceContent()))
: new DynamicLookup(new InstanceContent()))
: new DynamicLookup(new InstanceContent()));
this.jmeChildren = children;
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
if (children instanceof JmeSpatialChildren) {
this.dataObject = ((JmeSpatialChildren) children).getDataObject();
}
this(children, (children instanceof JmeSpatialChildren) ? ((JmeSpatialChildren) children).getDataObject() : null);
}
public InstanceContent getLookupContents() {

@ -37,6 +37,7 @@ import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AddUserDataAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewControlPopup;
import com.jme3.scene.AssetLinkNode;
import com.jme3.scene.control.Control;
import java.awt.Image;
import java.io.IOException;
import java.util.LinkedList;
@ -73,8 +74,7 @@ public class JmeAssetLinkNode extends JmeNode {
}
public JmeAssetLinkNode(AssetLinkNode spatial, JmeSpatialChildren children) {
super(spatial, new AssetLinkChildren(spatial));
getLookupContents().add(spatial);
super(spatial, new AssetLinkChildren(spatial, children.getDataObject()));
linkChildren = (AssetLinkChildren)getChildren();
linkChildren.setReadOnly(children.readOnly);
this.geom = spatial;
@ -145,8 +145,9 @@ public class JmeAssetLinkNode extends JmeNode {
public static class AssetLinkChildren extends JmeSpatialChildren {
public AssetLinkChildren(AssetLinkNode spatial) {
public AssetLinkChildren(AssetLinkNode spatial, DataObject dataObject) {
super(spatial);
setDataObject(dataObject);
}
@Override
@ -164,7 +165,10 @@ public class JmeAssetLinkNode extends JmeNode {
List<Object> keys = new LinkedList<Object>();
if (spatial instanceof AssetLinkNode) {
keys.addAll(((AssetLinkNode) spatial).getAssetLoaderKeys());
return keys;
}
for (int i = 0; i < spatial.getNumControls(); i++) {
Control control = spatial.getControl(i);
keys.add(control);
}
return keys;
}
@ -194,7 +198,7 @@ public class JmeAssetLinkNode extends JmeNode {
ModelKey assetKey = (ModelKey) key;
return new Node[]{new JmeAssetLinkChild(assetKey, (AssetLinkNode) spatial)};
}
return null;
return super.createNodes(key);
}
}

@ -63,7 +63,6 @@ public class JmeBone extends AbstractSceneExplorerNode {
public JmeBone(JmeSkeletonControl jmeSkeletonControl, Bone bone, JmeBoneChildren children) {
super(children);
this.jmeChildren = children;
this.jmeSkeletonControl = jmeSkeletonControl;
getLookupContents().add(bone);
getLookupContents().add(this);

@ -75,7 +75,6 @@ public class JmeNode extends JmeSpatial {
public JmeNode(Node spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.node = spatial;
}

@ -83,7 +83,6 @@ public class JmeSpatial extends AbstractSceneExplorerNode {
public JmeSpatial(Spatial spatial, JmeSpatialChildren factory) {
super(factory);
this.jmeChildren = factory;
this.spatial = spatial;
getLookupContents().add(spatial);
getLookupContents().add(this);

Loading…
Cancel
Save