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<?>>()); private final List<Property<?>> sceneProperties = Collections.synchronizedList(new LinkedList<Property<?>>());
public AbstractSceneExplorerNode() { public AbstractSceneExplorerNode() {
super(Children.LEAF, new DynamicLookup(new InstanceContent())); this(Children.LEAF, null);
lookupContents = ((DynamicLookup) getLookup()).getInstanceContent();
} }
public AbstractSceneExplorerNode(Children children, DataObject dataObject) { 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.dataObject = dataObject;
this.jmeChildren = children;
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent(); lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
} }
public AbstractSceneExplorerNode(DataObject dataObject) { public AbstractSceneExplorerNode(DataObject dataObject) {
super(Children.LEAF, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new DynamicLookup(new InstanceContent()))); this(Children.LEAF, dataObject);
this.dataObject = dataObject;
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
} }
public AbstractSceneExplorerNode(Children children) { public AbstractSceneExplorerNode(Children children) {
//TODO: OMG! this(children, (children instanceof JmeSpatialChildren) ? ((JmeSpatialChildren) children).getDataObject() : null);
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();
}
} }
public InstanceContent getLookupContents() { 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.AddUserDataAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewControlPopup; import com.jme3.gde.core.sceneexplorer.nodes.actions.NewControlPopup;
import com.jme3.scene.AssetLinkNode; import com.jme3.scene.AssetLinkNode;
import com.jme3.scene.control.Control;
import java.awt.Image; import java.awt.Image;
import java.io.IOException; import java.io.IOException;
import java.util.LinkedList; import java.util.LinkedList;
@ -73,8 +74,7 @@ public class JmeAssetLinkNode extends JmeNode {
} }
public JmeAssetLinkNode(AssetLinkNode spatial, JmeSpatialChildren children) { public JmeAssetLinkNode(AssetLinkNode spatial, JmeSpatialChildren children) {
super(spatial, new AssetLinkChildren(spatial)); super(spatial, new AssetLinkChildren(spatial, children.getDataObject()));
getLookupContents().add(spatial);
linkChildren = (AssetLinkChildren)getChildren(); linkChildren = (AssetLinkChildren)getChildren();
linkChildren.setReadOnly(children.readOnly); linkChildren.setReadOnly(children.readOnly);
this.geom = spatial; this.geom = spatial;
@ -145,8 +145,9 @@ public class JmeAssetLinkNode extends JmeNode {
public static class AssetLinkChildren extends JmeSpatialChildren { public static class AssetLinkChildren extends JmeSpatialChildren {
public AssetLinkChildren(AssetLinkNode spatial) { public AssetLinkChildren(AssetLinkNode spatial, DataObject dataObject) {
super(spatial); super(spatial);
setDataObject(dataObject);
} }
@Override @Override
@ -164,7 +165,10 @@ public class JmeAssetLinkNode extends JmeNode {
List<Object> keys = new LinkedList<Object>(); List<Object> keys = new LinkedList<Object>();
if (spatial instanceof AssetLinkNode) { if (spatial instanceof AssetLinkNode) {
keys.addAll(((AssetLinkNode) spatial).getAssetLoaderKeys()); 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; return keys;
} }
@ -194,7 +198,7 @@ public class JmeAssetLinkNode extends JmeNode {
ModelKey assetKey = (ModelKey) key; ModelKey assetKey = (ModelKey) key;
return new Node[]{new JmeAssetLinkChild(assetKey, (AssetLinkNode) spatial)}; 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) { public JmeBone(JmeSkeletonControl jmeSkeletonControl, Bone bone, JmeBoneChildren children) {
super(children); super(children);
this.jmeChildren = children;
this.jmeSkeletonControl = jmeSkeletonControl; this.jmeSkeletonControl = jmeSkeletonControl;
getLookupContents().add(bone); getLookupContents().add(bone);
getLookupContents().add(this); getLookupContents().add(this);

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

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

Loading…
Cancel
Save