diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
index 373565342..0fd8ec433 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
@@ -26,6 +26,7 @@ package com.jme3.gde.core.scene;
import com.jme3.app.Application;
import com.jme3.app.StatsView;
+import com.jme3.bullet.BulletAppState;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.gde.core.Installer;
@@ -118,6 +119,7 @@ public class SceneApplication extends Application implements LookupProvider, Loo
private AwtPanel panel;
private ViewPort overlayView;
boolean useCanvas = false;
+ private BulletAppState physicsState;
public SceneApplication() {
progressHandle.start(7);
@@ -457,6 +459,11 @@ public class SceneApplication extends Application implements LookupProvider, Loo
}
}
checkSave();
+ if (physicsState != null) {
+ physicsState.getPhysicsSpace().removeAll(rootNode);
+ getStateManager().detach(physicsState);
+ physicsState=null;
+ }
currentSceneRequest.setDisplayed(false);
}
toolsNode.detachAllChildren();
@@ -562,6 +569,27 @@ public class SceneApplication extends Application implements LookupProvider, Loo
}
});
}
+
+ public void setPhysicsEnabled(final boolean enabled){
+ enqueue(new Callable() {
+
+ public Object call() throws Exception {
+ if (enabled) {
+ if(physicsState==null){
+ physicsState = new BulletAppState();
+ getStateManager().attach(physicsState);
+ physicsState.getPhysicsSpace().addAll(rootNode);
+ }
+ }else{
+ if(physicsState!=null){
+ physicsState.getPhysicsSpace().removeAll(rootNode);
+ getStateManager().detach(physicsState);
+ }
+ }
+ return null;
+ }
+ });
+ }
/**
* @return the currentSceneRequest
diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/Bundle.properties b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/Bundle.properties
index 25a6d1bcc..9777bf0f0 100644
--- a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/Bundle.properties
+++ b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/Bundle.properties
@@ -50,3 +50,6 @@ 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
+SceneComposerTopComponent.jLabel6.text=Physics:
+SceneComposerTopComponent.jButton2.text=
+SceneComposerTopComponent.jButton3.text=
diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.form b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.form
index bff79de5c..c742f5bcc 100644
--- a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.form
+++ b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.form
@@ -33,7 +33,7 @@
-
+
@@ -77,7 +77,7 @@
-
+
@@ -349,6 +349,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -359,12 +401,12 @@
-
+
-
+
@@ -388,8 +430,8 @@
-
-
+
+
@@ -399,7 +441,7 @@
-
+
diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java
index eebb7e006..51558e671 100644
--- a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java
+++ b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java
@@ -107,6 +107,9 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
jLabel2 = new javax.swing.JLabel();
camToCursorSelectionButton = new javax.swing.JButton();
jSeparator1 = new javax.swing.JToolBar.Separator();
+ jLabel6 = new javax.swing.JLabel();
+ jButton2 = new javax.swing.JButton();
+ jButton3 = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jToolBar2 = new javax.swing.JToolBar();
@@ -145,7 +148,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
.addComponent(sceneInfoLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sceneInfoLabel2)
- .addContainerGap(106, Short.MAX_VALUE))
+ .addContainerGap(107, Short.MAX_VALUE))
);
jToolBar1.setBackground(new java.awt.Color(204, 204, 204));
@@ -300,17 +303,45 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
jToolBar1.add(camToCursorSelectionButton);
jToolBar1.add(jSeparator1);
+ jLabel6.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.jLabel6.text")); // NOI18N
+ jToolBar1.add(jLabel6);
+
+ jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/scenecomposer/play.gif"))); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.jButton2.text")); // NOI18N
+ jButton2.setFocusable(false);
+ jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ jButton2.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton2ActionPerformed(evt);
+ }
+ });
+ jToolBar1.add(jButton2);
+
+ jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/scenecomposer/pause.gif"))); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(jButton3, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.jButton3.text")); // NOI18N
+ jButton3.setFocusable(false);
+ jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ jButton3.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton3ActionPerformed(evt);
+ }
+ });
+ jToolBar1.add(jButton3);
+
jPanel3.setBackground(new java.awt.Color(204, 204, 204));
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 321, Short.MAX_VALUE)
+ .addGap(0, 131, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 23, Short.MAX_VALUE)
+ .addGap(0, 21, Short.MAX_VALUE)
);
jToolBar1.add(jPanel3);
@@ -381,8 +412,8 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
- .addComponent(jToolBar3, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
+ .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)
+ .addComponent(jToolBar3, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -391,7 +422,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(emitButton, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE))
- .addComponent(jSeparator6, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE))
+ .addComponent(jSeparator6, javax.swing.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
@@ -417,7 +448,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sceneInfoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 737, Short.MAX_VALUE)
+ .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 766, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -515,6 +546,14 @@ private void scaleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
toolController.showEditTool(tool);
}//GEN-LAST:event_scaleButtonActionPerformed
+ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
+ SceneApplication.getApplication().setPhysicsEnabled(true);
+ }//GEN-LAST:event_jButton2ActionPerformed
+
+ private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
+ SceneApplication.getApplication().setPhysicsEnabled(false);
+ }//GEN-LAST:event_jButton3ActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton camToCursorSelectionButton;
private javax.swing.JButton createPhysicsMeshButton;
@@ -523,12 +562,15 @@ private void scaleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
private javax.swing.JCheckBox fixedCheckBox;
private javax.swing.JSpinner heightSpinner;
private javax.swing.JButton jButton1;
+ private javax.swing.JButton jButton2;
+ private javax.swing.JButton jButton3;
private javax.swing.JCheckBox jCheckBox1;
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.JLabel jLabel6;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JToolBar.Separator jSeparator1;
diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/pause.gif b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/pause.gif
new file mode 100644
index 000000000..32f4d24c2
Binary files /dev/null and b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/pause.gif differ
diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/play.gif b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/play.gif
new file mode 100644
index 000000000..797948ee9
Binary files /dev/null and b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/play.gif differ