From f01888de8f37cce71cd38b39c8267fd5696e0cfa Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Sat, 11 Aug 2012 08:27:23 +0000 Subject: [PATCH] SDK : - New way to visualize and play animations in the SceneExplorer - Visualization of animation tracks - Possibility to add and edit EffectTracks and AudioTracks - reworked icons a bit too git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9635 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../core/properties/AudioTrackProperty.java | 94 ++++++ .../properties/AudioTrackPropertyEditor.java | 138 +++++++++ .../EffectTrackEmitterProperty.java | 92 ++++++ .../EffectTrackEmitterPropertyEditor.java | 138 +++++++++ .../core/properties/SliderPropertyEditor.java | 96 ++++++ .../sceneexplorer/nodes/JmeAnimChildren.java | 135 +++++++++ .../sceneexplorer/nodes/JmeAnimControl.java | 166 ++++++++++- .../sceneexplorer/nodes/JmeAnimation.java | 273 ++++++++++++++++++ .../core/sceneexplorer/nodes/JmeTrack.java | 263 +++++++++++++++++ .../sceneexplorer/nodes/JmeTrackChildren.java | 160 ++++++++++ .../nodes/actions/TrackVisibilityPopup.java | 89 ++++++ .../impl/tracks/AudioTrackVisualPanel1.form | 183 ++++++++++++ .../impl/tracks/AudioTrackVisualPanel1.java | 232 +++++++++++++++ .../impl/tracks/AudioTrackWizardAction.java | 119 ++++++++ .../impl/tracks/AudioTrackWizardPanel1.java | 126 ++++++++ .../actions/impl/tracks/Bundle.properties | 11 + .../impl/tracks/EffectTrackVisualPanel1.form | 183 ++++++++++++ .../impl/tracks/EffectTrackVisualPanel1.java | 231 +++++++++++++++ .../impl/tracks/EffectTrackWizardAction.java | 119 ++++++++ .../impl/tracks/EffectTrackWizardPanel1.java | 126 ++++++++ .../core/sceneexplorer/nodes/icons/anim.png | Bin 0 -> 850 bytes .../sceneexplorer/nodes/icons/animPlay.png | Bin 0 -> 665 bytes .../nodes/icons/animationcontrol.gif | Bin 163 -> 572 bytes .../sceneexplorer/nodes/icons/audioTrack.png | Bin 0 -> 794 bytes .../sceneexplorer/nodes/icons/bitmaptext.gif | Bin 127 -> 295 bytes .../sceneexplorer/nodes/icons/boneTrack.png | Bin 0 -> 763 bytes .../nodes/icons/charactercontrol.gif | Bin 159 -> 561 bytes .../sceneexplorer/nodes/icons/effectTrack.png | Bin 0 -> 748 bytes .../sceneexplorer/nodes/icons/geometry.gif | Bin 118 -> 562 bytes .../nodes/icons/ghostcontrol.gif | Bin 168 -> 581 bytes .../sceneexplorer/nodes/icons/ghostnode.gif | Bin 90 -> 323 bytes .../nodes/icons/physicscontrol.gif | Bin 144 -> 553 bytes .../nodes/icons/skeletonControl.gif | Bin 561 -> 598 bytes .../core/sceneexplorer/nodes/icons/track.png | Bin 0 -> 582 bytes .../com/jme3/gde/core/util/Bundle.properties | 1 + .../gde/core/util/SliderInplaceEditor.java | 127 ++++++++ .../com/jme3/gde/core/util/SliderPanel.form | 61 ++++ .../com/jme3/gde/core/util/SliderPanel.java | 156 ++++++++++ 38 files changed, 3304 insertions(+), 15 deletions(-) create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/AudioTrackProperty.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/AudioTrackPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/EffectTrackEmitterProperty.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/EffectTrackEmitterPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/properties/SliderPropertyEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimChildren.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimation.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTrack.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTrackChildren.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/TrackVisibilityPopup.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackVisualPanel1.form create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackVisualPanel1.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackWizardAction.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackWizardPanel1.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/Bundle.properties create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.form create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackWizardAction.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackWizardPanel1.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/anim.png create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/animPlay.png create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/audioTrack.png create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/boneTrack.png create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/effectTrack.png create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/track.png create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/util/SliderInplaceEditor.java create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/util/SliderPanel.form create mode 100644 sdk/jme3-core/src/com/jme3/gde/core/util/SliderPanel.java diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioTrackProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioTrackProperty.java new file mode 100644 index 000000000..f0861a053 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioTrackProperty.java @@ -0,0 +1,94 @@ +/* + * 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.AudioTrack; +import com.jme3.animation.EffectTrack; +import com.jme3.audio.AudioNode; +import com.jme3.effect.ParticleEmitter; +import com.jme3.scene.Spatial; +import java.beans.PropertyEditor; +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; +import java.util.LinkedList; +import org.openide.nodes.PropertySupport; + +/** + * + * @author normenhansen + */ +public class AudioTrackProperty extends PropertySupport.ReadWrite { + + private LinkedList listeners = new LinkedList(); + private AudioTrack track; + private Spatial rootNode; + + public AudioTrackProperty(AudioTrack track, Spatial rootNode) { + super("AudioNode", AudioNode.class, "Audio node", " "); + this.rootNode = rootNode; + this.track = track; + + } + + @Override + public AudioNode getValue() throws IllegalAccessException, InvocationTargetException { + return track.getAudio(); + } + + @Override + public void setValue(final AudioNode val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + AudioNode au = getValue(); + track.setAudio(au); + notifyListeners(au, val); + } + + @Override + public PropertyEditor getPropertyEditor() { + return new AudioTrackPropertyEditor(rootNode, track.getAudio()); + } + + 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/AudioTrackPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioTrackPropertyEditor.java new file mode 100644 index 000000000..209066d72 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioTrackPropertyEditor.java @@ -0,0 +1,138 @@ +/* + * 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.AudioNode; +import com.jme3.effect.ParticleEmitter; +import com.jme3.scene.Node; +import com.jme3.scene.Spatial; +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.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class AudioTrackPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + Spatial rootNode; + AudioNode audio; + + public AudioTrackPropertyEditor(Spatial rootNode, AudioNode audio) { + this.rootNode = rootNode; + this.audio = audio; + } + + public void setValue(Object value) { + if (value instanceof AudioNode) { + audio = (AudioNode) value; + } + } + + public Object getValue() { + return audio; + } + + 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 audio.getName(); + } + + public void setAsText(String text) throws IllegalArgumentException { + AudioNode old = audio; + + audio = (AudioNode) ((Node) rootNode).getChild(text); + + notifyListeners(old, audio); + } + + public String[] getTags() { + ArrayList list = new ArrayList(); + gatherTags(rootNode, list); + String[] res = new String[list.size()]; + return list.toArray(res); + } + + private void gatherTags(Spatial root, ArrayList list) { + if (root instanceof AudioNode) { + list.add(root.getName()); + } else if (root instanceof Node) { + Node n = (Node) root; + for (Spatial child : n.getChildren()) { + gatherTags(child, list); + } + } + } + + 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(AudioNode before, AudioNode 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/EffectTrackEmitterProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/EffectTrackEmitterProperty.java new file mode 100644 index 000000000..6b44d5ca3 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/EffectTrackEmitterProperty.java @@ -0,0 +1,92 @@ +/* + * 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.EffectTrack; +import com.jme3.effect.ParticleEmitter; +import com.jme3.scene.Spatial; +import java.beans.PropertyEditor; +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; +import java.util.LinkedList; +import org.openide.nodes.PropertySupport; + +/** + * + * @author normenhansen + */ +public class EffectTrackEmitterProperty extends PropertySupport.ReadWrite { + + private LinkedList listeners = new LinkedList(); + private EffectTrack track; + private Spatial rootNode; + + public EffectTrackEmitterProperty(EffectTrack track, Spatial rootNode) { + super("Emitter", ParticleEmitter.class, "Particle Emitter", " "); + this.rootNode = rootNode; + this.track = track; + + } + + @Override + public ParticleEmitter getValue() throws IllegalAccessException, InvocationTargetException { + return track.getEmitter(); + } + + @Override + public void setValue(final ParticleEmitter val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + ParticleEmitter em = getValue(); + track.setEmitter(val); + notifyListeners(em, val); + } + + @Override + public PropertyEditor getPropertyEditor() { + return new EffectTrackEmitterPropertyEditor(rootNode, track.getEmitter()); + } + + 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/EffectTrackEmitterPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/EffectTrackEmitterPropertyEditor.java new file mode 100644 index 000000000..9564ac648 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/EffectTrackEmitterPropertyEditor.java @@ -0,0 +1,138 @@ +/* + * 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.ParticleEmitter; +import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial; +import com.jme3.scene.Node; +import com.jme3.scene.Spatial; +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.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; + +/** + * + * @author normenhansen + */ +public class EffectTrackEmitterPropertyEditor implements PropertyEditor { + + private LinkedList listeners = new LinkedList(); + Spatial rootNode; + ParticleEmitter emitter; + + public EffectTrackEmitterPropertyEditor(Spatial rootNode,ParticleEmitter emitter) { + this.rootNode = rootNode; + this.emitter = emitter; + } + + public void setValue(Object value) { + if (value instanceof ParticleEmitter) { + emitter = (ParticleEmitter)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() { + return emitter.getName(); + } + + public void setAsText(String text) throws IllegalArgumentException { + ParticleEmitter old = emitter; + + emitter = (ParticleEmitter) ((Node) rootNode).getChild(text); + + notifyListeners(old, emitter); + } + + public String[] getTags() { + ArrayList list = new ArrayList(); + gatherTags(rootNode, list); + String[] res = new String[list.size()]; + return list.toArray(res); + } + + private void gatherTags(Spatial root, ArrayList list) { + if (root instanceof Node) { + Node n = (Node) root; + for (Spatial child : n.getChildren()) { + gatherTags(child, list); + } + } else if (root instanceof ParticleEmitter) { + list.add(root.getName()); + } + } + + 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(ParticleEmitter before, ParticleEmitter 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/SliderPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/SliderPropertyEditor.java new file mode 100644 index 000000000..9bd303cf5 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/SliderPropertyEditor.java @@ -0,0 +1,96 @@ +package com.jme3.gde.core.properties; + +import com.jme3.gde.core.util.SliderInplaceEditor; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditorSupport; +import java.util.Iterator; +import java.util.LinkedList; +import org.openide.explorer.propertysheet.ExPropertyEditor; +import org.openide.explorer.propertysheet.InplaceEditor; +import org.openide.explorer.propertysheet.PropertyEnv; + +/** + * + * @author Nehon + */ +public class SliderPropertyEditor extends PropertyEditorSupport implements ExPropertyEditor, InplaceEditor.Factory { + + private LinkedList listeners = new LinkedList(); + PropertyEnv env; + + public SliderPropertyEditor() { + ed = new SliderInplaceEditor(0f, 100f); + } + + public void attachEnv(PropertyEnv env) { + this.env = env; + env.registerInplaceEditorFactory(this); + } + + public SliderPropertyEditor(int min, int max) { + ed = new SliderInplaceEditor(min, max); + } + + public SliderPropertyEditor(float min, float max) { + ed = new SliderInplaceEditor(min, max); + } + + public void setRange(float min, float max) { + ed.setRangeFloat(min, max); + } + + public void setRange(int min, int max) { + ed.setRangeInt(min, max); + } + + @Override + public String getAsText() { + return ed.getValue().toString(); + } + + @Override + public void setAsText(String s) { + Object o = ed.getValue(); + ((SliderInplaceEditor) ed).setAsText(s); + notifyListeners(o, ed.getValue()); + } + private SliderInplaceEditor ed = null; + + public InplaceEditor getInplaceEditor() { + return ed; + } + + @Override + public void setValue(Object value) { + ed.setValue(value); + + } + + @Override + public Object getValue() { + return ed.getValue(); + } + + public PropertyEnv getEnv() { + return env; + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + listeners.add(listener); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + listeners.remove(listener); + } + + private void notifyListeners(Object before, Object 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/sceneexplorer/nodes/JmeAnimChildren.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimChildren.java new file mode 100644 index 000000000..7fee2593e --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimChildren.java @@ -0,0 +1,135 @@ +/* + * 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.animation.AnimControl; +import com.jme3.animation.Animation; +import com.jme3.gde.core.scene.SceneApplication; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import org.openide.loaders.DataObject; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; + +/** + * + * @author nehon + */ +public class JmeAnimChildren extends Children.Keys { + + protected JmeAnimControl jmeAnimControl; + protected boolean readOnly = true; + protected HashMap map = new HashMap(); + private DataObject dataObject; + + public JmeAnimChildren() { + } + + public JmeAnimChildren(JmeAnimControl jmeAnimControl) { + this.jmeAnimControl = jmeAnimControl; + } + + public void refreshChildren(boolean immediate) { + setKeys(createKeys()); + refresh(); + } + + public void setReadOnly(boolean cookie) { + this.readOnly = cookie; + } + + @Override + protected void addNotify() { + super.addNotify(); + setKeys(createKeys()); + } + + protected List createKeys() { + try { + return SceneApplication.getApplication().enqueue(new Callable>() { + + public List call() throws Exception { + List keys = new LinkedList(); + AnimControl control = jmeAnimControl.getLookup().lookup(AnimControl.class); + if (control != null) { + for (String animName : control.getAnimationNames()) { + keys.add(control.getAnim(animName)); + } + } + + return keys; + } + }).get(); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + return null; + } + + @Override + protected Node[] createNodes(Object key) { +// for (SceneExplorerNode di : Lookup.getDefault().lookupAll(SceneExplorerNode.class)) { +// if (di.getExplorerObjectClass().getName().equals(key.getClass().getName())) { +// Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Found {0}", di.getExplorerNodeClass()); +// Node[] ret = di.createNodes(key, dataObject, readOnly); +// if (ret != null) { +// return ret; +// } +// } +// } + + if (key instanceof Animation) { + JmeTrackChildren children = new JmeTrackChildren(); + children.setReadOnly(readOnly); + return new Node[]{new JmeAnimation(jmeAnimControl, (Animation) key, children, dataObject).setReadOnly(readOnly)}; + } + return new Node[]{Node.EMPTY}; + } + + public void setAnimControl(JmeAnimControl jmeAnimControl) { + this.jmeAnimControl = jmeAnimControl; + } + + public DataObject getDataObject() { + return dataObject; + } + + public void setDataObject(DataObject dataObject) { + this.dataObject = dataObject; + } +} 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 c0f645c1e..760366cb7 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 @@ -32,10 +32,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.AbstractSceneExplorerNode; -import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode; import com.jme3.gde.core.properties.AnimationProperty; +import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.actions.TrackVisibilityPopup; import com.jme3.scene.Spatial; import java.awt.Image; import java.io.IOException; @@ -44,33 +43,41 @@ 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.HelpCtx; import org.openide.util.ImageUtilities; +import org.openide.util.actions.BooleanStateAction; import org.openide.util.actions.SystemAction; /** * * @author normenhansen */ -@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class) -public class JmeAnimControl extends AbstractSceneExplorerNode{ +@org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class) +public class JmeAnimControl extends AbstractSceneExplorerNode { private AnimControl animControl; + private JmeAnimation playingAnimation = null; + private boolean displayBoneTracks = false; + private boolean displayEffectTracks = true; + private boolean displayAudioTracks = true; private static Image smallImage = ImageUtilities.loadImage("com/jme3/gde/core/sceneexplorer/nodes/icons/animationcontrol.gif"); public JmeAnimControl() { } - public JmeAnimControl(AnimControl animControl) { - super(Children.LEAF); + public JmeAnimControl(AnimControl animControl, JmeAnimChildren children, DataObject obj) { + super(children); + dataObject = obj; + children.setDataObject(dataObject); this.animControl = animControl; lookupContents.add(this); lookupContents.add(animControl); setName("AnimControl"); + children.setAnimControl(this); } @Override @@ -101,12 +108,23 @@ public class JmeAnimControl extends AbstractSceneExplorerNode{ } + public boolean isPlaying() { + return playingAnimation != null; + } + + public void setAnim(JmeAnimation anim) { + if (playingAnimation != null) { + playingAnimation.stop(); + } + playingAnimation = anim; + } + @Override public Action[] getActions(boolean context) { - return new SystemAction[]{ - // SystemAction.get(CopyAction.class), - // SystemAction.get(CutAction.class), - // SystemAction.get(PasteAction.class), + + + return new Action[]{ + new TrackVisibilityPopup(this), SystemAction.get(DeleteAction.class) }; } @@ -119,7 +137,7 @@ public class JmeAnimControl 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() { @@ -128,7 +146,7 @@ public class JmeAnimControl extends AbstractSceneExplorerNode{ return null; } }).get(); - ((AbstractSceneExplorerNode)getParentNode()).refresh(true); + ((AbstractSceneExplorerNode) getParentNode()).refresh(true); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } catch (ExecutionException ex) { @@ -146,7 +164,125 @@ public class JmeAnimControl extends AbstractSceneExplorerNode{ @Override public Node[] createNodes(Object key, DataObject key2, boolean cookie) { - return new Node[]{new JmeAnimControl((AnimControl)key)}; + JmeAnimChildren children = new JmeAnimChildren(this); + return new Node[]{new JmeAnimControl((AnimControl) key, children, key2)}; + } + + public boolean isDisplayAudioTracks() { + return displayAudioTracks; + } + + public boolean isDisplayBoneTracks() { + return displayBoneTracks; } + public boolean isDisplayEffectTracks() { + return displayEffectTracks; + } + + public void setDisplayAudioTracks(boolean displayAudioTracks) { + this.displayAudioTracks = displayAudioTracks; + refreshChildren(); + } + + public void setDisplayBoneTracks(boolean displayBoneTracks) { + this.displayBoneTracks = displayBoneTracks; + refreshChildren(); + } + + public void setDisplayEffectTracks(boolean displayEffectTracks) { + this.displayEffectTracks = displayEffectTracks; + refreshChildren(); + } + + public void refreshChildren() { + for (Object node : getChildren().getNodes()) { + JmeAnimation anim = (JmeAnimation) node; + ((JmeTrackChildren) anim.getChildren()).refreshChildren(true); + } + } + + class ToggleBoneTrackAction extends BooleanStateAction { + + @Override + public String getName() { + return "Display bone tracks"; + } + + @Override + public void setBooleanState(boolean value) { + super.setBooleanState(value); + displayBoneTracks = value; + for (Object node : getChildren().getNodes()) { + JmeAnimation anim = (JmeAnimation) node; + ((JmeTrackChildren) anim.getChildren()).refreshChildren(true); + } + } + + @Override + public boolean getBooleanState() { + return displayBoneTracks; + } + + @Override + public HelpCtx getHelpCtx() { + return JmeAnimControl.this.getHelpCtx(); + } + }; + + class ToggleEffectTrackAction extends BooleanStateAction { + + @Override + public String getName() { + return "Display effect tracks"; + } + + @Override + public void setBooleanState(boolean value) { + super.setBooleanState(value); + displayEffectTracks = value; + for (Object node : getChildren().getNodes()) { + JmeAnimation anim = (JmeAnimation) node; + ((JmeTrackChildren) anim.getChildren()).refreshChildren(true); + } + } + + @Override + public boolean getBooleanState() { + return displayEffectTracks; + } + + @Override + public HelpCtx getHelpCtx() { + return JmeAnimControl.this.getHelpCtx(); + } + }; + + class ToggleAudioTrackAction extends BooleanStateAction { + + @Override + public String getName() { + return "Display audio tracks"; + } + + @Override + public void setBooleanState(boolean value) { + super.setBooleanState(value); + displayAudioTracks = value; + for (Object node : getChildren().getNodes()) { + JmeAnimation anim = (JmeAnimation) node; + ((JmeTrackChildren) anim.getChildren()).refreshChildren(true); + } + } + + @Override + public boolean getBooleanState() { + return displayAudioTracks; + } + + @Override + public HelpCtx getHelpCtx() { + return JmeAnimControl.this.getHelpCtx(); + } + }; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimation.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimation.java new file mode 100644 index 000000000..603465f5b --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimation.java @@ -0,0 +1,273 @@ +/* + * 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.animation.AnimControl; +import com.jme3.animation.Animation; +import com.jme3.gde.core.scene.SceneApplication; +import com.jme3.gde.core.sceneexplorer.nodes.actions.impl.tracks.AudioTrackWizardAction; +import com.jme3.gde.core.sceneexplorer.nodes.actions.impl.tracks.EffectTrackWizardAction; +import java.awt.Image; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.IOException; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import javax.swing.Action; +import org.openide.awt.Actions; +import org.openide.loaders.DataObject; +import org.openide.nodes.Node; +import org.openide.nodes.Sheet; +import org.openide.util.Exceptions; +import org.openide.util.ImageUtilities; + +/** + * + * @author nehon + */ +@org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class) +public class JmeAnimation extends AbstractSceneExplorerNode { + + private Animation animation; + private static final String ICON = "com/jme3/gde/core/sceneexplorer/nodes/icons/anim.png"; + private static final String ICON_PLAY = "com/jme3/gde/core/sceneexplorer/nodes/icons/animPlay.png"; + private Image icon; + private JmeAnimControl jmeControl; + private boolean playing = false; + + public JmeAnimation() { + } + + public JmeAnimation(JmeAnimControl control, Animation animation, JmeTrackChildren children, DataObject dataObject) { + super(children); + this.dataObject = dataObject; + children.setDataObject(dataObject); + this.animation = animation; + this.jmeControl = control; + lookupContents.add(this); + lookupContents.add(animation); + setName(animation.getName()); + children.setAnimation(this); + children.setAnimControl(jmeControl); + icon = ImageUtilities.loadImage(ICON); + + } + + @Override + public Image getIcon(int type) { + return icon; + } + + @Override + public Image getOpenedIcon(int type) { + + return icon; + + } + + public void toggleIcon(boolean enabled) { + if (!playing) { + icon = ImageUtilities.loadImage(ICON); + + } else { + icon = ImageUtilities.loadImage(ICON_PLAY); + + } + fireIconChange(); + } + + @Override + public Action getPreferredAction() { + return Actions.alwaysEnabled(new PlayAction(), "Play", "", false); + + } + + private void play() { + playing = !playing; + toggleIcon(playing); + jmeControl.setAnim(this); + } + + @Override + protected Sheet createSheet() { + //TODO: multithreading.. + Sheet sheet = Sheet.createDefault(); + Sheet.Set set = Sheet.createPropertiesSet(); + set.setDisplayName("Animation"); + set.setName(Animation.class.getName()); + if (animation == null) { + return sheet; + } + + // set.put(new AnimationProperty(animControl)); + + sheet.put(set); + return sheet; + + } + + public void setChanged() { + fireSave(true); + } + + @Override + public Action[] getActions(boolean context) { + + return new Action[]{Actions.alwaysEnabled(new PlayAction(), playing ? "Stop" : "Play", "", false), + Actions.alwaysEnabled(new EffectTrackWizardAction(jmeControl.getLookup().lookup(AnimControl.class).getSpatial(), this), "Add Effect Track", "", false), + Actions.alwaysEnabled(new AudioTrackWizardAction(jmeControl.getLookup().lookup(AnimControl.class).getSpatial(), this), "Add Audio Track", "", false) + }; + } + + @Override + public boolean canDestroy() { + return false; + } + + public void stop() { + playing = false; + toggleIcon(playing); + } + + @Override + public void destroy() throws IOException { +// super.destroy(); +// final Spatial spat = getParentNode().getLookup().lookup(Spatial.class); +// try { +// SceneApplication.getApplication().enqueue(new Callable() { +// +// public Void call() throws Exception { +// spat.removeControl(skeletonControl); +// return null; +// } +// }).get(); +// ((AbstractSceneExplorerNode) getParentNode()).refresh(true); +// } catch (InterruptedException ex) { +// Exceptions.printStackTrace(ex); +// } catch (ExecutionException ex) { +// Exceptions.printStackTrace(ex); +// } + } + + @Override + public void refresh(boolean immediate) { + super.refresh(immediate); + ((JmeTrackChildren) getChildren()).refreshChildren(false); + } + + public Class getExplorerObjectClass() { + return Animation.class; + } + + @Override + public Class getExplorerNodeClass() { + return JmeAnimation.class; + } + + @Override + public Node[] createNodes(Object key, DataObject key2, boolean cookie) { + JmeTrackChildren children = new JmeTrackChildren(this, jmeControl); + JmeAnimation jsc = new JmeAnimation(jmeControl, (Animation) key, children, key2); + return new Node[]{jsc}; + } + + class PlayAction implements ActionListener { + + public void actionPerformed(ActionEvent e) { + final AnimControl control = jmeControl.getLookup().lookup(AnimControl.class); + if (control == null) { + return; + } + try { + SceneApplication.getApplication().enqueue(new Callable() { + + public Void call() throws Exception { + if (playing) { + control.clearChannels(); + jmeControl.setAnim(null); + return null; + } + control.clearChannels(); + control.createChannel().setAnim(animation.getName()); + play(); + + return null; + } + }).get(); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + + } + } +// +// class AddTrackAction implements ActionListener { +// +// public void actionPerformed(ActionEvent e) { +// +// WizardDescriptor.Iterator iterator = new NewEffectTrackWizardIterator(); +// WizardDescriptor wizardDescriptor = new WizardDescriptor(iterator); +// // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() +// // {1} will be replaced by WizardDescriptor.Iterator.name() +// wizardDescriptor.setTitleFormat(new MessageFormat("{0} ({1})")); +// wizardDescriptor.setTitle("Your wizard dialog title here"); +// Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); +// dialog.setVisible(true); +// dialog.toFront(); +// boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; +// if (!cancelled) { +// // do something +// } +// final AnimControl control = jmeControl.getLookup().lookup(AnimControl.class); +// if (control == null) { +// return; +// } +// try { +// SceneApplication.getApplication().enqueue(new Callable() { +// +// public Void call() throws Exception { +// animation.addTrack(new EffectTrack()); +// animation.addTrack(new AudioTrack()); +// return null; +// } +// }).get(); +// } catch (InterruptedException ex) { +// Exceptions.printStackTrace(ex); +// } catch (ExecutionException ex) { +// Exceptions.printStackTrace(ex); +// } +// ((JmeTrackChildren) getChildren()).refreshChildren(false); +// } +// } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTrack.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTrack.java new file mode 100644 index 000000000..a3c36645f --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTrack.java @@ -0,0 +1,263 @@ +/* + * 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.animation.AnimControl; +import com.jme3.animation.Animation; +import com.jme3.animation.AudioTrack; +import com.jme3.animation.BoneTrack; +import com.jme3.animation.EffectTrack; +import com.jme3.animation.Track; +import com.jme3.gde.core.properties.AudioTrackProperty; +import com.jme3.gde.core.properties.EffectTrackEmitterProperty; +import com.jme3.gde.core.properties.SceneExplorerProperty; +import com.jme3.gde.core.properties.SliderPropertyEditor; +import com.jme3.gde.core.scene.SceneApplication; +import java.awt.Image; +import java.beans.PropertyEditor; +import java.io.IOException; +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.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) +public class JmeTrack extends AbstractSceneExplorerNode { + + private static Image iconBoneTrack = + ImageUtilities.loadImage("com/jme3/gde/core/sceneexplorer/nodes/icons/boneTrack.png"); + private static Image iconEffectTrack = + ImageUtilities.loadImage("com/jme3/gde/core/sceneexplorer/nodes/icons/effectTrack.png"); + private static Image iconAudioTrack = + ImageUtilities.loadImage("com/jme3/gde/core/sceneexplorer/nodes/icons/audioTrack.png"); + private static Image iconTrack = + ImageUtilities.loadImage("com/jme3/gde/core/sceneexplorer/nodes/icons/track.png"); + private Track track; + private AnimControl control; + + public JmeTrack() { + } + + public JmeTrack(Track track, AnimControl control, DataObject obj) { + super(Children.LEAF); + dataObject = obj; + + getLookupContents().add(track); + getLookupContents().add(this); + this.track = track; + this.control = control; + setName(); + } + + private void setName() { + if (track instanceof BoneTrack) { + BoneTrack boneTrack = (BoneTrack) track; + super.setName("BoneTrack : " + control.getSkeleton().getBone(boneTrack.getTargetBoneIndex()).getName()); + } else if (track instanceof EffectTrack) { + EffectTrack effectTrack = (EffectTrack) track; + super.setName("EffectTrack : " + effectTrack.getEmitter().getName()); + } else if (track instanceof AudioTrack) { + AudioTrack audioTrack = (AudioTrack) track; + super.setName("AudioTrack : " + audioTrack.getAudio().getName()); + + } else { + super.setName(track.getClass().getSimpleName()); + } + } + + + + @Override + public Image getIcon(int type) { + if (track instanceof BoneTrack) { + return iconBoneTrack; + } else if (track instanceof EffectTrack) { + return iconEffectTrack; + } else if (track instanceof AudioTrack) { + return iconAudioTrack; + } + return iconTrack; + + } + + @Override + public Image getOpenedIcon(int type) { + if (track instanceof BoneTrack) { + return iconBoneTrack; + } else if (track instanceof EffectTrack) { + return iconEffectTrack; + } else if (track instanceof AudioTrack) { + return iconAudioTrack; + } + return iconTrack; + } + + public class dum { + + float val; + + public float getVal() { + return val; + } + + public void setVal(float val) { + this.val = val; + } + } + + @Override + protected Sheet createSheet() { + //TODO: multithreading.. + Sheet sheet = super.createSheet(); + Sheet.Set set = Sheet.createPropertiesSet(); + set.setDisplayName("Track"); + set.setName(track.getClass().getSimpleName()); + Track obj = track;//getLookup().lookup(Spatial.class); + if (obj == null) { + return sheet; + } + set.put(makeProperty(obj, float.class, "getLength", "Track length")); + if (track instanceof EffectTrack) { + EffectTrackEmitterProperty prop = new EffectTrackEmitterProperty((EffectTrack) track, control.getSpatial()); + prop.addPropertyChangeListener(this); + set.put(prop); + } + if (track instanceof AudioTrack) { + AudioTrackProperty prop = new AudioTrackProperty((AudioTrack) track, control.getSpatial()); + prop.addPropertyChangeListener(this); + set.put(prop); + } + if (track instanceof EffectTrack || track instanceof AudioTrack) { + try { + // set.put(createSliderProperty(track)); + + SceneExplorerProperty prop = new SceneExplorerProperty(track, float.class, "getStartOffset", "setStartOffset", this) { + + SliderPropertyEditor editor = null; + + @Override + public PropertyEditor getPropertyEditor() { + if (editor == null) { + if (track instanceof EffectTrack) { + editor = new SliderPropertyEditor(0f, ((EffectTrack) track).getLength()); + + } else { + editor = new SliderPropertyEditor(0f, ((AudioTrack) track).getLength()); + + } + } + return editor; + } + }; + set.put(prop); + } catch (NoSuchMethodException ex) { + Exceptions.printStackTrace(ex); + } + + } + + // set.put(makeProperty(obj, boolean.class, "isEnabled", "setEnabled", "Enabled")); + //set.put(makeProperty(obj, boolean.class, "isEnabled", "setEnabled", "Enabled")); +// set.put(makeProperty(obj, ParticleMesh.Type.class, "getMeshType", "setMeshType", "Mesh Type")); +// set.put(makeProperty(obj, EmitterShape.class, "getShape", "setShape", "Emitter Shape")); + sheet.put(set); + return sheet; + + } + + @Override + public Action[] getActions(boolean context) { + + return new Action[]{ + SystemAction.get(DeleteAction.class) + }; + } + + @Override + public boolean canDestroy() { + return !(track instanceof BoneTrack); + } + + @Override + public void destroy() throws IOException { + super.destroy(); + fireSave(true); + final Animation anim = getParentNode().getLookup().lookup(Animation.class); + try { + SceneApplication.getApplication().enqueue(new Callable() { + + public Void call() throws Exception { + anim.removeTrack(track); + return null; + } + }).get(); + ((AbstractSceneExplorerNode) getParentNode()).refresh(true); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + } + + public Class getExplorerObjectClass() { + return Track.class; + } + + @Override + public Class getExplorerNodeClass() { + return JmeTrack.class; + } + + @Override + public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) { + return new org.openide.nodes.Node[]{new JmeTrack((Track) key, control, key2).setReadOnly(cookie)}; + } + + @Override + public void propertyChange(String name, Object before, Object after) { + super.propertyChange(name, before, after); + setName(); + } + + + +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTrackChildren.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTrackChildren.java new file mode 100644 index 000000000..1c540d0db --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTrackChildren.java @@ -0,0 +1,160 @@ +/* + * 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.animation.AnimControl; +import com.jme3.animation.Animation; +import com.jme3.animation.AudioTrack; +import com.jme3.animation.BoneTrack; +import com.jme3.animation.EffectTrack; +import com.jme3.animation.Track; +import com.jme3.gde.core.scene.SceneApplication; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import org.openide.loaders.DataObject; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; + +/** + * + * @author nehon + */ +public class JmeTrackChildren extends Children.Keys { + + protected JmeAnimation jmeAnimation; + protected boolean readOnly = true; + protected HashMap map = new HashMap(); + private DataObject dataObject; + private JmeAnimControl jmeControl; + + public JmeTrackChildren() { + } + + public JmeTrackChildren(JmeAnimation jmeAnimation, JmeAnimControl jmeControl) { + this.jmeAnimation = jmeAnimation; + this.jmeControl = jmeControl; + } + + public void refreshChildren(boolean immediate) { + setKeys(createKeys()); + refresh(); + } + + public void setReadOnly(boolean cookie) { + this.readOnly = cookie; + } + + @Override + protected void addNotify() { + super.addNotify(); + setKeys(createKeys()); + } + + protected List createKeys() { + try { + return SceneApplication.getApplication().enqueue(new Callable>() { + + public List call() throws Exception { + List keys = new LinkedList(); + Animation anim = jmeAnimation.getLookup().lookup(Animation.class); + if (anim != null) { + for (Track track : anim.getTracks()) { + if (track instanceof BoneTrack) { + if (jmeControl.isDisplayBoneTracks()) { + keys.add(track); + } + } else if (track instanceof EffectTrack) { + if (jmeControl.isDisplayEffectTracks()) { + keys.add(track); + } + + } else if (track instanceof AudioTrack) { + if (jmeControl.isDisplayAudioTracks()) { + keys.add(track); + } + } else { + keys.add(track); + } + + } + + } + + return keys; + } + }).get(); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (ExecutionException ex) { + Exceptions.printStackTrace(ex); + } + return null; + } + + @Override + protected Node[] createNodes(Object key) { +// for (SceneExplorerNode di : Lookup.getDefault().lookupAll(SceneExplorerNode.class)) { +// if (di.getExplorerObjectClass().getName().equals(key.getClass().getName())) { +// Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Found {0}", di.getExplorerNodeClass()); +// Node[] ret = di.createNodes(key, dataObject, readOnly); +// if (ret != null) { +// return ret; +// } +// } +// } + + if (key instanceof Track) { + return new Node[]{new JmeTrack((Track) key, jmeControl.getLookup().lookup(AnimControl.class), dataObject).setReadOnly(readOnly)}; + } + return new Node[]{Node.EMPTY}; + } + + public void setAnimation(JmeAnimation jmeAnimation) { + this.jmeAnimation = jmeAnimation; + } + + public void setAnimControl(JmeAnimControl jmeControl) { + this.jmeControl = jmeControl; + } + + public DataObject getDataObject() { + return dataObject; + } + + public void setDataObject(DataObject dataObject) { + this.dataObject = dataObject; + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/TrackVisibilityPopup.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/TrackVisibilityPopup.java new file mode 100644 index 000000000..3f5e40419 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/TrackVisibilityPopup.java @@ -0,0 +1,89 @@ +/* + * 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.actions; + +import com.jme3.gde.core.sceneexplorer.nodes.JmeAnimControl; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import org.openide.loaders.DataObject; +import org.openide.util.actions.Presenter; + +/** + * + * @author normenhansen + */ +public class TrackVisibilityPopup extends AbstractAction implements Presenter.Popup { + + protected JmeAnimControl jmeControl; + + public TrackVisibilityPopup(JmeAnimControl jmeControl) { + this.jmeControl = jmeControl; + } + + public void actionPerformed(ActionEvent e) { + } + + public JMenuItem getPopupPresenter() { + JMenu result = new JMenu("Display..."); + JCheckBoxMenuItem boneTrackItem = new JCheckBoxMenuItem(new AbstractAction("Bone tracks") { + + public void actionPerformed(ActionEvent e) { + jmeControl.setDisplayBoneTracks(((JCheckBoxMenuItem) e.getSource()).isSelected()); + } + }); + boneTrackItem.setSelected(jmeControl.isDisplayBoneTracks()); + result.add(boneTrackItem); + JCheckBoxMenuItem effectTrackItem = new JCheckBoxMenuItem(new AbstractAction("Effect tracks") { + + public void actionPerformed(ActionEvent e) { + jmeControl.setDisplayEffectTracks(((JCheckBoxMenuItem) e.getSource()).isSelected()); + } + }); + effectTrackItem.setSelected(jmeControl.isDisplayEffectTracks()); + result.add(effectTrackItem); + JCheckBoxMenuItem audioTrackItem = new JCheckBoxMenuItem(new AbstractAction("Audio tracks") { + + public void actionPerformed(ActionEvent e) { + jmeControl.setDisplayAudioTracks(((JCheckBoxMenuItem) e.getSource()).isSelected()); + } + }); + audioTrackItem.setSelected(jmeControl.isDisplayAudioTracks()); + result.add(audioTrackItem); + + + return result; + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackVisualPanel1.form b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackVisualPanel1.form new file mode 100644 index 000000000..155f85b51 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackVisualPanel1.form @@ -0,0 +1,183 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackVisualPanel1.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackVisualPanel1.java new file mode 100644 index 000000000..1beb79619 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackVisualPanel1.java @@ -0,0 +1,232 @@ +/* + * 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.actions.impl.tracks; + +import com.jme3.animation.Animation; +import com.jme3.audio.AudioNode; +import com.jme3.gde.core.sceneexplorer.nodes.JmeAnimation; +import com.jme3.scene.Node; +import com.jme3.scene.Spatial; +import java.awt.Component; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; + +public final class AudioTrackVisualPanel1 extends JPanel { + + Spatial rootNode; + JmeAnimation animation; + + /** Creates new form AudioTrackVisualPanel1 */ + public AudioTrackVisualPanel1(Spatial rootNode, JmeAnimation animation) { + this.rootNode = rootNode; + this.animation = animation; + initComponents(); + lengthLabel.setText(animation.getLookup().lookup(Animation.class).getLength() + ""); + DefaultComboBoxModel model = new DefaultComboBoxModel(); + + populateModel(rootNode, model); + + jComboBox1.setModel(model); + jComboBox1.setRenderer(new ListCellRenderer() { + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + return new JLabel(((Spatial)value).getName()); + } + }); + jSlider1.setMaximum((int) (animation.getLookup().lookup(Animation.class).getLength() * 100)); + } + + private void populateModel(Spatial root, DefaultComboBoxModel model) { + if (root instanceof AudioNode) { + model.addElement((AudioNode) root); + } else if (root instanceof Node) { + Node n = (Node) root; + for (Spatial child : n.getChildren()) { + populateModel(child, model); + } + } + } + + @Override + public String getName() { + return "Create a new AudioTrack"; + } + + public AudioNode getAudioNode() { + return (AudioNode) jComboBox1.getSelectedItem(); + } + + public float getStartOffset() { + return (float) jSlider1.getValue() / 100f; + } + + /** 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. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jSeparator1 = new javax.swing.JSeparator(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jComboBox1 = new javax.swing.JComboBox(); + jSlider1 = new javax.swing.JSlider(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + lengthLabel = new javax.swing.JLabel(); + + jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/core/sceneexplorer/nodes/icons/audioTrack.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AudioTrackVisualPanel1.class, "AudioTrackVisualPanel1.jLabel1.text")); // NOI18N + + jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AudioTrackVisualPanel1.class, "AudioTrackVisualPanel1.jLabel2.text")); // NOI18N + + jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(AudioTrackVisualPanel1.class, "AudioTrackVisualPanel1.jLabel3.text")); // NOI18N + jLabel3.setVerticalAlignment(javax.swing.SwingConstants.TOP); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + jSlider1.setValue(0); + jSlider1.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + jSlider1StateChanged(evt); + } + }); + jSlider1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { + public void propertyChange(java.beans.PropertyChangeEvent evt) { + jSlider1PropertyChange(evt); + } + }); + + jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, jSlider1.getValue()+""); + + jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(AudioTrackVisualPanel1.class, "AudioTrackVisualPanel1.jLabel5.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(lengthLabel, org.openide.util.NbBundle.getMessage(AudioTrackVisualPanel1.class, "AudioTrackVisualPanel1.lengthLabel.text")); // NOI18N + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE) + .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(lengthLabel, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.LEADING, 0, 157, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE) + .addComponent(jSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(lengthLabel)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(14, 14, 14) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel4) + .addContainerGap(27, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + }// //GEN-END:initComponents + +private void jSlider1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jSlider1PropertyChange +}//GEN-LAST:event_jSlider1PropertyChange + +private void jSlider1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSlider1StateChanged + jLabel4.setText(((float) jSlider1.getValue() / 100f) + ""); +}//GEN-LAST:event_jSlider1StateChanged + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox jComboBox1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JPanel jPanel1; + private javax.swing.JSeparator jSeparator1; + private javax.swing.JSlider jSlider1; + private javax.swing.JLabel lengthLabel; + // End of variables declaration//GEN-END:variables +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackWizardAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackWizardAction.java new file mode 100644 index 000000000..6aa635678 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackWizardAction.java @@ -0,0 +1,119 @@ +/* + * 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.actions.impl.tracks; + +import com.jme3.animation.Animation; +import com.jme3.animation.AudioTrack; +import com.jme3.audio.AudioNode; +import com.jme3.gde.core.sceneexplorer.nodes.JmeAnimation; +import com.jme3.scene.Spatial; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.MessageFormat; +import javax.swing.JComponent; +import org.openide.DialogDisplayer; +import org.openide.WizardDescriptor; + +// An example action demonstrating how the wizard could be called from within +// your code. You can move the code below wherever you need, or register an action: +// @ActionID(category="...", id="com.jme3.gde.core.sceneexplorer.nodes.actions.impl.tracks.EffectTrackWizardAction") +// @ActionRegistration(displayName="Open EffectTrack Wizard") +// @ActionReference(path="Menu/Tools", position=...) +public final class AudioTrackWizardAction implements ActionListener { + + private WizardDescriptor.Panel[] panels; + Spatial rootNode; + JmeAnimation animation; + + public AudioTrackWizardAction(Spatial rootNode, JmeAnimation animation) { + this.rootNode = rootNode; + this.animation = animation; + } + + public @Override + void actionPerformed(ActionEvent e) { + WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels()); + // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName() + wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); + wizardDescriptor.setTitle("Create a new AudioTrack"); + Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); + dialog.setVisible(true); + dialog.toFront(); + boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; + if (!cancelled) { + AudioNode audio = (AudioNode) wizardDescriptor.getProperty("Audio"); + float startOffset = (Float) wizardDescriptor.getProperty("startOffset"); + Animation anim = animation.getLookup().lookup(Animation.class); + anim.addTrack(new AudioTrack(audio, anim.getLength(), startOffset)); + + animation.refresh(false); + animation.setChanged(); + } + } + + /** + * Initialize panels representing individual wizard's steps and sets + * various properties for them influencing wizard appearance. + */ + private WizardDescriptor.Panel[] getPanels() { + if (panels == null) { + panels = new WizardDescriptor.Panel[]{ + new AudioTrackWizardPanel1(rootNode, animation) + }; + String[] steps = new String[panels.length]; + for (int i = 0; i < panels.length; i++) { + Component c = panels[i].getComponent(); + // Default step name to component name of panel. Mainly useful + // for getting the name of the target chooser to appear in the + // list of steps. + steps[i] = c.getName(); + if (c instanceof JComponent) { // assume Swing components + JComponent jc = (JComponent) c; + // Sets step number of a component + // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*: + jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); + // Sets steps names for a panel + jc.putClientProperty("WizardPanel_contentData", steps); + // Turn on subtitle creation on each step + jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); + // Show steps on the left side with the image on the background + jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE); + // Turn on numbering of all steps + jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE); + } + } + } + return panels; + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackWizardPanel1.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackWizardPanel1.java new file mode 100644 index 000000000..48622e637 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/AudioTrackWizardPanel1.java @@ -0,0 +1,126 @@ +/* + * 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.actions.impl.tracks; + +import com.jme3.gde.core.sceneexplorer.nodes.JmeAnimation; +import com.jme3.scene.Spatial; +import java.awt.Component; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; + +public class AudioTrackWizardPanel1 implements WizardDescriptor.Panel { + + Spatial rootNode; + JmeAnimation animation; + + public AudioTrackWizardPanel1(Spatial rootNode, JmeAnimation animation) { + this.rootNode = rootNode; + this.animation = animation; + } + /** + * The visual component that displays this panel. If you need to access the + * component from this class, just use getComponent(). + */ + private Component component; + + // Get the visual component for the panel. In this template, the component + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + public Component getComponent() { + if (component == null) { + component = new AudioTrackVisualPanel1(rootNode, animation); + } + return component; + } + + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + // If you have context help: + // return new HelpCtx(SampleWizardPanel1.class); + } + + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + // If it depends on some condition (form filled out...), then: + // return someCondition(); + // and when this condition changes (last form field filled in...) then: + // fireChangeEvent(); + // and uncomment the complicated stuff below. + } + + public final void addChangeListener(ChangeListener l) { + } + + public final void removeChangeListener(ChangeListener l) { + } + /* + private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0 + public final void addChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.add(l); + } + } + public final void removeChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.remove(l); + } + } + protected final void fireChangeEvent() { + Iterator it; + synchronized (listeners) { + it = new HashSet(listeners).iterator(); + } + ChangeEvent ev = new ChangeEvent(this); + while (it.hasNext()) { + it.next().stateChanged(ev); + } + } + */ + + // You can use a settings object to keep track of state. Normally the + // settings object will be the WizardDescriptor, so you can use + // WizardDescriptor.getProperty & putProperty to store information entered + // by the user. + public void readSettings(Object settings) { + } + + public void storeSettings(Object settings) { + WizardDescriptor wiz = (WizardDescriptor) settings; + AudioTrackVisualPanel1 comp = (AudioTrackVisualPanel1) getComponent(); + wiz.putProperty("Audio", comp.getAudioNode()); + wiz.putProperty("startOffset", comp.getStartOffset()); + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/Bundle.properties b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/Bundle.properties new file mode 100644 index 000000000..ba53be97f --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/Bundle.properties @@ -0,0 +1,11 @@ +Error reading included file Templates/Other/../Licenses/license-jme.txt +EffectTrackVisualPanel1.jLabel1.text=Effect Track +EffectTrackVisualPanel1.jLabel2.text=Particle emitter +EffectTrackVisualPanel1.jLabel3.text=Start offset +EffectTrackVisualPanel1.jLabel5.text=Length +EffectTrackVisualPanel1.lengthLabel.text=jLabel6 +AudioTrackVisualPanel1.jLabel1.text=Audio Track +AudioTrackVisualPanel1.jLabel5.text=Length +AudioTrackVisualPanel1.jLabel2.text=Audio node +AudioTrackVisualPanel1.jLabel3.text=Start offset +AudioTrackVisualPanel1.lengthLabel.text=jLabel6 diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.form b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.form new file mode 100644 index 000000000..84dabe533 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.form @@ -0,0 +1,183 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.java new file mode 100644 index 000000000..075df46d2 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.java @@ -0,0 +1,231 @@ +/* + * 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.actions.impl.tracks; + +import com.jme3.animation.Animation; +import com.jme3.effect.ParticleEmitter; +import com.jme3.gde.core.sceneexplorer.nodes.JmeAnimation; +import com.jme3.scene.Node; +import com.jme3.scene.Spatial; +import java.awt.Component; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; + +public final class EffectTrackVisualPanel1 extends JPanel { + + Spatial rootNode; + JmeAnimation animation; + + /** Creates new form EffectTrackVisualPanel1 */ + public EffectTrackVisualPanel1(Spatial rootNode, JmeAnimation animation) { + this.rootNode = rootNode; + this.animation = animation; + initComponents(); + lengthLabel.setText(animation.getLookup().lookup(Animation.class).getLength() + ""); + DefaultComboBoxModel model = new DefaultComboBoxModel(); + + populateModel(rootNode, model); + jComboBox1.setModel(model); + jComboBox1.setRenderer(new ListCellRenderer() { + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + return new JLabel(((Spatial) value).getName()); + } + }); + jSlider1.setMaximum((int) (animation.getLookup().lookup(Animation.class).getLength() * 100)); + } + + private void populateModel(Spatial root, DefaultComboBoxModel model) { + if (root instanceof Node) { + Node n = (Node) root; + for (Spatial child : n.getChildren()) { + populateModel(child, model); + } + } else if (root instanceof ParticleEmitter) { + model.addElement((ParticleEmitter) root); + } + } + + @Override + public String getName() { + return "Create a new EffectTrack"; + } + + public ParticleEmitter getEmitter() { + return (ParticleEmitter) jComboBox1.getSelectedItem(); + } + + public float getStartOffset() { + return (float) jSlider1.getValue() / 100f; + } + + /** 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. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jSeparator1 = new javax.swing.JSeparator(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jComboBox1 = new javax.swing.JComboBox(); + jSlider1 = new javax.swing.JSlider(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + lengthLabel = new javax.swing.JLabel(); + + jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/core/sceneexplorer/nodes/icons/effectTrack.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(EffectTrackVisualPanel1.class, "EffectTrackVisualPanel1.jLabel1.text")); // NOI18N + + jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(EffectTrackVisualPanel1.class, "EffectTrackVisualPanel1.jLabel2.text")); // NOI18N + + jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(EffectTrackVisualPanel1.class, "EffectTrackVisualPanel1.jLabel3.text")); // NOI18N + jLabel3.setVerticalAlignment(javax.swing.SwingConstants.TOP); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + jSlider1.setValue(0); + jSlider1.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + jSlider1StateChanged(evt); + } + }); + jSlider1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { + public void propertyChange(java.beans.PropertyChangeEvent evt) { + jSlider1PropertyChange(evt); + } + }); + + jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, jSlider1.getValue()+""); + + jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(EffectTrackVisualPanel1.class, "EffectTrackVisualPanel1.jLabel5.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(lengthLabel, org.openide.util.NbBundle.getMessage(EffectTrackVisualPanel1.class, "EffectTrackVisualPanel1.lengthLabel.text")); // NOI18N + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE) + .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(lengthLabel, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.LEADING, 0, 157, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE) + .addComponent(jSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(lengthLabel)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(14, 14, 14) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel4) + .addContainerGap(27, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + }// //GEN-END:initComponents + +private void jSlider1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jSlider1PropertyChange +}//GEN-LAST:event_jSlider1PropertyChange + +private void jSlider1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSlider1StateChanged + jLabel4.setText(((float) jSlider1.getValue() / 100f) + ""); +}//GEN-LAST:event_jSlider1StateChanged + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox jComboBox1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JPanel jPanel1; + private javax.swing.JSeparator jSeparator1; + private javax.swing.JSlider jSlider1; + private javax.swing.JLabel lengthLabel; + // End of variables declaration//GEN-END:variables +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackWizardAction.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackWizardAction.java new file mode 100644 index 000000000..42c4c6b9e --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackWizardAction.java @@ -0,0 +1,119 @@ +/* + * 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.actions.impl.tracks; + +import com.jme3.animation.Animation; +import com.jme3.animation.EffectTrack; +import com.jme3.effect.ParticleEmitter; +import com.jme3.gde.core.sceneexplorer.nodes.JmeAnimation; +import com.jme3.scene.Spatial; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.MessageFormat; +import javax.swing.JComponent; +import org.openide.DialogDisplayer; +import org.openide.WizardDescriptor; + +// An example action demonstrating how the wizard could be called from within +// your code. You can move the code below wherever you need, or register an action: +// @ActionID(category="...", id="com.jme3.gde.core.sceneexplorer.nodes.actions.impl.tracks.EffectTrackWizardAction") +// @ActionRegistration(displayName="Open EffectTrack Wizard") +// @ActionReference(path="Menu/Tools", position=...) +public final class EffectTrackWizardAction implements ActionListener { + + private WizardDescriptor.Panel[] panels; + Spatial rootNode; + JmeAnimation animation; + + public EffectTrackWizardAction(Spatial rootNode, JmeAnimation animation) { + this.rootNode = rootNode; + this.animation = animation; + } + + public @Override + void actionPerformed(ActionEvent e) { + WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels()); + // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName() + wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); + wizardDescriptor.setTitle("Create a new EffectTrack"); + Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); + dialog.setVisible(true); + dialog.toFront(); + boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION; + if (!cancelled) { + ParticleEmitter emitter = (ParticleEmitter) wizardDescriptor.getProperty("Emitter"); + float startOffset = (Float) wizardDescriptor.getProperty("startOffset"); + Animation anim = animation.getLookup().lookup(Animation.class); + anim.addTrack(new EffectTrack(emitter, anim.getLength(), startOffset)); + + animation.refresh(false); + animation.setChanged(); + } + } + + /** + * Initialize panels representing individual wizard's steps and sets + * various properties for them influencing wizard appearance. + */ + private WizardDescriptor.Panel[] getPanels() { + if (panels == null) { + panels = new WizardDescriptor.Panel[]{ + new EffectTrackWizardPanel1(rootNode, animation) + }; + String[] steps = new String[panels.length]; + for (int i = 0; i < panels.length; i++) { + Component c = panels[i].getComponent(); + // Default step name to component name of panel. Mainly useful + // for getting the name of the target chooser to appear in the + // list of steps. + steps[i] = c.getName(); + if (c instanceof JComponent) { // assume Swing components + JComponent jc = (JComponent) c; + // Sets step number of a component + // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*: + jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); + // Sets steps names for a panel + jc.putClientProperty("WizardPanel_contentData", steps); + // Turn on subtitle creation on each step + jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); + // Show steps on the left side with the image on the background + jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE); + // Turn on numbering of all steps + jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE); + } + } + } + return panels; + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackWizardPanel1.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackWizardPanel1.java new file mode 100644 index 000000000..967b30a37 --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackWizardPanel1.java @@ -0,0 +1,126 @@ +/* + * 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.actions.impl.tracks; + +import com.jme3.gde.core.sceneexplorer.nodes.JmeAnimation; +import com.jme3.scene.Spatial; +import java.awt.Component; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; + +public class EffectTrackWizardPanel1 implements WizardDescriptor.Panel { + + Spatial rootNode; + JmeAnimation animation; + + public EffectTrackWizardPanel1(Spatial rootNode, JmeAnimation animation) { + this.rootNode = rootNode; + this.animation = animation; + } + /** + * The visual component that displays this panel. If you need to access the + * component from this class, just use getComponent(). + */ + private Component component; + + // Get the visual component for the panel. In this template, the component + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + public Component getComponent() { + if (component == null) { + component = new EffectTrackVisualPanel1(rootNode, animation); + } + return component; + } + + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + // If you have context help: + // return new HelpCtx(SampleWizardPanel1.class); + } + + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + // If it depends on some condition (form filled out...), then: + // return someCondition(); + // and when this condition changes (last form field filled in...) then: + // fireChangeEvent(); + // and uncomment the complicated stuff below. + } + + public final void addChangeListener(ChangeListener l) { + } + + public final void removeChangeListener(ChangeListener l) { + } + /* + private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0 + public final void addChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.add(l); + } + } + public final void removeChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.remove(l); + } + } + protected final void fireChangeEvent() { + Iterator it; + synchronized (listeners) { + it = new HashSet(listeners).iterator(); + } + ChangeEvent ev = new ChangeEvent(this); + while (it.hasNext()) { + it.next().stateChanged(ev); + } + } + */ + + // You can use a settings object to keep track of state. Normally the + // settings object will be the WizardDescriptor, so you can use + // WizardDescriptor.getProperty & putProperty to store information entered + // by the user. + public void readSettings(Object settings) { + } + + public void storeSettings(Object settings) { + WizardDescriptor wiz = (WizardDescriptor) settings; + EffectTrackVisualPanel1 comp = (EffectTrackVisualPanel1) getComponent(); + wiz.putProperty("Emitter", comp.getEmitter()); + wiz.putProperty("startOffset", comp.getStartOffset()); + } +} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/anim.png b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/anim.png new file mode 100644 index 0000000000000000000000000000000000000000..f5e16d777169757ded89f130270f96307a51c865 GIT binary patch literal 850 zcmV-Y1FigtP)6DMO`5a;zAQc;$v;xxX>6E#(%-BE8{{oZj526?u;?fXkwzqSCnU~wt}>@ zJj%VLy|0;ZijRel6_cD~CTHg4o8S2ka?W8ZOMV8={+S>Qpm_xWTnZc&jiFZ~j02+5 z+NOd=H@V~m5oK-f zVE;Z-S?sk8-qsrGyja&3VonXH#8oL0YyoN`tE^RW*~!^q*+cI)1L}I!_O|w<9J88r zSD%$C!6QsJVtx{WVy<#`-B^4SY+Bn-2ug0<%gX?U{EI$g6ewe&&m5d8R1L$f2YkBf z)sWhbL%X|^hu^(6uB{ZzaiS3LD-3)p7YtNk8VUW8NVKQ5r7b}uk}{Xw6P2QKOw{e; z46V#m?y?Q*N;y_u>S5G)+Ou(E&BriB+&d|x| z?wuo=@AWOHZNDP>)M148w>`4@Y11{0;0*>?$qN9$mc(8WVF;XG8pX5iD`iirCG2JB z{5)Nt+6!Z$kb#KEsSRu*JRBVz{c{TN*E|u0D?|q3)rBS>*TvZcS7oG*Wd3mej c{9S+n0H6g=eDt-faR2}S07*qoM6N<$f-{SXg8%>k literal 0 HcmV?d00001 diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/animPlay.png b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/animPlay.png new file mode 100644 index 0000000000000000000000000000000000000000..787e5c41a3d2784f8298773f58c67c290181b0fb GIT binary patch literal 665 zcmV;K0%rY*P) zYJIfz+A1PQU5Iv3qk^EQh~QeOB5qxF?O$-wjcXUa7J{}yOE*%BV!+teRBH3?g(mls zf=~S4W4IfG;Z_=COM>xC z_1!o7%^-jJ`q60-iCoX4jCp~LAo8)7t1UaQ#uH_wHJ2CW4ZA$qx+kiKdH}lhqs4T} zLLUpyi|hjhbO0RJ_%!yd(P%mm+2574Wjasha<|Tju|$Po{DdJF=Fyh|W zG2zNZ?ap7*ZGeTz`|NhZl>0)-pU$#~`!yjg#E{{Y3f$tlvskXL8`f5r;qyjqc14#Y z!EH9Kp7os2nr_r`?ySybfGg5~s`4HX@G?nGjXmvnKnR#N&ensJ$h}-LZcdC^!RtD= z#sOi3T^o*%>v$FLEY2T{2r+Jl1(3Ej6xy`NNnvn4W2Fvw$cy+cw$#m$`29=$Q$4{k zz~&pA1|SpfVYKWRcpd@^r0P=>;(AQJ|{IfFxzV&-i;ES763*?1`b< zC-@unAa4haKY(ryNRX6>Y~&UmoH@1c@cF8l2eBZ`WI_o-j1tOdTL^^^?s$NlVFPt_ z>EQ)U8`5mcmq^OQ)l#Ww>Mo^y+hHRqxuG!PIIgqSf?l6_v2geDxOQZ?-BL<1#*`Ak zVAE>)zNacNMNtq!-5lDKzH1Az@-N@}mjD9*R+BPnUV9Qt00000NkvXXu0mjf_XIqi literal 0 HcmV?d00001 diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/animationcontrol.gif b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/animationcontrol.gif index 228cfe3ecf6a450fb9a523282c7f58f054b70eff..cdb0acf4e445e8ab75424f4cffbd7f87bf7d3d6b 100644 GIT binary patch literal 572 zcmZ?wbhEHb6krfwc$UJz(C)`DKPzc%J41&*LxcO5pWhkUd>Q7XO+U7dq0E}0JBVRv z0mGu)ci%oSOo?S^@n)D5&CnTej9XrY}Eq=$%6A3Gut*4|_Y@Nzb>on=un(HqgFiePCcWM9C7x$(eTg%WL z%rG;Vp~ANR$V$B>#Y->jo^gEL*Pq|rmQ`i0@1A~q-Rm#!879Xv%uW%mbz@kV&9Joa z`KLDwRSpbYK@7Fdo30)XURL}6|9=K*1I3>#j0_AZ3_2i#L2<&sKC>aEskx=KEyP1e z->9us&xAXcJEFIVRWydjnkQ&#iZZ(v<6;@ssZxGX?t$!fPQ6Kdj`lhMmKLGC$({ll za&df-0;a99Tw-cA5)Ova;!Le!41!#WOiZf234-3ux-91WYz)j#8QAz;n>F36SbR9b ugE>?rS>zQ`ctyLHf2p_^B;NUp~r+kOU0A#2Dh?2!;Q8|DX(AZ}q8M0V`Ndna9c9owOgXRcQ R3S1Sk@@u_P@c1JF06QZeN74WQ diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/audioTrack.png b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/audioTrack.png new file mode 100644 index 0000000000000000000000000000000000000000..cbeb6f3999354c8c5996ec9dc663e8beb61c12c3 GIT binary patch literal 794 zcmV+#1LgdQP)gjQ)!`8+Jcp@ zLO@MX6Mjl1nuw8wAue#?LKCAaOL|j0Gg$WuIiGrel z#1cwN|F3V}d)`;&SvGFG$(=KI=H7Gf%$?yhO~e0)s1J8W+gdy(f0s$)Ihj+nG1-2( zx$efTRL2Kn7l+(@yna?Se>~>7UB0%?>qD*R>&nY6y zxk^wXYHr09A&7GQ&-2x|_#!>!$JPOdL5u7NAJ0y^sU-Qm`o27#)o z*dRt|;v_40Gifw%P!$E576UYY5_Mab z3T3&=<+8(>MO#{wh9ESkaM&4QQ9E}1Sm_kkDga`XLC3gJL4tU_-Y~bcG=-`PHwDY& zyo&L6Ux`pn`tj#4wL_tao;eZo;_ZviSRS85?`dH6NuS`^e~**m0oq?p27^$F2cfSw z9O@HzM&-(kLogV_#H$7DX*vN@T9~T&+XX$7s)k4dq!FXSDc+p588IL9Ob^IsTLlfVoD#@OS^lO?6%`-%3B=S;YABm`NG+P-P?`)4eevv{>%WJ>SUc?}&CV>60uJ%ZZ%XH1*B)H5V5Ij?fk?8O&xiJl$-(bH2TTq0KcekyTD qoH4oY(ZM}S>{ypMHZ3r4lx*tQsWDN?n}_qNfs58pR7brx$dz7qqw+G^rOb QpHE=^RM6*JNRCwB?Q_W8kQ4s%a?b0o6A+*|3 z(gLPmpg={e(ZtlyM2-;Sh2Tv+av-r9G#oI&s8HbG!I%&=Q6eYfKfs9tksueLl#8E; zK)Y-Z`o*?gcb;iezfMjvZ+71N<~K9%z2y`|!T*SsmP->a!)JMERM3FS6rjw@H8)>f z?~9ZJuZ=&O_3M(M_c?uZa^TAG;=YEKGg@)s3r?t}k^5m4j3h0o^&S@L_wU)(E=P$(3T z%jJ+vCYdFl*5z^`6I&b1j!lcKgF-%!gM$O4QYpx?%zTmn zw>^5qQUgJ!WBciJn&B!cc-Rh`(ZR(ZXt%buSVaPm5GW8hg}WmouPb;SJ3A6~cfZ5m z){4AJO!4SyjOCDOmzS53S3iiE08~8~48mfu^sGjs-*kcyS&6QWQzFGlX_VWy203ytlWpm4*N2srXn#gc+TY)2-4QwY zrI)DDXsT^CD;n$TalW$?i;IhRyR?K0U0sY+uNP2Rsb|TOB*APpBVE>kc4K4XWMe}E zx_f%q#+&(hxZG|mEG+!-?se*QQv2l{XdDj5yN{nf*Pf002ovPDHLkV1h=fYIgtt literal 0 HcmV?d00001 diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/charactercontrol.gif b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/charactercontrol.gif index 44752ae55eaabf075b9dc09f55066ff0052884a7..04e00ec5de1361de076685d4da03268ba82e94aa 100644 GIT binary patch literal 561 zcmZ?wbhEHb6krfwcoxH8>oC{Ibn55NKW*&iM#pclw3+qx?brJc-kV#^j7!>XZ8s+( zW>aFyj?l>UJ9gf7^;{B{xGgnn&w@qguHSg&=Cx$oj+-Xt)6A`Be){yYrFFl9^MV&I zKi|IdHavRcgNN_avi4rM_>cNsSGuavT*aY=$rG(M$c%n<@0WqjxzNK3+Qc95OLG3doSOcdEfi?&8$Qz#s4fTcl(2%y4nk(GbIvnDpZcV z*30{2Lya$T57q|f$65+v<6qMyfraZWH_W_+yEbch=2)fEdA7+59vPm@Ev^Z?AL}gM z9zS}>jT1I?h~qp0o1r`F+!bi3C`Ii-7su7+0Z-sve|uqUyyN&0wAELEM~>b1<}YOl z48uU&kg=X5B67@^ePXez$+9(hvc3k6vQliQ1opBLG#>V#S&mHe{R{yiP;>*E8bLBm z1s0!%wMQI|K=xLbKU%pu%Zm`wy+A0)Bw73sG4#6|kr&;XnAi6^7Jw z3akes(Xsq-0mPuA8}5~| zGkCr>A&SpTyG7@|#oo*WM|-KMFvjGEwKTRnqO4B^>@r@-oO zf%g?!LD?MA$y^0&y*Yg+KG>0?z_$*Lm-=Se(1P&VWnpziX~=8epvgrmCV?cbi+x5z zv~#uf!-!|CV*Hqt}?$?fgQ%sc@< e9A@sX00RJkJY2F$+%@q40000-T+inM>=||3cyq5o$^n3<+7nGKsh@lbQz- z(Pd%?Ns|$g@Zz#aTqg0fr)vEb&ck^*IVb1jw6rxV-gZ5D{su_kO6I}4;bhgpik*2Y zOEyMKjFmGX5Vpao$fZPmlsknp4>t;)#Tg4h101>k$WXP893C}6-98P6Tq|5ic-Qcq zpsWm)LDYF5^HqRb<%__SnK>&TjdA0~=L(R%-{oiu@LtwJ<5LBQkA?OWSJ>LZ$q2u~u)c_-rj`2}DpF8t j!^>5=R7+Z;iOT!smn}kxTi-G6pF1@8bh&1KfsX1&T3c-T literal 118 zcmZ?wbhEHb6krfwSi}GV|NsAI@cYm3-{!v)m<<+G{K>+|z`)9&1LA?yGB8_5?7G8e zaLjy_?1skdMus!T5)Wib0PN8#g8%>k diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/ghostcontrol.gif b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/ghostcontrol.gif index 28305f93f015335f0e9c29b247dd6dab9d36b935..a8e3b99cd64aed27c4a926095f29f22e24c2a7cc 100644 GIT binary patch literal 581 zcmZ?wbhEHb6krfwc$UHto3Pc!ey+LIOgqPU4lWBEoaZ~cElNt==@+=l#(vJWZMSaR zeBIe~$kJw3TGrm=^xZ!GE5f5Ux_d9Z|KNQ}#_oXN)%A@>np+Pywj8KyIP(4b?=9PI zR#xv?yYA|PhwtajJNx+Q$M~e}J-tV6-g@KdyR52acSqNegybCw$=j{%=J*G#j*MA5 zYxbGou$5iihin|?o;>wr@4maP9*bQ(7JK?Ei;CNP=*WZp2kw9R^yA~FAInx=T)*+^ z;iC`s?7g#L<8?Q$C6!gX0z=oXT65XSZDCu-p@)w?9hQyN{eY{Wvy$-T(jp8K?~uf3h$#Fr+Z(fD8u32?P70hLon} zme#fuPhmM>srDvwF%dp@J`qW-fRtF?fo5q@Ee-*@W_f2LA=@TH32hT0+2&AY z7B=1RW%JD83z_t<`RKJ4;MLhu`tH5cpO;jDB_$XVIb&mk)v7GvLo}3 JhlT)yH2~s}hssJU^LOTBzgX@VUC%)z;~&t<%TI z;+>z&W@xW2F_QoP{{R30A^8LW000gEEC2ui01yBW000D4(8)=wbw+7%}3)NyW2uhHI&{U$x9f(>AP!vdt Wwi3a373KjzAqF798QSlY2mm{Nm_m*K diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/ghostnode.gif b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/ghostnode.gif index 0504b5c6466bff6bc06e6954faf08c973f697213..b98113936638f6a48da1994b7dc1739e10cc0ad2 100644 GIT binary patch literal 323 zcmZ?wbhEHb6krfwxT?tj1oP(2+r4{teSQ6+MT@p>-FoKCnRV;d<>%*LxpHO0h7D7v zPMtPw+No2gii?Y*qM{ZoSaACE>5CUHmX(!xdV1ctapUIAo6*tHiHV7e7cXvYZ9R18 z(ER!H-@kvqWy_Xj%a#QN1+}%cd3$@ixw*y1$45p+e)#aAq@-lx#EJj^{|8x58BqMm z!pOj&$)E!=2IMCOwuA#y3M_goK%I@Tt=#PV&i_oa-}p Qa$>}S#Y>iYJ2F@U0Jq+8cK`qY literal 90 zcmZ?wbhEHb6krfwn8?6zKZTKjf#LuE|3FglCkv3n#GnIY17!t(Z0#xiOcTUUgm7Ou pqBd_@*4g616U zx8HmMPllX;P7>UA#3j4fA8qBpnu|t@85sN#I1L5USMNC*V%nhc=RScqseJm zd(Ew8TH4GCjoc6zvev+OvVYL(ZQF0PcOKik^~SC}x9y$g-M#lNB4*Qrhwm$^cf}@d zOHSKqW-%iW@0|gFL0Hs=Mp2+sn&LL z@(Q-B-*El%mCKpg8-qgECZ}#nPTLh3v)0RZd34;C?%rd?rQ6S*dp2#x*_8C%x9{Bk z_U%__ zZfR}dW>FVp)npZEYhp9t^X8J~GW7Co^Jixcan{q}V>W5y(Qs2{;SJDcH}-60Wif!pOkD&7cDk1DV0VVq0+1Q`^^KdBW0P584YtGq}VwR9YB>mTIUf2xxbt nT-m;oXG!OKV~-_vtPP(8mNXQ}F4xhT6C{3qb(wT81A{dH8#FU- diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/skeletonControl.gif b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/skeletonControl.gif index 13080d0a3bb9c10abdbade143e7151b0421b31f3..530fb9b5104cdd1d3aafa8cec41a22e9e9197c1e 100644 GIT binary patch literal 598 zcmV-c0;&B+Nk%w1VGsZi0Oo%H{{H>|b~yl)T>zYB0FYS#enbF$Ljay=0H0w1f=Jlv z;Q*g$0HJIEbvFQmN%r~o_WJh#fJ6YIZ2*y3T&{p!tbhQBPTuY1#oy9!se=HLRREb_ z@b~kX$*`Nqu``ro1f5|3nPU@^UI3b8!rjjRic%trRuGU{0GwlLtcl0q)WF=$Xs?O@ zpJI5nmwvjN&g0hrj8p)dW!mfGSgV3@v5*RqT%O6YxY@|5&$$4WUlWE-;_v7Hgh^1J zb`NlQvixg1Dsy~k5)91V8q|i z0FY7ul3VWf@P{Qmujz@q?-PmjT;j>M_{ z|NqM4)&PJ<dMkY3W~+yHw&m&&luzsHofQ53k-Tw5)2C{VuVjn zBLfFSJaGpD8y$ozURxnDIB$4hYF#9ReoF#6No#v{kb-PBQD_2J0yJ993UDF>69h<2 zEK=AnCoxJT7A}N&b$mfoGgxItRXrb^e;7hz2@WcKKpZ59V1mn_EN6xoD3Hd(jsgbm kI0-WdK!zd>0%+9O;71NaFutT{z;Q|NVRX;pO=!Hlch36EDH5u2`S|@y$)<@s#TM%>?LYnKnn7<&_OklC^}T=o{Y_Zj#8P6Z z)8ha5{mVml&!??wyY%eNy|+&%>|3bc6CJ&z?(E|m|Ns9FUQq5gxA?--TM5e=fLw+_ z3>1H|FfuTBGw6Wa2#OO1_Pz%1rskH`R%LcuR#p{uwl;5G8xF>)j2t3P{mt5p4D$_S z<})x0wwTPDZ>PGL*{FqUC4;&lKZ}(YSBvK+1_{myO=8xI=WFR4bafFr%Al)sP?SY+ zElZ1nG!KuNgQ?VfW;O0+y-f$4AMjZ=vu@ImmwX@~-pp;z^yB9bW6d^MIr|BFESi#? OCL}cXIB>BrSOWmFakwx5 diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/track.png b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/icons/track.png new file mode 100644 index 0000000000000000000000000000000000000000..54b258334dfd7710d932b96e4bfaa6c9c3a1675c GIT binary patch literal 582 zcmV-M0=fN(P)SAg|Egq8utE&(POsEA_^qxuh6ljLnZt_uFC%D{6Dd zNaOLhGyCngv%A7-wW7zEh|kAv_gGc6>qH`<`@TQ4?Qyene*Sf{u;0JvD5`3BuKTIo zZoLl2pWve?%5}L^(vMyo5+cKwo0EIJe&^}Vj`6%wAx82FI7UDu=*41zve_&Z3VGmC zSkUeDnwq8=je4DGwF5!~W~xskf*=TJxm=RtI6MNw4CBLbDkWd;?eCGQDm;%^tyW2v z(_fJ1JqUcC=JPpCr&C%i797K*RO%*^(IqLFdC07*`; zR=}b+9GYZVV>)cqi8Yv$eEa@`*T6Y}&wii)9%9(p+c!nt#Qwz!6F~sSR^Gom6QW}b z)&y8x6vaqEXuzK5@qCD5_W(((fF8)Q%<-lHBZr6uHuHZ8*ks7EZJR>eYPF*)3Ot!i zc#R}U9LES;#)#x-G$KI|D4);86kyD + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/util/SliderPanel.java b/sdk/jme3-core/src/com/jme3/gde/core/util/SliderPanel.java new file mode 100644 index 000000000..7a580a82d --- /dev/null +++ b/sdk/jme3-core/src/com/jme3/gde/core/util/SliderPanel.java @@ -0,0 +1,156 @@ + +/* + * SliderPanel.java + * + * Created on 4 août 2012, 00:25:41 + */ +package com.jme3.gde.core.util; + +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; + +/** + * + * @author Nehon + */ +public class SliderPanel extends javax.swing.JPanel { + + protected boolean floatValue = false; + + /** Creates new form SliderPanel */ + public SliderPanel() { + initComponents(); + } + + public void setRangeInt(int min, int max) { + jSlider1.setMaximum(max); + jSlider1.setMinimum(min); + floatValue = false; + } + + public void setRangeFloat(float min, float max) { + jSlider1.setMaximum((int) (max * 100f)); + jSlider1.setMinimum((int) (min * 100f)); + floatValue = true; + } + + public void setFloatValue(float value) { + jSlider1.setValue((int) (value * 100f)); + } + + public void setIntValue(int value) { + jSlider1.setValue(value); + } + + public float getFloatValue() { + return (float) jSlider1.getValue() / 100f; + + } + + public int getIntValue() { + return jSlider1.getValue(); + } + + public void setAsText(String s) { + try { + if (floatValue) { + jSlider1.setValue((int) (Float.parseFloat(s) * 100f)); + } else { + jSlider1.setValue(Integer.parseInt(s)); + } + } catch (NumberFormatException e) { + jSlider1.setValue(0); + } + } + + public void addActionListener(ActionListener al) { + jTextField1.addActionListener(al); + } + + public void removeActionListener(ActionListener al) { + jTextField1.removeActionListener(al); + } + + /** 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() { + + jSlider1 = new javax.swing.JSlider(); + jTextField1 = new javax.swing.JTextField(); + + jSlider1.setValue(0); + jSlider1.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + jSlider1StateChanged(evt); + } + }); + + jTextField1.setText(org.openide.util.NbBundle.getMessage(SliderPanel.class, "SliderPanel.jTextField1.text")); // NOI18N + jTextField1.setMaximumSize(new java.awt.Dimension(6, 20)); + jTextField1.setPreferredSize(new java.awt.Dimension(6, 20)); + jTextField1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jTextField1ActionPerformed(evt); + } + }); + jTextField1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { + public void propertyChange(java.beans.PropertyChangeEvent evt) { + jTextField1PropertyChange(evt); + } + }); + jTextField1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + jTextField1KeyPressed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jSlider1, 0, 0, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + +private void jSlider1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSlider1StateChanged + if (floatValue) { + jTextField1.setText(((float) jSlider1.getValue() / 100f) + ""); + } else { + jTextField1.setText(jSlider1.getValue() + ""); + } + +}//GEN-LAST:event_jSlider1StateChanged + +private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed +// TODO add your handling code here: +}//GEN-LAST:event_jTextField1ActionPerformed + +private void jTextField1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTextField1PropertyChange + setAsText(jTextField1.getText()); +}//GEN-LAST:event_jTextField1PropertyChange + +private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyPressed + if (evt.getKeyCode() == KeyEvent.VK_ENTER){ + setAsText(jTextField1.getText()); + jTextField1.setActionCommand("success"); + } +}//GEN-LAST:event_jTextField1KeyPressed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JSlider jSlider1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables +}