sdk : added spot light support to scene composer

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7896 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 53354f5dda
commit 3cd94d776f
  1. 30
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.form
  2. 43
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java
  3. 36
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneEditorController.java

@ -247,6 +247,9 @@
</Component>
<Component class="javax.swing.JButton" name="addObjectButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/scenecomposer/add.gif"/>
</Property>
@ -264,6 +267,9 @@
</Component>
<Component class="javax.swing.JButton" name="addCursorButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/scenecomposer/add.gif"/>
</Property>
@ -281,6 +287,9 @@
</Component>
<Component class="javax.swing.JButton" name="moveToCursorButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/scenecomposer/move.gif"/>
</Property>
@ -356,6 +365,9 @@
</Component>
<Component class="javax.swing.JButton" name="resetCursorButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.resetCursorButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -372,6 +384,9 @@
</Component>
<Component class="javax.swing.JButton" name="cursorToSelectionButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.cursorToSelectionButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -400,6 +415,9 @@
</Component>
<Component class="javax.swing.JButton" name="camToCursorSelectionButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.camToCursorSelectionButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -484,6 +502,9 @@
<SubComponents>
<Component class="javax.swing.JButton" name="createPhysicsMeshButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.createPhysicsMeshButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -497,6 +518,9 @@
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.jCheckBox1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -531,6 +555,9 @@
<SubComponents>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -541,6 +568,9 @@
</Component>
<Component class="javax.swing.JCheckBox" name="fixedCheckBox">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/scenecomposer/Bundle.properties" key="SceneComposerTopComponent.fixedCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>

@ -215,6 +215,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
jToolBar1.add(scaleButton);
jToolBar1.add(jSeparator5);
addObjectButton.setBackground(new java.awt.Color(204, 204, 204));
addObjectButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/scenecomposer/add.gif"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(addObjectButton, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.addObjectButton.text")); // NOI18N
addObjectButton.setToolTipText(org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.addObjectButton.toolTipText")); // NOI18N
@ -226,6 +227,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
});
jToolBar1.add(addObjectButton);
addCursorButton.setBackground(new java.awt.Color(204, 204, 204));
addCursorButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/scenecomposer/add.gif"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(addCursorButton, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.addCursorButton.text")); // NOI18N
addCursorButton.setToolTipText(org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.addCursorButton.toolTipText")); // NOI18N
@ -237,6 +239,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
});
jToolBar1.add(addCursorButton);
moveToCursorButton.setBackground(new java.awt.Color(204, 204, 204));
moveToCursorButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/scenecomposer/move.gif"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(moveToCursorButton, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.moveToCursorButton.text")); // NOI18N
moveToCursorButton.setToolTipText(org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.moveToCursorButton.toolTipText")); // NOI18N
@ -284,6 +287,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.jLabel1.text")); // NOI18N
jToolBar1.add(jLabel1);
resetCursorButton.setBackground(new java.awt.Color(204, 204, 204));
org.openide.awt.Mnemonics.setLocalizedText(resetCursorButton, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.resetCursorButton.text")); // NOI18N
resetCursorButton.setToolTipText(org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.resetCursorButton.toolTipText")); // NOI18N
resetCursorButton.setFocusable(false);
@ -296,6 +300,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
});
jToolBar1.add(resetCursorButton);
cursorToSelectionButton.setBackground(new java.awt.Color(204, 204, 204));
org.openide.awt.Mnemonics.setLocalizedText(cursorToSelectionButton, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.cursorToSelectionButton.text")); // NOI18N
cursorToSelectionButton.setToolTipText(org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.cursorToSelectionButton.toolTipText")); // NOI18N
cursorToSelectionButton.setFocusable(false);
@ -313,6 +318,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.jLabel2.text")); // NOI18N
jToolBar1.add(jLabel2);
camToCursorSelectionButton.setBackground(new java.awt.Color(204, 204, 204));
org.openide.awt.Mnemonics.setLocalizedText(camToCursorSelectionButton, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.camToCursorSelectionButton.text")); // NOI18N
camToCursorSelectionButton.setToolTipText(org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.camToCursorSelectionButton.toolTipText")); // NOI18N
camToCursorSelectionButton.setFocusable(false);
@ -348,6 +354,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
jToolBar2.setFloatable(false);
jToolBar2.setRollover(true);
createPhysicsMeshButton.setBackground(new java.awt.Color(204, 204, 204));
org.openide.awt.Mnemonics.setLocalizedText(createPhysicsMeshButton, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.createPhysicsMeshButton.text")); // NOI18N
createPhysicsMeshButton.setToolTipText(org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.createPhysicsMeshButton.toolTipText")); // NOI18N
createPhysicsMeshButton.addActionListener(new java.awt.event.ActionListener() {
@ -357,6 +364,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
});
jToolBar2.add(createPhysicsMeshButton);
jCheckBox1.setBackground(new java.awt.Color(204, 204, 204));
org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.jCheckBox1.text")); // NOI18N
jToolBar2.add(jCheckBox1);
@ -370,6 +378,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
jToolBar3.setFloatable(false);
jToolBar3.setRollover(true);
jButton1.setBackground(new java.awt.Color(204, 204, 204));
org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.jButton1.text")); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -378,6 +387,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
});
jToolBar3.add(jButton1);
fixedCheckBox.setBackground(new java.awt.Color(204, 204, 204));
fixedCheckBox.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(fixedCheckBox, org.openide.util.NbBundle.getMessage(SceneComposerTopComponent.class, "SceneComposerTopComponent.fixedCheckBox.text")); // NOI18N
fixedCheckBox.setEnabled(false);
@ -511,7 +521,6 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
MoveTool tool = new MoveTool();
toolController.showEditTool(tool);
}//GEN-LAST:event_moveButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addCursorButton;
private javax.swing.JButton addObjectButton;
@ -680,9 +689,9 @@ 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", "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", "Directional Light", "Ambient Light"});
jList1.setListData(new String[]{"Point Light", "Spot Light", "Directional Light", "Ambient Light"});
}
}
});
@ -893,30 +902,30 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
camController.setToolController(toolController);
camController.setMaster(this);
camController.enable();
toolController.setCameraController(camController);
SelectTool tool = new SelectTool();
toolController.showEditTool(tool);
}/* else {
SceneApplication.getApplication().removeSceneListener(this);
currentRequest = null;
setSceneInfo(null, false);
cleanupControllers();
}*/
SceneApplication.getApplication().removeSceneListener(this);
currentRequest = null;
setSceneInfo(null, false);
cleanupControllers();
}*/
}
public boolean sceneClose(SceneRequest request) {
if (request.equals(currentRequest)) {
// if (checkSaved()) {
SceneApplication.getApplication().removeSceneListener(this);
currentRequest = null;
setSceneInfo(null, null, false);
java.awt.EventQueue.invokeLater(new Runnable() {
SceneApplication.getApplication().removeSceneListener(this);
currentRequest = null;
setSceneInfo(null, null, false);
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
cleanupControllers();
}
});
public void run() {
cleanupControllers();
}
});
// } else {
// return false;
// }

@ -25,6 +25,7 @@ import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.light.Light;
import com.jme3.light.PointLight;
import com.jme3.light.SpotLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
@ -204,6 +205,18 @@ public class SceneEditorController implements PropertyChangeListener, NodeListen
refreshSelected();
undoLight = light;
undoParent = ((Node) selected);
} else if ("Spot Light".equals(name)) {
SpotLight light = new SpotLight();
if (point != null) {
Vector3f localVec = new Vector3f();
selected.worldToLocal(point, localVec);
light.setPosition(localVec);
}
light.setColor(ColorRGBA.White);
((Node) selected).addLight(light);
refreshSelected();
undoLight = light;
undoParent = ((Node) selected);
} else if ("Directional Light".equals(name)) {
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
@ -231,7 +244,19 @@ public class SceneEditorController implements PropertyChangeListener, NodeListen
selected.addLight(light);
refreshSelected();
undoLight = light;
undoParent = ((Node) selected);
undoSpatial = ((Geometry) selected);
} else if ("Spot Light".equals(name)) {
SpotLight light = new SpotLight();
if (point != null) {
Vector3f localVec = new Vector3f();
selected.worldToLocal(point, localVec);
light.setPosition(localVec);
}
light.setColor(ColorRGBA.White);
selected.addLight(light);
refreshSelected();
undoLight = light;
undoSpatial = ((Geometry) selected);
} else if ("Directional Light".equals(name)) {
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
@ -239,14 +264,14 @@ public class SceneEditorController implements PropertyChangeListener, NodeListen
selected.addLight(dl);
refreshSelected();
undoLight = dl;
undoParent = ((Node) selected);
undoSpatial = ((Geometry) selected);
} else if ("Ambient Light".equals(name)) {
AmbientLight dl = new AmbientLight();
dl.setColor(ColorRGBA.White);
selected.addLight(dl);
refreshSelected();
undoLight = dl;
undoParent = ((Node) selected);
undoSpatial = ((Geometry) selected);
}
}
AbstractSceneExplorerNode selectedSpat = this.selectedSpat;
@ -453,9 +478,9 @@ public class SceneEditorController implements PropertyChangeListener, NodeListen
}
public void doRotateSpatial(Spatial selected, Quaternion rotation) {
Quaternion before=new Quaternion(selected.getLocalRotation());
Quaternion before = new Quaternion(selected.getLocalRotation());
selected.rotate(rotation);
Quaternion after=new Quaternion(selected.getLocalRotation());
Quaternion after = new Quaternion(selected.getLocalRotation());
rotateUndo(selected, before, after, selectedSpat);
}
@ -925,5 +950,4 @@ public class SceneEditorController implements PropertyChangeListener, NodeListen
selectedSpat.removePropertyChangeListener(this);
}
}
}

Loading…
Cancel
Save