From 6144a86e41d6f46151d0ed85e00a3d8283aba0d9 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Wed, 29 Jun 2011 00:43:06 +0000 Subject: [PATCH] SDK: - cleanup some packages, move some classes - better names for some classes git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7772 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- sdk/jme3-core/nbproject/project.xml | 2 + .../gde/core/filters/AbstractFilterNode.java | 4 +- .../AssetsPropertiesPanel.form | 14 +- .../AssetsPropertiesPanel.java | 2 +- .../AssetsPropertiesPanelProvider.java | 2 +- .../gde/core/j2seproject/Bundle.properties | 38 +++ .../DynamicLookup.java} | 6 +- .../AnimationProperty.java} | 62 ++-- .../properties/AnimationPropertyEditor.java | 131 +++++++++ .../core/properties/AudioDataProperty.java | 102 +++++++ .../properties/AudioDataPropertyEditor.java | 123 ++++++++ .../gde/core/properties/Bundle.properties | 47 +--- .../gde/core/properties/ColorRGBADialog.form | 97 +++++++ .../gde/core/properties/ColorRGBADialog.java | 155 ++++++++++ .../properties/ColorRGBAPropertyEditor.java | 125 +++++++++ .../EmitterShapePropertyEditor.java | 186 ++++++++++++ .../properties/Matrix3fPropertyEditor.java | 124 ++++++++ .../properties/QuaternionPropertyEditor.java | 125 +++++++++ .../properties/SceneExplorerProperty.java | 209 ++++++++++++++ .../SceneExplorerPropertyEditor.java | 41 +++ .../ScenePropertyChangeListener.java | 41 +++ .../gde/core/properties/TextureBrowser.form | 128 +++++++++ .../gde/core/properties/TextureBrowser.java | 264 ++++++++++++++++++ .../properties/TexturePropertyEditor.java | 139 +++++++++ .../gde/core/properties/UserDataProperty.java | 144 ++++++++++ .../properties/Vector2fPropertyEditor.java | 124 ++++++++ .../properties/Vector3fPropertyEditor.java | 124 ++++++++ .../actions/AbstractStatefulGLToolAction.java | 2 +- .../nodes/AbstractSceneExplorerNode.java | 50 ++-- .../nodes/AssetLinkChildren.java | 98 ------- .../sceneexplorer/nodes/JmeAmbientLight.java | 1 + .../sceneexplorer/nodes/JmeAnimControl.java | 4 +- .../sceneexplorer/nodes/JmeAssetLinkNode.java | 120 +++++++- .../sceneexplorer/nodes/JmeAudioNode.java | 7 +- .../sceneexplorer/nodes/JmeBitmapText.java | 5 +- .../nodes/JmeCharacterControl.java | 2 + .../nodes/JmeDirectionalLight.java | 1 + .../nodes/JmeGenericControl.java | 9 +- .../core/sceneexplorer/nodes/JmeGeometry.java | 5 +- .../sceneexplorer/nodes/JmeGhostControl.java | 2 + .../core/sceneexplorer/nodes/JmeLight.java | 2 + .../gde/core/sceneexplorer/nodes/JmeMesh.java | 2 + .../gde/core/sceneexplorer/nodes/JmeNode.java | 24 +- .../nodes/JmeParticleEmitter.java | 48 ++-- .../core/sceneexplorer/nodes/JmePicture.java | 5 +- .../sceneexplorer/nodes/JmePointLight.java | 1 + .../nodes/JmeRigidBodyControl.java | 2 + .../core/sceneexplorer/nodes/JmeSpatial.java | 31 +- ...rChildren.java => JmeSpatialChildren.java} | 8 +- .../sceneexplorer/nodes/JmeTerrainQuad.java | 5 +- .../nodes/JmeVehicleControl.java | 65 ++++- .../sceneexplorer/nodes/JmeVehicleWheel.java | 2 + .../core/sceneexplorer/nodes/NodeUtility.java | 8 +- .../nodes/PhysicsVehicleChildren.java | 99 ------- ...ontrolAction.java => NewControlPopup.java} | 4 +- ...AddLightAction.java => NewLightPopup.java} | 4 +- ...patialAction.java => NewSpatialPopup.java} | 4 +- .../{UseToolAction.java => ToolPopup.java} | 4 +- .../gde/materials/MaterialPropertyEditor.java | 4 +- .../multiview/widgets/TexturePanel.java | 2 +- .../TerrainEditorTopComponent.java | 2 +- .../terraineditor/sky/SkyboxVisualPanel2.java | 2 +- .../tools/AbstractTerrainToolAction.java | 2 +- 63 files changed, 2802 insertions(+), 393 deletions(-) rename sdk/jme3-core/src/com/jme3/gde/core/{properties => j2seproject}/AssetsPropertiesPanel.form (81%) rename sdk/jme3-core/src/com/jme3/gde/core/{properties => j2seproject}/AssetsPropertiesPanel.java (99%) rename sdk/jme3-core/src/com/jme3/gde/core/{properties => j2seproject}/AssetsPropertiesPanelProvider.java (98%) create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/j2seproject/Bundle.properties rename sdk/jme3-core/src/com/jme3/gde/core/{sceneexplorer/nodes/SceneExplorerLookup.java => nodes/DynamicLookup.java} (92%) rename sdk/jme3-core/src/com/jme3/gde/core/{sceneexplorer/nodes/JmeAssetLinkChild.java => properties/AnimationProperty.java} (65%) create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataProperty.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.form create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/EmitterShapePropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/Matrix3fPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/QuaternionPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/ScenePropertyChangeListener.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.form create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/TexturePropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/UserDataProperty.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/Vector2fPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/Vector3fPropertyEditor.java rename sdk/jme3-core/src/com/jme3/gde/core/{sceneexplorer/nodes => scene}/actions/AbstractStatefulGLToolAction.java (98%) delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AssetLinkChildren.java rename sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/{SceneExplorerChildren.java => JmeSpatialChildren.java} (97%) delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/PhysicsVehicleChildren.java rename sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/{AddControlAction.java => NewControlPopup.java} (95%) rename sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/{AddLightAction.java => NewLightPopup.java} (98%) rename sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/{AddSpatialAction.java => NewSpatialPopup.java} (98%) rename sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/{UseToolAction.java => ToolPopup.java} (95%) diff --git a/sdk/jme3-core/nbproject/project.xml b/sdk/jme3-core/nbproject/project.xml index 1533b70ad..d640317f2 100644 --- a/sdk/jme3-core/nbproject/project.xml +++ b/sdk/jme3-core/nbproject/project.xml @@ -248,8 +248,10 @@ com.jme3.gde.core.filters.actions com.jme3.gde.core.filters.impl com.jme3.gde.core.j2seproject + com.jme3.gde.core.nodes com.jme3.gde.core.properties com.jme3.gde.core.scene + com.jme3.gde.core.scene.actions com.jme3.gde.core.scene.controller com.jme3.gde.core.scene.processors com.jme3.gde.core.sceneexplorer diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java index d97901020..3094513ad 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java @@ -31,8 +31,8 @@ */ package com.jme3.gde.core.filters; -import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerProperty; -import com.jme3.gde.core.sceneexplorer.nodes.properties.ScenePropertyChangeListener; +import com.jme3.gde.core.properties.SceneExplorerProperty; +import com.jme3.gde.core.properties.ScenePropertyChangeListener; import com.jme3.gde.core.util.PropertyUtils; import com.jme3.post.Filter; import java.beans.PropertyDescriptor; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.form b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.form similarity index 81% rename from sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.form rename to sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.form index d6e6c4734..4f089a8f3 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.form +++ b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.form @@ -84,49 +84,49 @@ - + - + - + - + - + - + - + diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.java b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.java similarity index 99% rename from sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.java rename to sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.java index 17d2ddebe..80af4d71e 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.java @@ -35,7 +35,7 @@ * * Created on 25.04.2010, 00:25:08 */ -package com.jme3.gde.core.properties; +package com.jme3.gde.core.j2seproject; import com.jme3.gde.core.assets.AssetsLookupProvider; import java.awt.event.ActionEvent; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanelProvider.java b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanelProvider.java similarity index 98% rename from sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanelProvider.java rename to sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanelProvider.java index 7fd019289..8d21b1a78 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanelProvider.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanelProvider.java @@ -29,7 +29,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.jme3.gde.core.properties; +package com.jme3.gde.core.j2seproject; /** * diff --git a/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/Bundle.properties b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/Bundle.properties new file mode 100644 index 000000000..66a842887 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/Bundle.properties @@ -0,0 +1,38 @@ +# Copyright (c) 2009-2010 jMonkeyEngine +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the name of 'jMonkeyEngine' nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +LBL_Config_assets=Assets +AssetsPropertiesPanel.jLabel2.text=Assets JAR Excludes: +AssetsPropertiesPanel.jTextField1.text=jTextField1 +AssetsPropertiesPanel.jLabel1.text=Assets JAR Name: +AssetsPropertiesPanel.jTextField2.text=jTextField2 +AssetsPropertiesPanel.jCheckBox1.text=Compress Assets JAR +AssetsPropertiesPanel.jLabel3.text=Assets Folder Location: +AssetsPropertiesPanel.jTextField3.text=jTextField3 diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerLookup.java b/sdk/jme3-core/src/com/jme3/gde/core/nodes/DynamicLookup.java similarity index 92% rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerLookup.java rename to sdk/jme3-core/src/com/jme3/gde/core/nodes/DynamicLookup.java index 482bff9d1..b2e6bc338 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerLookup.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/nodes/DynamicLookup.java @@ -30,7 +30,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.jme3.gde.core.sceneexplorer.nodes; +package com.jme3.gde.core.nodes; import org.openide.util.lookup.AbstractLookup; import org.openide.util.lookup.InstanceContent; @@ -39,11 +39,11 @@ import org.openide.util.lookup.InstanceContent; * * @author normenhansen */ -public class SceneExplorerLookup extends AbstractLookup{ +public class DynamicLookup extends AbstractLookup{ private static final long serialVersionUID = 1212314412L; private InstanceContent instanceContent; - public SceneExplorerLookup(InstanceContent instanceContent) { + public DynamicLookup(InstanceContent instanceContent) { super(instanceContent); this.instanceContent = instanceContent; instanceContent.add(this); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkChild.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationProperty.java similarity index 65% rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkChild.java rename to sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationProperty.java index 97b5323d2..b975bbed7 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkChild.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationProperty.java @@ -29,68 +29,64 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.jme3.gde.core.sceneexplorer.nodes; +package com.jme3.gde.core.properties; -import com.jme3.asset.ModelKey; +import com.jme3.animation.AnimControl; import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.scene.AssetLinkNode; -import java.io.IOException; +import java.beans.PropertyEditor; +import java.lang.reflect.InvocationTargetException; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; -import javax.swing.Action; -import org.openide.actions.DeleteAction; -import org.openide.nodes.AbstractNode; -import org.openide.nodes.Children; +import org.openide.nodes.PropertySupport; import org.openide.util.Exceptions; -import org.openide.util.actions.SystemAction; /** * * @author normenhansen */ -public class JmeAssetLinkChild extends AbstractNode { +public class AnimationProperty extends PropertySupport.ReadWrite { - private ModelKey key; - private AssetLinkNode linkNode; + private AnimControl control; + private String anim = "null"; - public JmeAssetLinkChild(ModelKey key, AssetLinkNode linkNode) { - super(Children.LEAF); - this.key = key; - this.linkNode = linkNode; - this.setName(key.getName()); + public AnimationProperty(AnimControl node) { + super("Animation Control", String.class, "Animation Control", ""); + this.control = node; } @Override - public Action[] getActions(boolean context) { - return new SystemAction[]{ - SystemAction.get(DeleteAction.class) - }; + public String getValue() throws IllegalAccessException, InvocationTargetException { + return anim; } @Override - public boolean canDestroy() { - return true; - } - - @Override - public void destroy() throws IOException { - super.destroy(); + public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + if (control == null) { + return; + } try { SceneApplication.getApplication().enqueue(new Callable() { public Void call() throws Exception { - linkNode.detachLinkedChild(key); + if ("null".equals(val)) { + control.clearChannels(); + return null; + } + anim = val; + control.clearChannels(); + control.createChannel().setAnim(val); return null; } }).get(); - JmeSpatial node = ((JmeSpatial) getParentNode()); - if (node != null) { - node.refresh(false); - } } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } catch (ExecutionException ex) { Exceptions.printStackTrace(ex); } } + + @Override + public PropertyEditor getPropertyEditor() { + return new AnimationPropertyEditor(control); + } } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationPropertyEditor.java new file mode 100644 index 000000000..075289e88 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationPropertyEditor.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.animation.AnimControl; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class AnimationPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + private String animName; + private AnimControl control; + + public AnimationPropertyEditor(AnimControl control) { + this.control = control; + } + + public void setValue(Object value) { + if (value instanceof String) { + animName = (String) value; + } + } + + public Object getValue() { + return animName; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { + return animName.toString(); + } + + public void setAsText(String text) throws IllegalArgumentException { + String old = animName; + if ("".equals(text)) { + animName = "null"; + } + animName = text; + notifyListeners(old, animName); + } + + public String[] getTags() { + if(control==null)return new String[]{"none"}; + Collection names = control.getAnimationNames(); + String[] strings = new String[names.size() + 1]; + strings[0] = "null"; + int i = 1; + for (Iterator it = names.iterator(); it.hasNext();) { + strings[i] = it.next(); + i++; + } + return strings; + } + + public Component getCustomEditor() { +// return new AnimationPanel(control); + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean supportsCustomEditor() { + return false; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(String before, String after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + PropertyChangeListener propertyChangeListener = it.next(); + //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion + propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataProperty.java new file mode 100644 index 000000000..f027f315a --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataProperty.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.audio.AudioData; +import com.jme3.audio.AudioKey; +import com.jme3.audio.AudioNode; +import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.scene.SceneRequest; +import java.beans.PropertyEditor; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import org.openide.nodes.PropertySupport; +import org.openide.util.Exceptions; + +/** + * + * @author normenhansen + */ +public class AudioDataProperty extends PropertySupport.ReadWrite { + + private AudioNode node; + + public AudioDataProperty(AudioNode node) { + super("Audio Data", String.class, "Audio Data", ""); + this.node = node; + } + + @Override + public String getValue() throws IllegalAccessException, InvocationTargetException { + if (node.getAudioData() != null) { + return node.getAudioData().toString(); + } else { + return "null"; + } + } + + @Override + public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + if ("null".equals(val)) { + return; + } + if (node.getAudioData() == null) { +// val = val.replace('[', ' ').trim(); +// val = val.replace(']', ' ').trim(); +// final String[] strings = val.split(","); + try { + SceneApplication.getApplication().enqueue(new Callable() { + + public Void call() throws Exception { + SceneRequest request = SceneApplication.getApplication().getCurrentSceneRequest(); + AudioKey key = new AudioKey(val, false); + AudioData localMaterial = request.getManager().loadAudio(key); + if (localMaterial != null) { + node.setAudioData(localMaterial, key); + } + return null; + } + }).get(); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + } + } + + @Override + public PropertyEditor getPropertyEditor() { + return new AudioDataPropertyEditor(); + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataPropertyEditor.java new file mode 100644 index 000000000..55d7c1095 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataPropertyEditor.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.audio.AudioData; +import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.scene.SceneRequest; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class AudioDataPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + private String material; + + public void setValue(Object value) { + if (value instanceof String) { + material = (String) value; + } + } + + public Object getValue() { + return material; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { + return material.toString(); + } + + public void setAsText(String text) throws IllegalArgumentException { + String old=material; + if ("".equals(text)) { + material = "null"; + } + material = text; + notifyListeners(old, material); + } + + public String[] getTags() { + if ("null".equals(material)) { + SceneRequest request = SceneApplication.getApplication().getCurrentSceneRequest(); + if(request==null) return new String[]{}; + String[] mats = request.getManager().getSounds(); + return mats; + } + return new String[]{"can set only once"}; + } + + public Component getCustomEditor() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean supportsCustomEditor() { + return false; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(String before, String after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + PropertyChangeListener propertyChangeListener = it.next(); + //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion + propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties b/sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties index 66a842887..bd1283d27 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties @@ -1,38 +1,9 @@ -# Copyright (c) 2009-2010 jMonkeyEngine -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of 'jMonkeyEngine' nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -LBL_Config_assets=Assets -AssetsPropertiesPanel.jLabel2.text=Assets JAR Excludes: -AssetsPropertiesPanel.jTextField1.text=jTextField1 -AssetsPropertiesPanel.jLabel1.text=Assets JAR Name: -AssetsPropertiesPanel.jTextField2.text=jTextField2 -AssetsPropertiesPanel.jCheckBox1.text=Compress Assets JAR -AssetsPropertiesPanel.jLabel3.text=Assets Folder Location: -AssetsPropertiesPanel.jTextField3.text=jTextField3 +ColorRGBADialog.jButton1.text=OK +ColorRGBADialog.jButton2.text=Cancel +ColorRGBADialog.alphaLabel.text=Alpha: +AnimationPanel.pauseButton.text= +AnimationPanel.playButton.text= +TextureBrowser.cancelButton.text=Cancel +TextureBrowser.okButton.text=Ok +TextureBrowser.imagePreviewLabel.text= +TextureBrowser.title=Texture Browser \ No newline at end of file diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.form b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.form new file mode 100644 index 000000000..da884bd38 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.form @@ -0,0 +1,97 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java new file mode 100644 index 000000000..ce17af394 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * ColorRGBADialog.java + * + * Created on 06.04.2010, 20:58:59 + */ +package com.jme3.gde.core.properties; + +import com.jme3.math.ColorRGBA; +import java.awt.Color; + +/** + * + * @author normenhansen + */ +public class ColorRGBADialog extends javax.swing.JDialog { + + private ColorRGBAPropertyEditor editor; + + /** Creates new form ColorRGBADialog */ + public ColorRGBADialog(java.awt.Frame parent, boolean modal, ColorRGBAPropertyEditor editor) { + super(parent, modal); + this.editor = editor; + initComponents(); + alphaSlider.setValue(Math.round(((ColorRGBA)editor.getValue()).getAlpha()*100)); + } + + public ColorRGBA setColor() { + Color cColor = jColorChooser1.getColor(); + ColorRGBA color = new ColorRGBA(); + float[] floats = new float[4]; + cColor.getComponents(floats); + color.set(floats[0], floats[1], floats[2], ((float)alphaSlider.getValue())/100.0f); + ColorRGBA color2 = new ColorRGBA((ColorRGBA) editor.getValue()); + editor.setValue(color); + editor.notifyListeners(color2, color); + return color; + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jColorChooser1 = new javax.swing.JColorChooser(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + jToolBar1 = new javax.swing.JToolBar(); + alphaLabel = new javax.swing.JLabel(); + alphaSlider = new javax.swing.JSlider(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + + jButton1.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.jButton1.text")); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + jButton2.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.jButton2.text")); // NOI18N + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton2ActionPerformed(evt); + } + }); + + jToolBar1.setFloatable(false); + jToolBar1.setRollover(true); + + alphaLabel.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.alphaLabel.text")); // NOI18N + jToolBar1.add(alphaLabel); + + alphaSlider.setValue(100); + jToolBar1.add(alphaSlider); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton1)) + .addComponent(jColorChooser1, javax.swing.GroupLayout.DEFAULT_SIZE, 496, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jColorChooser1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jButton1) + .addComponent(jButton2)) + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + setColor(); + dispose(); + }//GEN-LAST:event_jButton1ActionPerformed + + private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed + dispose(); + }//GEN-LAST:event_jButton2ActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel alphaLabel; + private javax.swing.JSlider alphaSlider; + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JColorChooser jColorChooser1; + private javax.swing.JToolBar jToolBar1; + // End of variables declaration//GEN-END:variables +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java new file mode 100644 index 000000000..a5e321b72 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.math.ColorRGBA; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class ColorRGBAPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + private ColorRGBA color = new ColorRGBA(); + + public void setValue(Object value) { + if (value instanceof ColorRGBA) { + color.set((ColorRGBA) value); + } + } + + public Object getValue() { + return color; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { + return "[" + color.r + ", " + color.g + ", " + color.b + ", " + color.a + "]"; + } + + public void setAsText(String text) throws IllegalArgumentException { + text = text.replace('[', ' '); + text = text.replace(']', ' '); + String[] values = text.split(","); + ColorRGBA old=color; + if (values.length != 4) { + throw (new IllegalArgumentException("String not correct")); + } + float[] floats = new float[4]; + for (int i = 0; i < values.length; i++) { + String string = values[i]; + floats[i] = Float.parseFloat(string); + } + color.set(floats[0], floats[1], floats[2], floats[3]); + notifyListeners(old, color); + } + + public String[] getTags() { + return null; + } + + public Component getCustomEditor() { + ColorRGBADialog dialog = new ColorRGBADialog(null, true, this); + dialog.setLocationRelativeTo(null); + return dialog; + } + + public boolean supportsCustomEditor() { + return true; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + public void notifyListeners(ColorRGBA before, ColorRGBA after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + PropertyChangeListener propertyChangeListener = it.next(); + //TODO: check what the "programmatic name" is supposed to be here.. for now its ColorRGBA + propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/EmitterShapePropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/EmitterShapePropertyEditor.java new file mode 100644 index 000000000..5ef00e771 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/EmitterShapePropertyEditor.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.effect.shapes.EmitterBoxShape; +import com.jme3.effect.shapes.EmitterPointShape; +import com.jme3.effect.shapes.EmitterShape; +import com.jme3.effect.shapes.EmitterSphereShape; +import com.jme3.math.Vector3f; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.Iterator; +import java.util.LinkedList; +import org.openide.awt.StatusDisplayer; + +/** + * + * @author normenhansen + */ +public class EmitterShapePropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + private EmitterShape emitter;// = new EmitterPointShape(Vector3f.ZERO); + + public void setValue(Object value) { + if (value instanceof EmitterShape) { + emitter = (EmitterShape) value; + } + } + + public Object getValue() { + return emitter; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { + if (emitter == null) { + return "null"; + } + if (emitter instanceof EmitterBoxShape) { + EmitterBoxShape shape = (EmitterBoxShape) emitter; + return "[Box, " + + shape.getMin().x + + ", " + + shape.getMin().y + + ", " + + shape.getMin().z + + ", " + + shape.getMin().x + shape.getLen().x + + ", " + + shape.getMin().x + shape.getLen().y + + ", " + + shape.getMin().x + shape.getLen().z + + "]"; + } else if (emitter instanceof EmitterPointShape) { + EmitterPointShape shape = (EmitterPointShape) emitter; + return "[Point, " + + shape.getPoint().x + + ", " + + shape.getPoint().y + + ", " + + shape.getPoint().z + + "]"; + } else if (emitter instanceof EmitterSphereShape) { + EmitterSphereShape shape = (EmitterSphereShape) emitter; + return "[Sphere, " + + shape.getCenter().x + + ", " + + shape.getCenter().y + + ", " + + shape.getCenter().z + + ", " + + shape.getRadius() + + "]"; + } + return emitter.toString(); + } + + public void setAsText(String text) throws IllegalArgumentException { + text = text.replace('[', ' ').trim(); + text = text.replace(']', ' ').trim(); + String[] strings = text.split(","); + EmitterShape old=emitter; + if (strings.length == 0) { + return; + } + if ("box".equals(strings[0].trim().toLowerCase())) { + if (strings.length == 7) { + StatusDisplayer.getDefault().setStatusText("try set parameterized box shape"); + emitter = new EmitterBoxShape( + new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3])), new Vector3f(Float.parseFloat(strings[4]), Float.parseFloat(strings[5]), Float.parseFloat(strings[6]))); + } else { + StatusDisplayer.getDefault().setStatusText("try set standard box shape"); + emitter = new EmitterBoxShape(new Vector3f(-.5f, -.5f, -.5f), new Vector3f(.5f, .5f, .5f)); + } + } else if ("point".equals(strings[0].trim().toLowerCase())) { + if (strings.length == 4) { + emitter = new EmitterPointShape( + new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3]))); + } else { + emitter = new EmitterPointShape(Vector3f.ZERO); + } + } else if ("sphere".equals(strings[0].trim().toLowerCase())) { + if (strings.length == 5) { + emitter = new EmitterSphereShape( + new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3])), Float.parseFloat(strings[4])); + } else { + emitter = new EmitterSphereShape(Vector3f.ZERO, .5f); + } + } + notifyListeners(old, emitter); + } + + public String[] getTags() { +// String[] mats = new String[]{"[Point]", "[Sphere]", "[Box]"}; + return null; + } + + public Component getCustomEditor() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean supportsCustomEditor() { + return false; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(EmitterShape before, EmitterShape after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + PropertyChangeListener propertyChangeListener = it.next(); + //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion + propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/Matrix3fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/Matrix3fPropertyEditor.java new file mode 100644 index 000000000..909b071ba --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/Matrix3fPropertyEditor.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.math.Matrix3f; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class Matrix3fPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + private Matrix3f vector = new Matrix3f(); + + public void setValue(Object value) { + if (value instanceof Matrix3f) { + vector.set((Matrix3f) value); + } + } + + public Object getValue() { + return vector; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { + return vector.toString(); + } + + public void setAsText(String text) throws IllegalArgumentException { + text = text.replace('[', ' '); + text = text.replace(']', ' '); + String[] values = text.split(","); + if (values.length != 3) { + throw (new IllegalArgumentException("String not correct")); + } + float[] floats = new float[3]; + for (int i = 0; i < values.length; i++) { + String string = values[i]; + floats[i] = Float.parseFloat(string); + } + Matrix3f old = new Matrix3f(); + old.set(vector); +// vector.set(floats[0], floats[1], floats[2]); + notifyListeners(old, vector); + } + + public String[] getTags() { + return null; + } + + public Component getCustomEditor() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean supportsCustomEditor() { + return false; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(Matrix3f before, Matrix3f after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + PropertyChangeListener propertyChangeListener = it.next(); + //TODO: check what the "programmatic name" is supposed to be here.. for now its Matrix3f + propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/QuaternionPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/QuaternionPropertyEditor.java new file mode 100644 index 000000000..d04cf3f28 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/QuaternionPropertyEditor.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.math.Quaternion; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class QuaternionPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + private Quaternion quaternion = new Quaternion(); + + public void setValue(Object value) { + if (value instanceof Quaternion) { + quaternion.set((Quaternion) value); + } + } + + public Object getValue() { + return quaternion; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { + float[] angles=quaternion.toAngles(new float[3]); + return "[" + (float)Math.toDegrees(angles[0]) + ", " + (float)Math.toDegrees(angles[1]) + ", " + (float)Math.toDegrees(angles[2]) + "]"; + } + + public void setAsText(String text) throws IllegalArgumentException { + text = text.replace('[', ' '); + text = text.replace(']', ' '); + String[] values = text.split(","); + if (values.length != 3) { + throw (new IllegalArgumentException("String not correct")); + } + float[] floats = new float[3]; + for (int i = 0; i < values.length; i++) { + String string = values[i]; + floats[i] = (float)Math.toRadians(Float.parseFloat(string)); + } + Quaternion old=new Quaternion(); + old.set(quaternion); + quaternion.fromAngles(floats); + notifyListeners(old,quaternion); + } + + public String[] getTags() { + return null; + } + + public Component getCustomEditor() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean supportsCustomEditor() { + return false; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(Quaternion before, Quaternion after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + PropertyChangeListener propertyChangeListener = it.next(); + //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion + propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java new file mode 100644 index 000000000..5e52c292a --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.effect.shapes.EmitterShape; +import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit; +import com.jme3.gde.core.undoredo.SceneUndoRedoManager; +import com.jme3.math.ColorRGBA; +import com.jme3.math.Matrix3f; +import com.jme3.math.Quaternion; +import com.jme3.math.Vector2f; +import com.jme3.math.Vector3f; +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.openide.nodes.PropertySupport; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; + +/** + * + * @author normenhansen + */ +@SuppressWarnings("unchecked") +public class SceneExplorerProperty extends PropertySupport.Reflection { + + protected LinkedList listeners = new LinkedList(); + + public SceneExplorerProperty(T instance, Class valueType, String getter, String setter) throws NoSuchMethodException { + this(instance, valueType, getter, setter, null); + } + + public SceneExplorerProperty(T instance, Class valueType, String getter, String setter, ScenePropertyChangeListener listener) throws NoSuchMethodException { + super(instance, valueType, getter, setter); + addPropertyChangeListener(listener); + if (valueType == Vector3f.class) { + setPropertyEditorClass(Vector3fPropertyEditor.class); + } else if (valueType == Quaternion.class) { + setPropertyEditorClass(QuaternionPropertyEditor.class); + } else if (valueType == Matrix3f.class) { + setPropertyEditorClass(Matrix3fPropertyEditor.class); + } else if (valueType == ColorRGBA.class) { + setPropertyEditorClass(ColorRGBAPropertyEditor.class); + } else if (valueType == EmitterShape.class) { + setPropertyEditorClass(EmitterShapePropertyEditor.class); + } else if (valueType == Vector2f.class) { + setPropertyEditorClass(Vector2fPropertyEditor.class); + } + + for (SceneExplorerPropertyEditor di : Lookup.getDefault().lookupAll(SceneExplorerPropertyEditor.class)) { + di.setEditor(valueType, this); + } + } + + @Override + public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + return super.getValue(); +// try { +// return SceneApplication.getApplication().enqueue(new Callable() { +// +// public T call() throws Exception { +// return getSuperValue(); +// } +// }).get(); +// } catch (InterruptedException ex) { +// Exceptions.printStackTrace(ex); +// } catch (ExecutionException ex) { +// Exceptions.printStackTrace(ex); +// } +// return null; + } + + private T getSuperValue() { + try { + return super.getValue(); + } catch (IllegalAccessException ex) { + Exceptions.printStackTrace(ex); + } catch (IllegalArgumentException ex) { + Exceptions.printStackTrace(ex); + } catch (InvocationTargetException ex) { + Exceptions.printStackTrace(ex); + } + return null; + } + + @Override + public void setValue(final T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + try { + notifyListeners(getSuperValue(), val); + SceneApplication.getApplication().enqueue(new Callable() { + + public Void call() throws Exception { + setSuperValue(val); + return null; + } + }).get(); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + } + + private void setSuperValue(T val, boolean undo) { + try { + if (undo) { + try { + Object oldValue = getSuperValue(); + if (oldValue.getClass().getMethod("clone") != null) { + addUndo(oldValue.getClass().getMethod("clone").invoke(oldValue), val); + Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Add cloned undo {0}", oldValue.getClass().getMethod("clone").invoke(oldValue)); + } + } catch (Exception e) { + addUndo(getSuperValue(), val); + Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Add undo {0}", getSuperValue()); + } + } + super.setValue(val); + } catch (IllegalAccessException ex) { + Exceptions.printStackTrace(ex); + } catch (IllegalArgumentException ex) { + Exceptions.printStackTrace(ex); + } catch (InvocationTargetException ex) { + Exceptions.printStackTrace(ex); + } + } + + private void setSuperValue(T val) { + setSuperValue(val, true); + } + + protected void addUndo(final Object before, final Object after) { + SceneUndoRedoManager undoRedo = Lookup.getDefault().lookup(SceneUndoRedoManager.class); + if (undoRedo == null) { + Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.WARNING, "Cannot access SceneUndoRedoManager"); + return; + } + undoRedo.addEdit(this, new AbstractUndoableSceneEdit() { + + @Override + public void sceneUndo() { + Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Do undo {0}", before); + setSuperValue((T) before, false); + } + + @Override + public void sceneRedo() { + setSuperValue((T) after, false); + } + + @Override + public void awtUndo() { + } + + @Override + public void awtRedo() { + } + }); + } + + public void addPropertyChangeListener(ScenePropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(ScenePropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(Object before, Object after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + ScenePropertyChangeListener propertyChangeListener = it.next(); + propertyChangeListener.propertyChange(getName(), before, after); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerPropertyEditor.java new file mode 100644 index 000000000..19c573db8 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerPropertyEditor.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.jme3.gde.core.properties; + +/** + * + * @author normenhansen + */ +public interface SceneExplorerPropertyEditor { + public void setEditor(Class valueType, SceneExplorerProperty prop); +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ScenePropertyChangeListener.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/ScenePropertyChangeListener.java new file mode 100644 index 000000000..385ca15dd --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ScenePropertyChangeListener.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.jme3.gde.core.properties; + +/** + * + * @author normenhansen + */ +public interface ScenePropertyChangeListener { + public void propertyChange(String property, Object oldValue, Object newValue); +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.form b/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.form new file mode 100644 index 000000000..514ca29cb --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.form @@ -0,0 +1,128 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java new file mode 100644 index 000000000..0e950b0b6 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import Model.DDSImageFile; +import com.jme3.gde.core.assets.ProjectAssetManager; +import com.jme3.texture.Texture; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.logging.Logger; +import javax.swing.DefaultListSelectionModel; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import jme3tools.converters.ImageToAwt; +import org.openide.filesystems.FileUtil; +import org.openide.util.Exceptions; +import org.openide.util.ImageUtilities; + +/** + * Displays all textures in the ProjectAssetManager, + * lets you select one, and shows a preview of it. + * + * The user can de-select the currently selected texture to specify they + * do not want a texture, and in that case null is returned. + * + * @author bowens + */ +public class TextureBrowser extends javax.swing.JDialog { + + private ProjectAssetManager assetManager; + private TexturePropertyEditor editor; + + + public TextureBrowser(java.awt.Frame parent, boolean modal, ProjectAssetManager assetManager, TexturePropertyEditor editor) { + super(parent, modal); + this.assetManager = assetManager; + this.editor = editor; + initComponents(); + loadAvailableTextures(); + setSelectedTexture((Texture)editor.getValue()); + setLocationRelativeTo(null); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + cancelButton = new javax.swing.JButton(); + okButton = new javax.swing.JButton(); + jPanel1 = new javax.swing.JPanel(); + jScrollPane1 = new javax.swing.JScrollPane(); + textureList = new javax.swing.JList(); + jScrollPane2 = new javax.swing.JScrollPane(); + imagePreviewLabel = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.title")); // NOI18N + + cancelButton.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.cancelButton.text")); // NOI18N + cancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cancelButtonActionPerformed(evt); + } + }); + + okButton.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.okButton.text")); // NOI18N + okButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + okButtonActionPerformed(evt); + } + }); + + textureList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); + textureList.setSelectionModel(new ToggleSelectionModel()); + textureList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { + public void valueChanged(javax.swing.event.ListSelectionEvent evt) { + textureListValueChanged(evt); + } + }); + jScrollPane1.setViewportView(textureList); + + imagePreviewLabel.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.imagePreviewLabel.text")); // NOI18N + jScrollPane2.setViewportView(imagePreviewLabel); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(357, Short.MAX_VALUE) + .addComponent(cancelButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(okButton) + .addGap(17, 17, 17)) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(okButton) + .addComponent(cancelButton))) + ); + + pack(); + }// //GEN-END:initComponents + + private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed + setTexture(); + dispose(); + }//GEN-LAST:event_okButtonActionPerformed + + private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed + dispose(); + }//GEN-LAST:event_cancelButtonActionPerformed + + private void textureListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_textureListValueChanged + selectionChanged(); + }//GEN-LAST:event_textureListValueChanged + + private void setTexture() { + if (textureList.getSelectedIndex() > -1) { + textureList.getSelectedValue(); + String selected = (String) textureList.getSelectedValue(); + Texture tex = assetManager.loadTexture(selected); + editor.setValue(tex); + editor.setAsText(selected); + } else { + editor.setValue(null); + editor.setAsText(null); + } + } + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton cancelButton; + private javax.swing.JLabel imagePreviewLabel; + private javax.swing.JPanel jPanel1; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JButton okButton; + private javax.swing.JList textureList; + // End of variables declaration//GEN-END:variables + + private void loadAvailableTextures() { + if (assetManager == null) + return; + + textureList.setListData(assetManager.getTextures()); + + } + + private void selectionChanged() { + if (textureList.getSelectedIndex() > -1) { + String selected = (String) textureList.getSelectedValue(); + Texture tex = assetManager.loadTexture(selected); + Icon newicon = null; + if(selected.endsWith(".dds")||selected.endsWith(".DDS")){ + try { + File file = FileUtil.toFile(assetManager.getAssetFolder().getFileObject(selected)); + DDSImageFile ddsImageFile = new DDSImageFile(file); + BufferedImage bufferedImage = ddsImageFile.getData(); + newicon = new ImageIcon(bufferedImage); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + }else{ + newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0)); + } + imagePreviewLabel.setIcon(newicon); + } else { + imagePreviewLabel.setIcon(null); + } + } + + private void setSelectedTexture(Texture texture) { + if (texture != null) { + Logger.getLogger(TextureBrowser.class.getName()).finer("Looking for Texture: "+texture.getName()); + for (int i=0; i listeners = new LinkedList(); + private Texture texture; + private AssetManager manager; + private String assetKey; + + public TexturePropertyEditor() { + } + + public TexturePropertyEditor(Texture texture) { + this.texture = texture; + } + + public TexturePropertyEditor(AssetManager manager) { + this.manager = manager; + } + + public TexturePropertyEditor(Texture texture, AssetManager manager) { + this.texture = texture; + this.manager = manager; + } + + public void setValue(Object value) { + if (value instanceof Texture) { + texture = (Texture) value; + } else { + texture = null; + } + } + + public Object getValue() { + return texture; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { +// if (texture != null) { +// return texture.getName(); +// } + return assetKey; + } + + public void setAsText(String text) throws IllegalArgumentException { + this.assetKey = text; + //TODO: load texture if not done.. maybe load here instead of panel.. + } + + public String[] getTags() { + return null; + } + + public Component getCustomEditor() { + ProjectAssetManager currentProjectAssetManager = null; + if (manager instanceof ProjectAssetManager) { + currentProjectAssetManager = (ProjectAssetManager) manager; + } + //try { + if (currentProjectAssetManager == null) { + currentProjectAssetManager = (ProjectAssetManager) SceneApplication.getApplication().getAssetManager(); + } + TextureBrowser textureBrowser = new TextureBrowser(null, true, currentProjectAssetManager, this); + return textureBrowser; + //} catch (Exception e) { + //Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, e.getMessage()+" Could not get project asset manager!", e); + //return null; + //} + } + + public boolean supportsCustomEditor() { + return true; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/UserDataProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/UserDataProperty.java new file mode 100644 index 000000000..cbc8a224e --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/UserDataProperty.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.scene.Spatial; +import java.beans.PropertyEditor; +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import org.openide.nodes.PropertySupport; +import org.openide.util.Exceptions; + +/** + * + * @author normenhansen + */ +public class UserDataProperty extends PropertySupport.ReadWrite { + + private Spatial spatial; + private String name = "null"; + private int type = 0; + private List listeners = new LinkedList(); + + public UserDataProperty(Spatial node, String name) { + super(name, String.class, name, ""); + this.spatial = node; + this.name = name; + this.type = getObjectType(node.getUserData(name)); + } + + public static int getObjectType(Object type) { + if (type instanceof Integer) { + return 0; + } else if (type instanceof Float) { + return 1; + } else if (type instanceof Boolean) { + return 2; + } else if (type instanceof String) { + return 3; + } else if (type instanceof Long) { + return 4; + } else { + throw new IllegalArgumentException("Unsupported type: " + type); + } + } + + @Override + public String getValue() throws IllegalAccessException, InvocationTargetException { + return spatial.getUserData(name) + ""; + } + + @Override + public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + if (spatial == null) { + return; + } + try { + SceneApplication.getApplication().enqueue(new Callable() { + + public Void call() throws Exception { + switch (type) { + case 0: + spatial.setUserData(name, Integer.parseInt(val)); + break; + case 1: + spatial.setUserData(name, Float.parseFloat(val)); + break; + case 2: + spatial.setUserData(name, Boolean.parseBoolean(val)); + break; + case 3: + spatial.setUserData(name, val); + break; + case 4: + spatial.setUserData(name, Long.parseLong(val)); + break; + default: + throw new UnsupportedOperationException(); + } + return null; + } + }).get(); + notifyListeners(null, val); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + } + + @Override + public PropertyEditor getPropertyEditor() { + return null; +// return new AnimationPropertyEditor(control); + } + + public void addPropertyChangeListener(ScenePropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(ScenePropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(Object before, Object after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + ScenePropertyChangeListener propertyChangeListener = it.next(); + propertyChangeListener.propertyChange(getName(), before, after); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector2fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector2fPropertyEditor.java new file mode 100644 index 000000000..8496b0081 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector2fPropertyEditor.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.math.Vector2f; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class Vector2fPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + private Vector2f vector = new Vector2f(); + + public void setValue(Object value) { + if (value instanceof Vector2f) { + vector.set((Vector2f) value); + } + } + + public Object getValue() { + return vector; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { + return "[" + vector.x + ", " + vector.y + "]"; + } + + public void setAsText(String text) throws IllegalArgumentException { + text = text.replace('[', ' '); + text = text.replace(']', ' '); + String[] values = text.split(","); + if (values.length != 2) { + throw (new IllegalArgumentException("String not correct")); + } + float[] floats = new float[2]; + for (int i = 0; i < values.length; i++) { + String string = values[i]; + floats[i] = Float.parseFloat(string); + } + Vector2f old = new Vector2f(); + old.set(vector); + vector.set(floats[0], floats[1]); + notifyListeners(old, vector); + } + + public String[] getTags() { + return null; + } + + public Component getCustomEditor() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean supportsCustomEditor() { + return false; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(Vector2f before, Vector2f after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + PropertyChangeListener propertyChangeListener = it.next(); + //TODO: check what the "programmatic name" is supposed to be here.. for now its Vector2f + propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector3fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector3fPropertyEditor.java new file mode 100644 index 000000000..c3886f0f5 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector3fPropertyEditor.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.gde.core.properties; + +import com.jme3.math.Vector3f; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class Vector3fPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + private Vector3f vector = new Vector3f(); + + public void setValue(Object value) { + if (value instanceof Vector3f) { + vector.set((Vector3f) value); + } + } + + public Object getValue() { + return vector; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue(Graphics gfx, Rectangle box) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getJavaInitializationString() { + return null; + } + + public String getAsText() { + return "[" + vector.x + ", " + vector.y + ", " + vector.z + "]"; + } + + public void setAsText(String text) throws IllegalArgumentException { + text = text.replace('[', ' '); + text = text.replace(']', ' '); + String[] values = text.split(","); + if (values.length != 3) { + throw (new IllegalArgumentException("String not correct")); + } + float[] floats = new float[3]; + for (int i = 0; i < values.length; i++) { + String string = values[i]; + floats[i] = Float.parseFloat(string); + } + Vector3f old = new Vector3f(); + old.set(vector); + vector.set(floats[0], floats[1], floats[2]); + notifyListeners(old, vector); + } + + public String[] getTags() { + return null; + } + + public Component getCustomEditor() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean supportsCustomEditor() { + return false; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(Vector3f before, Vector3f after) { + for (Iterator it = listeners.iterator(); it.hasNext();) { + PropertyChangeListener propertyChangeListener = it.next(); + //TODO: check what the "programmatic name" is supposed to be here.. for now its Vector3f + propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); + } + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractStatefulGLToolAction.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/actions/AbstractStatefulGLToolAction.java similarity index 98% rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractStatefulGLToolAction.java rename to sdk/jme3-core/src/com/jme3/gde/core/scene/actions/AbstractStatefulGLToolAction.java index cc58497a9..694269d6d 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractStatefulGLToolAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/actions/AbstractStatefulGLToolAction.java @@ -29,7 +29,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.jme3.gde.core.sceneexplorer.nodes.actions; +package com.jme3.gde.core.scene.actions; import com.jme3.gde.core.scene.SceneApplication; import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java index a3c1e154f..f1ce35099 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java @@ -31,12 +31,17 @@ */ package com.jme3.gde.core.sceneexplorer.nodes; -import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerProperty; -import com.jme3.gde.core.sceneexplorer.nodes.properties.ScenePropertyChangeListener; +import com.jme3.gde.core.nodes.DynamicLookup; +import com.jme3.gde.core.properties.SceneExplorerProperty; +import com.jme3.gde.core.properties.ScenePropertyChangeListener; +import com.jme3.gde.core.util.PropertyUtils; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Field; import org.openide.loaders.DataObject; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.nodes.Node; +import org.openide.nodes.Sheet; import org.openide.util.Exceptions; import org.openide.util.Lookup; import org.openide.util.lookup.InstanceContent; @@ -55,33 +60,33 @@ public abstract class AbstractSceneExplorerNode extends AbstractNode implements protected DataObject dataObject; public AbstractSceneExplorerNode() { - super(Children.LEAF, new SceneExplorerLookup(new InstanceContent())); - lookupContents = ((SceneExplorerLookup) getLookup()).getInstanceContent(); + super(Children.LEAF, new DynamicLookup(new InstanceContent())); + lookupContents = ((DynamicLookup) getLookup()).getInstanceContent(); } public AbstractSceneExplorerNode(Children children, DataObject dataObject) { - super(children, new ProxyLookup(dataObject.getLookup(), new SceneExplorerLookup(new InstanceContent()))); + super(children, new ProxyLookup(dataObject.getLookup(), new DynamicLookup(new InstanceContent()))); this.dataObject = dataObject; - lookupContents = getLookup().lookup(SceneExplorerLookup.class).getInstanceContent(); + lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent(); } public AbstractSceneExplorerNode(DataObject dataObject) { - super(Children.LEAF, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new SceneExplorerLookup(new InstanceContent()))); + super(Children.LEAF, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new DynamicLookup(new InstanceContent()))); this.dataObject = dataObject; - lookupContents = getLookup().lookup(SceneExplorerLookup.class).getInstanceContent(); + lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent(); } public AbstractSceneExplorerNode(Children children) { //TODO: OMG! - super(children, children instanceof SceneExplorerChildren - ? (((SceneExplorerChildren) children).getDataObject() != null - ? new ProxyLookup(((SceneExplorerChildren) children).getDataObject().getLookup(), new SceneExplorerLookup(new InstanceContent())) - : new SceneExplorerLookup(new InstanceContent())) - : new SceneExplorerLookup(new InstanceContent())); + 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(SceneExplorerLookup.class).getInstanceContent(); - if (children instanceof SceneExplorerChildren) { - this.dataObject = ((SceneExplorerChildren) children).getDataObject(); + lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent(); + if (children instanceof JmeSpatialChildren) { + this.dataObject = ((JmeSpatialChildren) children).getDataObject(); } } @@ -125,8 +130,8 @@ public abstract class AbstractSceneExplorerNode extends AbstractNode implements //TODO: refresh does not work public void refresh(boolean immediate) { - if (jmeChildren instanceof SceneExplorerChildren) { - ((SceneExplorerChildren) jmeChildren).refreshChildren(immediate); + if (jmeChildren instanceof JmeSpatialChildren) { + ((JmeSpatialChildren) jmeChildren).refreshChildren(immediate); } } @@ -161,6 +166,15 @@ public abstract class AbstractSceneExplorerNode extends AbstractNode implements return prop; } + protected void createFields(Class c, Sheet.Set set, Object obj) throws SecurityException { + for (Field field : c.getDeclaredFields()) { + PropertyDescriptor prop = PropertyUtils.getPropertyDescriptor(c, field); + if (prop != null) { + set.put(makeProperty(obj, prop.getPropertyType(), prop.getReadMethod().getName(), prop.getWriteMethod().getName(), prop.getDisplayName())); + } + } + } + public void propertyChange(final String name, final Object before, final Object after) { fireSave(true); firePropertyChange(name, before, after); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AssetLinkChildren.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AssetLinkChildren.java deleted file mode 100644 index e41eb8306..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AssetLinkChildren.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2009-2010 jMonkeyEngine - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'jMonkeyEngine' nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package com.jme3.gde.core.sceneexplorer.nodes; - -import com.jme3.asset.ModelKey; -import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.scene.AssetLinkNode; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import org.openide.nodes.Node; -import org.openide.util.Exceptions; - -/** - * - * @author normenhansen - */ -public class AssetLinkChildren extends SceneExplorerChildren { - - public AssetLinkChildren(AssetLinkNode spatial) { - super(spatial); - } - - public void refreshChildren(boolean immediate) { - setKeys(createKeys()); - refresh(); - } - - protected List createKeys() { - try { - return SceneApplication.getApplication().enqueue(new Callable>() { - - public List call() throws Exception { - List keys = new LinkedList(); - if (spatial instanceof AssetLinkNode) { - keys.addAll(((AssetLinkNode)spatial).getAssetLoaderKeys()); - return keys; - } - return keys; - } - }).get(); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - return null; - } - - public void setReadOnly(boolean cookie) { - this.readOnly = cookie; - } - - @Override - protected void addNotify() { - super.addNotify(); - setKeys(createKeys()); - } - - @Override - protected Node[] createNodes(Object key) { - if (key instanceof ModelKey) { - ModelKey assetKey = (ModelKey)key; - return new Node[]{new JmeAssetLinkChild(assetKey, (AssetLinkNode)spatial)}; - } - return null; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAmbientLight.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAmbientLight.java index 385b47cfa..4cabff7b9 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAmbientLight.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAmbientLight.java @@ -32,6 +32,7 @@ package com.jme3.gde.core.sceneexplorer.nodes; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.light.AmbientLight; import com.jme3.math.Vector3f; import com.jme3.scene.Spatial; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java index a9a5ec34d..c0f645c1e 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java @@ -33,7 +33,9 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.animation.AnimControl; import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.sceneexplorer.nodes.properties.AnimationProperty; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; +import com.jme3.gde.core.properties.AnimationProperty; import com.jme3.scene.Spatial; import java.awt.Image; import java.io.IOException; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkNode.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkNode.java index 33cf11919..187ad0e14 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkNode.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkNode.java @@ -31,17 +31,32 @@ */ package com.jme3.gde.core.sceneexplorer.nodes; +import com.jme3.asset.ModelKey; +import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.scene.AssetLinkNode; import java.awt.Image; +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import javax.swing.Action; +import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; import org.openide.nodes.Sheet; +import org.openide.util.Exceptions; import org.openide.util.ImageUtilities; +import org.openide.util.actions.SystemAction; /** * * @author normenhansen */ -@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class) +@org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class) public class JmeAssetLinkNode extends JmeNode { private static Image smallImage = @@ -51,7 +66,7 @@ public class JmeAssetLinkNode extends JmeNode { public JmeAssetLinkNode() { } - public JmeAssetLinkNode(AssetLinkNode spatial, SceneExplorerChildren children) { + public JmeAssetLinkNode(AssetLinkNode spatial, JmeSpatialChildren children) { super(spatial, new AssetLinkChildren(spatial)); getLookupContents().add(spatial); this.geom = spatial; @@ -93,9 +108,108 @@ public class JmeAssetLinkNode extends JmeNode { } public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key); + JmeSpatialChildren children = new JmeSpatialChildren((com.jme3.scene.Spatial) key); children.setReadOnly(cookie); children.setDataObject(key2); return new org.openide.nodes.Node[]{new JmeAssetLinkNode((AssetLinkNode) key, children).setReadOnly(cookie)}; } + + public static class AssetLinkChildren extends JmeSpatialChildren { + + public AssetLinkChildren(AssetLinkNode spatial) { + super(spatial); + } + + public void refreshChildren(boolean immediate) { + setKeys(createKeys()); + refresh(); + } + + protected List createKeys() { + try { + return SceneApplication.getApplication().enqueue(new Callable>() { + + public List call() throws Exception { + List keys = new LinkedList(); + if (spatial instanceof AssetLinkNode) { + keys.addAll(((AssetLinkNode) spatial).getAssetLoaderKeys()); + return keys; + } + return keys; + } + }).get(); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + return null; + } + + public void setReadOnly(boolean cookie) { + this.readOnly = cookie; + } + + @Override + protected void addNotify() { + super.addNotify(); + setKeys(createKeys()); + } + + @Override + protected Node[] createNodes(Object key) { + if (key instanceof ModelKey) { + ModelKey assetKey = (ModelKey) key; + return new Node[]{new JmeAssetLinkChild(assetKey, (AssetLinkNode) spatial)}; + } + return null; + } + } + + public static class JmeAssetLinkChild extends AbstractNode { + + private ModelKey key; + private AssetLinkNode linkNode; + + public JmeAssetLinkChild(ModelKey key, AssetLinkNode linkNode) { + super(Children.LEAF); + this.key = key; + this.linkNode = linkNode; + this.setName(key.getName()); + } + + @Override + public Action[] getActions(boolean context) { + return new SystemAction[]{ + SystemAction.get(DeleteAction.class) + }; + } + + @Override + public boolean canDestroy() { + return true; + } + + @Override + public void destroy() throws IOException { + super.destroy(); + try { + SceneApplication.getApplication().enqueue(new Callable() { + + public Void call() throws Exception { + linkNode.detachLinkedChild(key); + return null; + } + }).get(); + JmeSpatial node = ((JmeSpatial) getParentNode()); + if (node != null) { + node.refresh(false); + } + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + } + } } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAudioNode.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAudioNode.java index 984d02521..ef96ad768 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAudioNode.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAudioNode.java @@ -34,7 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.audio.AudioNode; import com.jme3.audio.AudioNode.Status; import com.jme3.audio.Filter; -import com.jme3.gde.core.sceneexplorer.nodes.properties.AudioDataProperty; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; +import com.jme3.gde.core.properties.AudioDataProperty; import com.jme3.math.Vector3f; import java.awt.Image; import org.openide.loaders.DataObject; @@ -55,7 +56,7 @@ public class JmeAudioNode extends JmeNode { public JmeAudioNode() { } - public JmeAudioNode(AudioNode spatial, SceneExplorerChildren children) { + public JmeAudioNode(AudioNode spatial, JmeSpatialChildren children) { super(spatial, children); getLookupContents().add(spatial); this.node = spatial; @@ -119,7 +120,7 @@ public class JmeAudioNode extends JmeNode { } public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key); + JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key); children.setReadOnly(cookie); children.setDataObject(key2); return new org.openide.nodes.Node[]{new JmeAudioNode((AudioNode) key, children).setReadOnly(cookie)}; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBitmapText.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBitmapText.java index a89a06a55..2b8355896 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBitmapText.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBitmapText.java @@ -33,6 +33,7 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.font.BitmapFont; import com.jme3.font.BitmapText; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.math.ColorRGBA; import java.awt.Image; import org.openide.loaders.DataObject; @@ -53,7 +54,7 @@ public class JmeBitmapText extends JmeNode { public JmeBitmapText() { } - public JmeBitmapText(BitmapText spatial, SceneExplorerChildren children) { + public JmeBitmapText(BitmapText spatial, JmeSpatialChildren children) { super(spatial, children); getLookupContents().add(spatial); this.geom = spatial; @@ -100,7 +101,7 @@ public class JmeBitmapText extends JmeNode { } public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key); + JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key); children.setReadOnly(cookie); children.setDataObject(key2); return new org.openide.nodes.Node[]{new JmeBitmapText((BitmapText) key, children).setReadOnly(cookie)}; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java index 848b4912e..e243509c3 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java @@ -34,6 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bullet.collision.shapes.CollisionShape; import com.jme3.bullet.control.CharacterControl; import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.math.Vector3f; import com.jme3.scene.Spatial; import java.awt.Image; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeDirectionalLight.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeDirectionalLight.java index e5f3478d9..a1315a33f 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeDirectionalLight.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeDirectionalLight.java @@ -32,6 +32,7 @@ package com.jme3.gde.core.sceneexplorer.nodes; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.light.DirectionalLight; import com.jme3.math.Vector3f; import com.jme3.scene.Spatial; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java index d359f6201..be1d25606 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java @@ -31,9 +31,10 @@ */ package com.jme3.gde.core.sceneexplorer.nodes; +import com.jme3.gde.core.nodes.DynamicLookup; import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerProperty; -import com.jme3.gde.core.sceneexplorer.nodes.properties.ScenePropertyChangeListener; +import com.jme3.gde.core.properties.SceneExplorerProperty; +import com.jme3.gde.core.properties.ScenePropertyChangeListener; import com.jme3.gde.core.util.PropertyUtils; import com.jme3.scene.Spatial; import com.jme3.scene.control.Control; @@ -69,8 +70,8 @@ public class JmeGenericControl extends AbstractNode implements ScenePropertyChan public JmeGenericControl(Control control, DataObject dataObject) { //TODO: lookup content! (control etc) - super(Children.LEAF, new ProxyLookup(dataObject.getLookup(), new SceneExplorerLookup(new InstanceContent()))); - lookupContents = getLookup().lookup(SceneExplorerLookup.class).getInstanceContent(); + super(Children.LEAF, new ProxyLookup(dataObject.getLookup(), new DynamicLookup(new InstanceContent()))); + lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent(); this.control = control; this.dobject = dataObject; lookupContents.add(this); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java index 7ab8e98ad..6429b068c 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java @@ -31,6 +31,7 @@ */ package com.jme3.gde.core.sceneexplorer.nodes; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.material.Material; import com.jme3.scene.Geometry; import com.jme3.scene.Mesh; @@ -53,7 +54,7 @@ public class JmeGeometry extends JmeSpatial { public JmeGeometry() { } - public JmeGeometry(Geometry spatial, SceneExplorerChildren children) { + public JmeGeometry(Geometry spatial, JmeSpatialChildren children) { super(spatial, children); getLookupContents().add(spatial); this.geom = spatial; @@ -100,7 +101,7 @@ public class JmeGeometry extends JmeSpatial { } public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key); + JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key); children.setReadOnly(cookie); children.setDataObject(key2); return new org.openide.nodes.Node[]{new JmeGeometry((Geometry) key, children).setReadOnly(cookie)}; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java index 165051b1a..c1bfbd7da 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java @@ -34,6 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bullet.collision.shapes.CollisionShape; import com.jme3.bullet.control.GhostControl; import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; import com.jme3.scene.Spatial; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeLight.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeLight.java index e350d53c3..fe8464d4b 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeLight.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeLight.java @@ -32,6 +32,8 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.light.Light; import com.jme3.math.ColorRGBA; import com.jme3.scene.Spatial; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeMesh.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeMesh.java index 13c8df11f..3055de7a5 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeMesh.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeMesh.java @@ -32,6 +32,8 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.light.Light; import com.jme3.scene.Geometry; import com.jme3.scene.Mesh; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeNode.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeNode.java index e5942c8bf..5f1c638ac 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeNode.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeNode.java @@ -32,11 +32,13 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.sceneexplorer.nodes.actions.AddControlAction; -import com.jme3.gde.core.sceneexplorer.nodes.actions.AddLightAction; -import com.jme3.gde.core.sceneexplorer.nodes.actions.AddSpatialAction; +import com.jme3.gde.core.sceneexplorer.nodes.ClipboardSpatial; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.actions.NewControlPopup; +import com.jme3.gde.core.sceneexplorer.nodes.actions.NewLightPopup; +import com.jme3.gde.core.sceneexplorer.nodes.actions.NewSpatialPopup; import com.jme3.gde.core.sceneexplorer.nodes.actions.AddUserDataAction; -import com.jme3.gde.core.sceneexplorer.nodes.actions.UseToolAction; +import com.jme3.gde.core.sceneexplorer.nodes.actions.ToolPopup; import com.jme3.scene.Node; import com.jme3.scene.Spatial; import java.awt.Image; @@ -74,7 +76,7 @@ public class JmeNode extends JmeSpatial { public JmeNode() { } - public JmeNode(Node spatial, SceneExplorerChildren children) { + public JmeNode(Node spatial, JmeSpatialChildren children) { super(spatial, children); getLookupContents().add(spatial); this.node = spatial; @@ -158,16 +160,16 @@ public class JmeNode extends JmeSpatial { @Override public Action[] getActions(boolean context) { // return super.getActions(context); - if (((SceneExplorerChildren) jmeChildren).readOnly) { + if (((JmeSpatialChildren) jmeChildren).readOnly) { return new Action[]{ SystemAction.get(CopyAction.class),}; } else { return new Action[]{ - new AddSpatialAction(this), - new AddControlAction(this), - new AddLightAction(this), + new NewSpatialPopup(this), + new NewControlPopup(this), + new NewLightPopup(this), Actions.alwaysEnabled(new AddUserDataAction(this), "Add User Data", "", false), - new UseToolAction(this), + new ToolPopup(this), SystemAction.get(RenameAction.class), SystemAction.get(CopyAction.class), SystemAction.get(CutAction.class), @@ -186,7 +188,7 @@ public class JmeNode extends JmeSpatial { } public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children = new SceneExplorerChildren((com.jme3.scene.Spatial) key); + JmeSpatialChildren children = new JmeSpatialChildren((com.jme3.scene.Spatial) key); children.setReadOnly(cookie); children.setDataObject(key2); return new org.openide.nodes.Node[]{new JmeNode((Node) key, children).setReadOnly(cookie)}; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeParticleEmitter.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeParticleEmitter.java index ad46530f6..869c0b3d2 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeParticleEmitter.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeParticleEmitter.java @@ -33,6 +33,7 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.effect.shapes.EmitterShape; import com.jme3.effect.ParticleEmitter; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import java.awt.Image; @@ -55,7 +56,7 @@ public class JmeParticleEmitter extends JmeGeometry{ ImageUtilities.loadImage("com/jme3/gde/core/sceneexplorer/nodes/icons/particleemitter.gif"); private ParticleEmitter geom; - public JmeParticleEmitter(ParticleEmitter spatial, SceneExplorerChildren children) { + public JmeParticleEmitter(ParticleEmitter spatial, JmeSpatialChildren children) { super(spatial, children); getLookupContents().add(spatial); this.geom = spatial; @@ -83,27 +84,28 @@ public class JmeParticleEmitter extends JmeGeometry{ return sheet; } - set.put(makeProperty(obj, boolean.class, "isEnabled", "setEnabled", "Enabled")); - set.put(makeProperty(obj, EmitterShape.class, "getShape", "setShape", "Emitter Shape")); - set.put(makeProperty(obj, int.class, "getNumVisibleParticles", "setNumParticles", "Num Particles")); - set.put(makeProperty(obj, float.class, "getParticlesPerSec", "setParticlesPerSec", "Particles Per Sec")); - set.put(makeProperty(obj, ColorRGBA.class, "getStartColor", "setStartColor", "Start Color")); - set.put(makeProperty(obj, ColorRGBA.class, "getEndColor", "setEndColor", "End Color")); - set.put(makeProperty(obj, float.class, "getStartSize", "setStartSize", "Start Size")); - set.put(makeProperty(obj, float.class, "getEndSize", "setEndSize", "End Size")); - set.put(makeProperty(obj, float.class, "getHighLife", "setHighLife", "High Life")); - set.put(makeProperty(obj, float.class, "getLowLife", "setLowLife", "Low Life")); - set.put(makeProperty(obj, float.class, "getGravity", "setGravity", "Gravity")); - set.put(makeProperty(obj, Vector3f.class, "getInitialVelocity", "setInitialVelocity", "Initial Velocity")); - set.put(makeProperty(obj, Vector3f.class, "getFaceNormal", "setFaceNormal", "Face Normal")); - set.put(makeProperty(obj, float.class, "getVelocityVariation", "setVelocityVariation", "Velocity Variation")); - set.put(makeProperty(obj, boolean.class, "isFacingVelocity", "setFacingVelocity", "Facing Velocity")); - set.put(makeProperty(obj, boolean.class, "isRandomAngle", "setRandomAngle", "Random Angle")); - set.put(makeProperty(obj, boolean.class, "isInWorldSpace", "setInWorldSpace", "World Space")); - set.put(makeProperty(obj, float.class, "getRotateSpeed", "setRotateSpeed", "Rotate Speed")); - set.put(makeProperty(obj, boolean.class, "isSelectRandomImage", "setSelectRandomImage", "Select Random Image")); - set.put(makeProperty(obj, int.class, "getImagesX", "setImagesX", "Images X")); - set.put(makeProperty(obj, int.class, "getImagesY", "setImagesY", "Images Y")); + createFields(geom.getClass(), set, obj); +// set.put(makeProperty(obj, boolean.class, "isEnabled", "setEnabled", "Enabled")); +// set.put(makeProperty(obj, EmitterShape.class, "getShape", "setShape", "Emitter Shape")); +// set.put(makeProperty(obj, int.class, "getNumVisibleParticles", "setNumParticles", "Num Particles")); +// set.put(makeProperty(obj, float.class, "getParticlesPerSec", "setParticlesPerSec", "Particles Per Sec")); +// set.put(makeProperty(obj, ColorRGBA.class, "getStartColor", "setStartColor", "Start Color")); +// set.put(makeProperty(obj, ColorRGBA.class, "getEndColor", "setEndColor", "End Color")); +// set.put(makeProperty(obj, float.class, "getStartSize", "setStartSize", "Start Size")); +// set.put(makeProperty(obj, float.class, "getEndSize", "setEndSize", "End Size")); +// set.put(makeProperty(obj, float.class, "getHighLife", "setHighLife", "High Life")); +// set.put(makeProperty(obj, float.class, "getLowLife", "setLowLife", "Low Life")); +// set.put(makeProperty(obj, float.class, "getGravity", "setGravity", "Gravity")); +// set.put(makeProperty(obj, Vector3f.class, "getInitialVelocity", "setInitialVelocity", "Initial Velocity")); +// set.put(makeProperty(obj, Vector3f.class, "getFaceNormal", "setFaceNormal", "Face Normal")); +// set.put(makeProperty(obj, float.class, "getVelocityVariation", "setVelocityVariation", "Velocity Variation")); +// set.put(makeProperty(obj, boolean.class, "isFacingVelocity", "setFacingVelocity", "Facing Velocity")); +// set.put(makeProperty(obj, boolean.class, "isRandomAngle", "setRandomAngle", "Random Angle")); +// set.put(makeProperty(obj, boolean.class, "isInWorldSpace", "setInWorldSpace", "World Space")); +// set.put(makeProperty(obj, float.class, "getRotateSpeed", "setRotateSpeed", "Rotate Speed")); +// set.put(makeProperty(obj, boolean.class, "isSelectRandomImage", "setSelectRandomImage", "Select Random Image")); +// set.put(makeProperty(obj, int.class, "getImagesX", "setImagesX", "Images X")); +// set.put(makeProperty(obj, int.class, "getImagesY", "setImagesY", "Images Y")); // set.put(makeProperty(obj, EmitterShape.class, "getShape", "setShape", "shape")); @@ -123,7 +125,7 @@ public class JmeParticleEmitter extends JmeGeometry{ } public Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key); + JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key); children.setReadOnly(cookie); children.setDataObject(key2); return new Node[]{new JmeParticleEmitter((ParticleEmitter) key, children).setReadOnly(cookie)}; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePicture.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePicture.java index 1f1d96526..f433b18af 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePicture.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePicture.java @@ -31,6 +31,7 @@ */ package com.jme3.gde.core.sceneexplorer.nodes; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.ui.Picture; import java.awt.Image; import org.openide.loaders.DataObject; @@ -51,7 +52,7 @@ public class JmePicture extends JmeGeometry { public JmePicture() { } - public JmePicture(Picture spatial, SceneExplorerChildren children) { + public JmePicture(Picture spatial, JmeSpatialChildren children) { super(spatial, children); getLookupContents().add(spatial); this.geom = spatial; @@ -95,7 +96,7 @@ public class JmePicture extends JmeGeometry { } public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key); + JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key); children.setReadOnly(cookie); children.setDataObject(key2); return new org.openide.nodes.Node[]{new JmePicture((Picture) key, children).setReadOnly(cookie)}; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePointLight.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePointLight.java index f00a2d9b4..1f1afd3f3 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePointLight.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePointLight.java @@ -32,6 +32,7 @@ package com.jme3.gde.core.sceneexplorer.nodes; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.light.PointLight; import com.jme3.math.Vector3f; import com.jme3.scene.Spatial; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java index 79389e563..46fed8703 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java @@ -34,6 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bullet.collision.shapes.CollisionShape; import com.jme3.bullet.control.RigidBodyControl; import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; import com.jme3.scene.Spatial; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatial.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatial.java index a52eaddd5..703025ae8 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatial.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatial.java @@ -34,11 +34,14 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bounding.BoundingVolume; import com.jme3.export.binary.BinaryExporter; import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.sceneexplorer.nodes.actions.AddControlAction; -import com.jme3.gde.core.sceneexplorer.nodes.actions.AddLightAction; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.ClipboardSpatial; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.actions.NewControlPopup; +import com.jme3.gde.core.sceneexplorer.nodes.actions.NewLightPopup; import com.jme3.gde.core.sceneexplorer.nodes.actions.AddUserDataAction; -import com.jme3.gde.core.sceneexplorer.nodes.actions.UseToolAction; -import com.jme3.gde.core.sceneexplorer.nodes.properties.UserDataProperty; +import com.jme3.gde.core.sceneexplorer.nodes.actions.ToolPopup; +import com.jme3.gde.core.properties.UserDataProperty; import com.jme3.light.LightList; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; @@ -81,7 +84,7 @@ public class JmeSpatial extends AbstractSceneExplorerNode { public JmeSpatial() { } - public JmeSpatial(Spatial spatial, SceneExplorerChildren factory) { + public JmeSpatial(Spatial spatial, JmeSpatialChildren factory) { super(factory); this.jmeChildren = factory; this.spatial = spatial; @@ -125,15 +128,15 @@ public class JmeSpatial extends AbstractSceneExplorerNode { @Override public Action[] getActions(boolean context) { // return super.getActions(context); - if (((SceneExplorerChildren) jmeChildren).readOnly) { + if (((JmeSpatialChildren) jmeChildren).readOnly) { return new Action[]{ SystemAction.get(CopyAction.class),}; } else { return new Action[]{ - new AddControlAction(this), - new AddLightAction(this), + new NewControlPopup(this), + new NewLightPopup(this), Actions.alwaysEnabled(new AddUserDataAction(this), "Add User Data", "", false), - new UseToolAction(this), + new ToolPopup(this), SystemAction.get(RenameAction.class), SystemAction.get(CopyAction.class), SystemAction.get(CutAction.class), @@ -145,22 +148,22 @@ public class JmeSpatial extends AbstractSceneExplorerNode { @Override public boolean canCopy() { - return !((SceneExplorerChildren) jmeChildren).readOnly; + return !((JmeSpatialChildren) jmeChildren).readOnly; } @Override public boolean canCut() { - return !((SceneExplorerChildren) jmeChildren).readOnly; + return !((JmeSpatialChildren) jmeChildren).readOnly; } @Override public boolean canDestroy() { - return !((SceneExplorerChildren) jmeChildren).readOnly; + return !((JmeSpatialChildren) jmeChildren).readOnly; } @Override public boolean canRename() { - return !((SceneExplorerChildren) jmeChildren).readOnly; + return !((JmeSpatialChildren) jmeChildren).readOnly; } @Override @@ -347,7 +350,7 @@ public class JmeSpatial extends AbstractSceneExplorerNode { } public Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children = new SceneExplorerChildren((com.jme3.scene.Spatial) key); + JmeSpatialChildren children = new JmeSpatialChildren((com.jme3.scene.Spatial) key); children.setReadOnly(cookie); children.setDataObject(key2); return new Node[]{new JmeSpatial((Spatial) key, children).setReadOnly(cookie)}; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerChildren.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatialChildren.java similarity index 97% rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerChildren.java rename to sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatialChildren.java index 8865fe9d1..d653f5cd2 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerChildren.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatialChildren.java @@ -61,17 +61,17 @@ import org.openide.util.Lookup; * * @author normenhansen */ -public class SceneExplorerChildren extends Children.Keys { +public class JmeSpatialChildren extends Children.Keys { protected Spatial spatial; protected boolean readOnly = true; protected HashMap map = new HashMap(); private DataObject dataObject; - public SceneExplorerChildren() { + public JmeSpatialChildren() { } - public SceneExplorerChildren(Spatial spatial) { + public JmeSpatialChildren(Spatial spatial) { this.spatial = spatial; } @@ -143,7 +143,7 @@ public class SceneExplorerChildren extends Children.Keys { //TODO: go down in class hierarchy if class was not found, for now old checks are fallback if (key instanceof Spatial) { - SceneExplorerChildren children = new SceneExplorerChildren((Spatial) key); + JmeSpatialChildren children = new JmeSpatialChildren((Spatial) key); children.setReadOnly(readOnly); children.setDataObject(dataObject); if (key instanceof com.jme3.audio.AudioNode) { diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainQuad.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainQuad.java index 3d137f663..38225a0c7 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainQuad.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainQuad.java @@ -31,6 +31,7 @@ */ package com.jme3.gde.core.sceneexplorer.nodes; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.terrain.geomipmap.TerrainQuad; import java.awt.Image; import org.openide.loaders.DataObject; @@ -51,7 +52,7 @@ public class JmeTerrainQuad extends JmeNode { public JmeTerrainQuad() { } - public JmeTerrainQuad(TerrainQuad spatial, SceneExplorerChildren children) { + public JmeTerrainQuad(TerrainQuad spatial, JmeSpatialChildren children) { super(spatial, children); getLookupContents().add(spatial); this.geom = spatial; @@ -96,7 +97,7 @@ public class JmeTerrainQuad extends JmeNode { } public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) { - SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key); + JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key); children.setReadOnly(cookie); children.setDataObject(key2); return new org.openide.nodes.Node[]{new JmeTerrainQuad((TerrainQuad) key, children).setReadOnly(cookie)}; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java index 1eda955e6..99ee2bbba 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java @@ -33,18 +33,24 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bullet.collision.shapes.CollisionShape; import com.jme3.bullet.control.VehicleControl; +import com.jme3.bullet.objects.VehicleWheel; import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; import com.jme3.scene.Spatial; import java.awt.Image; import java.io.IOException; +import java.util.LinkedList; +import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import javax.swing.Action; import org.openide.actions.DeleteAction; import org.openide.loaders.DataObject; import org.openide.nodes.Children; +import org.openide.nodes.Node; import org.openide.nodes.Sheet; import org.openide.util.Exceptions; import org.openide.util.ImageUtilities; @@ -54,7 +60,7 @@ import org.openide.util.actions.SystemAction; * * @author normenhansen */ -@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class) +@org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class) public class JmeVehicleControl extends AbstractSceneExplorerNode { private static Image smallImage = @@ -100,7 +106,7 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode { @Override public void destroy() throws IOException { super.destroy(); - final Spatial spat=getParentNode().getLookup().lookup(Spatial.class); + final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); try { SceneApplication.getApplication().enqueue(new Callable() { @@ -109,7 +115,7 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode { return null; } }).get(); - ((AbstractSceneExplorerNode)getParentNode()).refresh(true); + ((AbstractSceneExplorerNode) getParentNode()).refresh(true); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } catch (ExecutionException ex) { @@ -172,4 +178,57 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode { children.setDataObject(key2); return new org.openide.nodes.Node[]{new JmeVehicleControl((VehicleControl) key, children).setReadOnly(cookie)}; } + + public static class PhysicsVehicleChildren extends JmeSpatialChildren { + + VehicleControl control; + + public PhysicsVehicleChildren(VehicleControl control) { + this.control = control; + } + + public void refreshChildren(boolean immediate) { + setKeys(createKeys()); + refresh(); + } + + protected List createKeys() { + try { + return SceneApplication.getApplication().enqueue(new Callable>() { + + public List call() throws Exception { + List keys = new LinkedList(); + for (int i = 0; i < control.getNumWheels(); i++) { + keys.add(control.getWheel(i)); + } + return keys; + } + }).get(); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + return null; + } + + public void setReadOnly(boolean cookie) { + this.readOnly = cookie; + } + + @Override + protected void addNotify() { + super.addNotify(); + setKeys(createKeys()); + } + + @Override + protected Node[] createNodes(Object key) { + if (key instanceof VehicleWheel) { + VehicleWheel assetKey = (VehicleWheel) key; + return new Node[]{new JmeVehicleWheel(control, assetKey)}; + } + return null; + } + } } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleWheel.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleWheel.java index 4ffb8e334..59c750f2a 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleWheel.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleWheel.java @@ -34,6 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.bullet.control.VehicleControl; import com.jme3.bullet.objects.VehicleWheel; import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; +import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.light.Light; import com.jme3.math.Vector3f; import java.awt.Image; diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/NodeUtility.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/NodeUtility.java index cdc94c738..dfdd1a6fd 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/NodeUtility.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/NodeUtility.java @@ -41,21 +41,21 @@ import org.openide.loaders.DataObject; public class NodeUtility { public static JmeNode createNode(Node node) { - SceneExplorerChildren factory = new SceneExplorerChildren(node); + JmeSpatialChildren factory = new JmeSpatialChildren(node); factory.setReadOnly(true); JmeNode jmeNode = new JmeNode(node, factory); return jmeNode; } public static JmeNode createNode(Node node, boolean readOnly) { - SceneExplorerChildren factory = new SceneExplorerChildren(node); + JmeSpatialChildren factory = new JmeSpatialChildren(node); factory.setReadOnly(readOnly); JmeNode jmeNode = new JmeNode(node, factory); return jmeNode; } public static JmeNode createNode(Node node, DataObject dataObject) { - SceneExplorerChildren factory = new SceneExplorerChildren(node); + JmeSpatialChildren factory = new JmeSpatialChildren(node); factory.setDataObject(dataObject); factory.setReadOnly(true); JmeNode jmeNode = new JmeNode(node, factory); @@ -63,7 +63,7 @@ public class NodeUtility { } public static JmeNode createNode(Node node, DataObject dataObject, boolean readOnly) { - SceneExplorerChildren factory = new SceneExplorerChildren(node); + JmeSpatialChildren factory = new JmeSpatialChildren(node); factory.setDataObject(dataObject); factory.setReadOnly(readOnly); JmeNode jmeNode = new JmeNode(node, factory); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/PhysicsVehicleChildren.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/PhysicsVehicleChildren.java deleted file mode 100644 index 4b13b06fd..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/PhysicsVehicleChildren.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2009-2010 jMonkeyEngine - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'jMonkeyEngine' nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package com.jme3.gde.core.sceneexplorer.nodes; - -import com.jme3.bullet.control.VehicleControl; -import com.jme3.bullet.objects.VehicleWheel; -import com.jme3.gde.core.scene.SceneApplication; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import org.openide.nodes.Node; -import org.openide.util.Exceptions; - -/** - * - * @author normenhansen - */ -public class PhysicsVehicleChildren extends SceneExplorerChildren { - - VehicleControl control; - - public PhysicsVehicleChildren(VehicleControl control) { - this.control = control; - } - - public void refreshChildren(boolean immediate) { - setKeys(createKeys()); - refresh(); - } - - protected List createKeys() { - try { - return SceneApplication.getApplication().enqueue(new Callable>() { - - public List call() throws Exception { - List keys = new LinkedList(); - for (int i = 0; i < control.getNumWheels(); i++) { - keys.add(control.getWheel(i)); - } - return keys; - } - }).get(); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - return null; - } - - public void setReadOnly(boolean cookie) { - this.readOnly = cookie; - } - - @Override - protected void addNotify() { - super.addNotify(); - setKeys(createKeys()); - } - - @Override - protected Node[] createNodes(Object key) { - if (key instanceof VehicleWheel) { - VehicleWheel assetKey = (VehicleWheel) key; - return new Node[]{new JmeVehicleWheel(control, assetKey)}; - } - return null; - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddControlAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewControlPopup.java similarity index 95% rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddControlAction.java rename to sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewControlPopup.java index ffd2f57b8..aae2538d9 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddControlAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewControlPopup.java @@ -45,13 +45,13 @@ import org.openide.util.actions.Presenter; * * @author normenhansen */ -public class AddControlAction extends AbstractAction implements Presenter.Popup { +public class NewControlPopup extends AbstractAction implements Presenter.Popup { protected JmeSpatial jmeSpatial; protected Node node; protected DataObject dataObject; - public AddControlAction(JmeSpatial node) { + public NewControlPopup(JmeSpatial node) { this.jmeSpatial = node; this.node = node.getLookup().lookup(Node.class); this.dataObject = node.getLookup().lookup(DataObject.class); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddLightAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewLightPopup.java similarity index 98% rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddLightAction.java rename to sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewLightPopup.java index 16e658966..1bdc06842 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddLightAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewLightPopup.java @@ -57,13 +57,13 @@ import org.openide.util.actions.Presenter; * * @author normenhansen */ -public class AddLightAction extends AbstractAction implements Presenter.Popup { +public class NewLightPopup extends AbstractAction implements Presenter.Popup { protected JmeSpatial jmeNode; protected Spatial node; protected DataObject dataObject; - public AddLightAction(JmeSpatial node) { + public NewLightPopup(JmeSpatial node) { this.jmeNode = node; this.node = node.getLookup().lookup(Spatial.class); this.dataObject = node.getLookup().lookup(DataObject.class); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddSpatialAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewSpatialPopup.java similarity index 98% rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddSpatialAction.java rename to sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewSpatialPopup.java index 960745a03..c8761e1fa 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AddSpatialAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewSpatialPopup.java @@ -58,13 +58,13 @@ import org.openide.util.actions.Presenter; * * @author normenhansen */ -public class AddSpatialAction extends AbstractAction implements Presenter.Popup { +public class NewSpatialPopup extends AbstractAction implements Presenter.Popup { protected JmeNode jmeNode; protected Node node; protected DataObject dataObject; - public AddSpatialAction(JmeNode node) { + public NewSpatialPopup(JmeNode node) { this.jmeNode = node; this.node = node.getLookup().lookup(Node.class); this.dataObject = node.getLookup().lookup(DataObject.class); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/UseToolAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/ToolPopup.java similarity index 95% rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/UseToolAction.java rename to sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/ToolPopup.java index 49d6117e4..78ba83a06 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/UseToolAction.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/ToolPopup.java @@ -45,12 +45,12 @@ import org.openide.util.actions.Presenter; * * @author normenhansen */ -public class UseToolAction extends AbstractAction implements Presenter.Popup { +public class ToolPopup extends AbstractAction implements Presenter.Popup { protected AbstractSceneExplorerNode exNode; protected DataObject dataObject; - public UseToolAction(AbstractSceneExplorerNode node) { + public ToolPopup(AbstractSceneExplorerNode node) { this.exNode = node; this.dataObject = node.getLookup().lookup(DataObject.class); } diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java index 77e4c1ff9..a93750370 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java @@ -38,8 +38,8 @@ import com.jme3.gde.core.scene.SceneApplication; import com.jme3.gde.core.scene.SceneRequest; import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode; -import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerProperty; -import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerPropertyEditor; +import com.jme3.gde.core.properties.SceneExplorerProperty; +import com.jme3.gde.core.properties.SceneExplorerPropertyEditor; import com.jme3.material.Material; import java.awt.Component; import java.awt.Graphics; diff --git a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java index 05c4d1b86..63102b345 100644 --- a/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java +++ b/sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java @@ -11,7 +11,7 @@ package com.jme3.gde.materials.multiview.widgets; import com.jme3.gde.core.assets.ProjectAssetManager; -import com.jme3.gde.core.sceneexplorer.nodes.properties.TexturePropertyEditor; +import com.jme3.gde.core.properties.TexturePropertyEditor; import com.jme3.gde.materials.MaterialProperty; import java.awt.Component; diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java index 6c6f5d26c..002ee7954 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java @@ -41,7 +41,7 @@ import com.jme3.gde.core.sceneexplorer.nodes.JmeNode; import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial; import com.jme3.gde.core.sceneexplorer.nodes.JmeTerrainQuad; import com.jme3.gde.core.sceneexplorer.nodes.NodeUtility; -import com.jme3.gde.core.sceneexplorer.nodes.properties.TexturePropertyEditor; +import com.jme3.gde.core.properties.TexturePropertyEditor; import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit; import com.jme3.gde.core.undoredo.SceneUndoRedoManager; import com.jme3.gde.core.util.DataObjectSaveNode; diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java index 0c1044ed9..3cd504d8e 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java @@ -31,7 +31,7 @@ */ package com.jme3.gde.terraineditor.sky; -import com.jme3.gde.core.sceneexplorer.nodes.properties.TexturePropertyEditor; +import com.jme3.gde.core.properties.TexturePropertyEditor; import com.jme3.texture.Texture; import java.awt.Component; import javax.swing.Icon; diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java index 64b891b1b..a3d824db0 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java @@ -32,7 +32,7 @@ package com.jme3.gde.terraineditor.tools; -import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractStatefulGLToolAction; +import com.jme3.gde.core.scene.actions.AbstractStatefulGLToolAction; import com.jme3.scene.Node; import com.jme3.scene.Spatial; import com.jme3.terrain.Terrain;