|
From: <tre...@us...> - 2007-10-05 02:59:42
|
Revision: 481
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=481&view=rev
Author: trevorolio
Date: 2007-10-04 19:59:47 -0700 (Thu, 04 Oct 2007)
Log Message:
-----------
Added a chooser for the body editor. You'll need to add this to your maven settings.xml:
<ogoglio.bodyDataDisplayNames>Mike,Andrea</ogoglio.bodyDataDisplayNames>
<ogoglio.bodyDataFileNames>ogoglio-body-mike.jar,ogoglio-body-andrea.jar</ogoglio.bodyDataFileNames>
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-05 02:59:44 UTC (rev 480)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-05 02:59:47 UTC (rev 481)
@@ -31,6 +31,7 @@
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.Vector;
import java.util.zip.ZipInputStream;
import javax.media.j3d.AmbientLight;
@@ -43,6 +44,7 @@
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
import javax.swing.BoxLayout;
+import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
@@ -92,7 +94,9 @@
private boolean completedInitialLoad = false;
private J3DDataManager dataManager = null;
-
+
+ private BodyDataDocument[] bodyDataDocuments = null;
+
public BodyEditorApplet() {
setBackground(Color.WHITE);
setLayout(new BorderLayout());
@@ -206,7 +210,7 @@
}
private class MorphListPanel extends Panel implements ActionListener {
- Dimension dimension = new Dimension(150, 400);
+ Dimension dimension = new Dimension(150, 300);
Button saveButton = new Button("Save");
@@ -222,7 +226,7 @@
validate();
MorphDeltaMap[] deltaMaps = bodyPanel.bodyData.getMorphDeltaMaps();
if (deltaMaps.length == 0) {
- add(new Label("No Available Morphs"));
+ add(saveButton);
validate();
return;
}
@@ -327,9 +331,59 @@
}
+ private class BodyPickerPanel extends Panel implements ActionListener {
+ Dimension dimension = new Dimension(150, 75);
+
+ JComboBox bodyComboBox = null;
+
+ public BodyPickerPanel() {
+ setPreferredSize(dimension);
+ setMinimumSize(dimension);
+ setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
+ setBackground(Color.WHITE);
+
+ Vector names = new Vector();
+ int selectedIndex = -1;
+ for (int i = 0; i < bodyDataDocuments.length; i++) {
+ names.add(bodyDataDocuments[i].getDisplayName());
+ if(user.getBodyConfiguration().getBodyDataID() == bodyDataDocuments[i].getBodyDataID()){
+ selectedIndex = i;
+ }
+ }
+ bodyComboBox = new JComboBox(names.toArray());
+ bodyComboBox.setSelectedIndex(selectedIndex);
+ bodyComboBox.setBackground(Color.WHITE);
+ bodyComboBox.addActionListener(this);
+ add(bodyComboBox);
+ }
+
+ public void actionPerformed(ActionEvent event) {
+ if(event.getSource() == bodyComboBox){
+ String bodyName = (String)bodyComboBox.getSelectedItem();
+ if(bodyName == null){
+ return;
+ }
+ for (int i = 0; i < bodyDataDocuments.length; i++) {
+ if(bodyName.equals(bodyDataDocuments[i].getDisplayName())){
+ if(bodyDataDocuments[i].getBodyDataID() == user.getBodyConfiguration().getBodyDataID()){
+ return;
+ }
+ user.getBodyConfiguration().setBodyDataID(bodyDataDocuments[i].getBodyDataID());
+ bodyPanel.bodyData = dataManager.getBodyData(bodyDataDocuments[i].getBodyDataID());
+ bodyPanel.renderable.initBody(bodyPanel.bodyData);
+ westPanel.morphList.initList();
+ eastPanel.animationList.initAnimationList();
+ }
+ }
+ }
+ }
+ }
+
private class WestPanel extends Panel {
Dimension dimension = new Dimension(150, 400);
+ BodyPickerPanel bodyPickerPanel = new BodyPickerPanel();
+
MorphListPanel morphList = new MorphListPanel();
public WestPanel() {
@@ -337,6 +391,7 @@
setMinimumSize(dimension);
setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
setBackground(Color.WHITE);
+ add(bodyPickerPanel);
add(morphList);
}
}
@@ -364,8 +419,8 @@
}
public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof Button){
- Button button = (Button)e.getSource();
+ if (e.getSource() instanceof Button) {
+ Button button = (Button) e.getSource();
bodyPanel.renderable.playAnimation(button.getLabel(), false);
}
}
@@ -410,6 +465,8 @@
user = new SpacelessUser(accountDoc.getUsername(), webClient.getDefaultBodyConfiguration(accountDoc.getUsername()));
+ bodyDataDocuments = webClient.getBodyDataDocuments();
+
add(bodyPanel, BorderLayout.CENTER);
westPanel = new WestPanel();
add(westPanel, BorderLayout.WEST);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|