SDK : scene composer has now an effect section in the utilities frame with a button to make all emitters under the selected node to emit their particles.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7956 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 6c24af2831
commit 6dcf5f2d50
  1. 5
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/Bundle.properties
  2. 52
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.form
  3. 71
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java

@ -35,7 +35,6 @@ SceneComposerTopComponent.cursorToSelectionButton.toolTipText=snap cursor to sel
SceneComposerTopComponent.createPhysicsMeshButton.text=add collision shape
SceneComposerTopComponent.createPhysicsMeshButton.toolTipText=Makes the Spatial physics enabled and generates a CollisionShape
SceneComposerTopComponent.jLabel3.text=
SceneComposerTopComponent.sceneInfoPanel.border.title=no scene loaded
SceneComposerTopComponent.palettePanel.border.title=no spatial selected
Templates/JME3/Scene.j3o=Empty jME3 Scene
SceneComposerTopComponent.jPanel4.border.title=Utilities
@ -52,3 +51,7 @@ SceneComposerTopComponent.selectButton.toolTipText=Select
SceneComposerTopComponent.moveButton.toolTipText=Move
SceneComposerTopComponent.rotateButton.toolTipText=Rotate (in-development)
SceneComposerTopComponent.scaleButton.toolTipText=Scale (in-development)
SceneComposerTopComponent.sceneInfoPanel.border.title=no scene loaded
SceneComposerTopComponent.jLabel5.text=Effects :
SceneComposerTopComponent.emitButton.toolTipText=Emit all particles of all particle emitters from the selected Node
SceneComposerTopComponent.emitButton.text=Emit All Particles

@ -70,8 +70,8 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="sceneInfoLabel1" alignment="0" pref="133" max="32767" attributes="0"/>
<Component id="sceneInfoLabel2" alignment="0" pref="133" max="32767" attributes="0"/>
<Component id="sceneInfoLabel1" alignment="0" pref="126" max="32767" attributes="0"/>
<Component id="sceneInfoLabel2" alignment="0" pref="126" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -473,8 +473,21 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jToolBar2" alignment="0" pref="316" max="32767" attributes="1"/>
<Component id="jToolBar3" alignment="0" pref="316" max="32767" attributes="0"/>
<Component id="jToolBar2" alignment="0" pref="323" max="32767" attributes="1"/>
<Component id="jToolBar3" alignment="0" pref="323" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="emitButton" pref="248" max="32767" attributes="0"/>
</Group>
<Component id="jSeparator6" alignment="0" pref="303" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -483,7 +496,14 @@
<Component id="jToolBar2" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jToolBar3" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace pref="83" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator6" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="emitButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="38" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -594,6 +614,28 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JSeparator" name="jSeparator6">
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="emitButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.emitButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.emitButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="emitButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>

@ -5,6 +5,7 @@
package com.jme3.gde.scenecomposer;
import com.jme3.asset.AssetManager;
import com.jme3.effect.ParticleEmitter;
import com.jme3.gde.core.assets.AssetDataObject;
import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.gde.core.assets.SpatialAssetDataObject;
@ -21,6 +22,7 @@ import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.logging.Logger;
import javax.swing.ButtonGroup;
import javax.swing.border.TitledBorder;
@ -119,6 +121,9 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
fixedCheckBox = new javax.swing.JCheckBox();
radiusSpinner = new javax.swing.JSpinner();
heightSpinner = new javax.swing.JSpinner();
jSeparator6 = new javax.swing.JSeparator();
jLabel5 = new javax.swing.JLabel();
emitButton = new javax.swing.JButton();
setBackground(new java.awt.Color(204, 204, 204));
@ -133,8 +138,8 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
sceneInfoPanel.setLayout(sceneInfoPanelLayout);
sceneInfoPanelLayout.setHorizontalGroup(
sceneInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sceneInfoLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
.addComponent(sceneInfoLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
.addComponent(sceneInfoLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
.addComponent(sceneInfoLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
);
sceneInfoPanelLayout.setVerticalGroup(
sceneInfoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -399,12 +404,32 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
heightSpinner.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(1.8f), null, null, Float.valueOf(0.1f)));
jToolBar3.add(heightSpinner);
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.jLabel5.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(emitButton, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.emitButton.text")); // NOI18N
emitButton.setToolTipText(org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.emitButton.toolTipText")); // NOI18N
emitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
emitButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE)
.addComponent(jToolBar3, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE)
.addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 323, Short.MAX_VALUE)
.addComponent(jToolBar3, javax.swing.GroupLayout.DEFAULT_SIZE, 323, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(emitButton, javax.swing.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE))
.addComponent(jSeparator6, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -412,7 +437,13 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
.addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jToolBar3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(83, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(emitButton))
.addContainerGap(38, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -521,12 +552,24 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
MoveTool tool = new MoveTool();
toolController.showEditTool(tool);
}//GEN-LAST:event_moveButtonActionPerformed
private void emitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_emitButtonActionPerformed
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
emit(editorController.getSelectedSpat().getLookup().lookup(Spatial.class));
return null;
}
});
}//GEN-LAST:event_emitButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addCursorButton;
private javax.swing.JButton addObjectButton;
private javax.swing.JButton camToCursorSelectionButton;
private javax.swing.JButton createPhysicsMeshButton;
private javax.swing.JButton cursorToSelectionButton;
private javax.swing.JButton emitButton;
private javax.swing.JCheckBox fixedCheckBox;
private javax.swing.JSpinner heightSpinner;
private javax.swing.JButton jButton1;
@ -535,6 +578,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JList jList1;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
@ -544,6 +588,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
private javax.swing.JToolBar.Separator jSeparator3;
private javax.swing.JToolBar.Separator jSeparator4;
private javax.swing.JToolBar.Separator jSeparator5;
private javax.swing.JSeparator jSeparator6;
private javax.swing.JTextField jTextField1;
private javax.swing.JToolBar jToolBar1;
private javax.swing.JToolBar jToolBar2;
@ -564,6 +609,19 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
private javax.swing.ButtonGroup spatialModButtonGroup;
// End of variables declaration//GEN-END:variables
private void emit(Spatial root) {
if (root instanceof ParticleEmitter) {
((ParticleEmitter) root).killAllParticles();
((ParticleEmitter) root).emitAllParticles();
} else if (root instanceof Node) {
Node n = (Node) root;
for (Spatial child : n.getChildren()) {
emit(child);
}
}
}
/**
* Gets default instance. Do not use directly: reserved for *.settings files only,
* i.e. deserialization routines; otherwise you could get a non-deserialized instance.
@ -689,7 +747,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
if (node == null) {
jList1.setListData(new String[]{});
} else if (node) {
jList1.setListData(new String[]{"Node", "Particle Emitter", "Audio Node", "Picture", "Point Light" ,"Spot Light", "Directional Light", "Ambient Light"});
jList1.setListData(new String[]{"Node", "Particle Emitter", "Audio Node", "Picture", "Point Light", "Spot Light", "Directional Light", "Ambient Light"});
} else {
jList1.setListData(new String[]{"Point Light", "Spot Light", "Directional Light", "Ambient Light"});
}
@ -808,6 +866,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
}
private void selectSpatial(JmeSpatial spatial) {
if (spatial == null) {
setSelectedObjectText(null);
setSelectionData(null);

Loading…
Cancel
Save