|
From: <tre...@us...> - 2008-02-07 12:20:17
|
Revision: 723
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=723&view=rev
Author: trevorolio
Date: 2008-02-07 04:20:21 -0800 (Thu, 07 Feb 2008)
Log Message:
-----------
More attachment work:
a first pass at a body editor UI
a template for Joe with just a texture containing shirts and pants
fixed up the populate mojo to read an attachment property out of template.properties
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 2008-02-07 12:20:10 UTC (rev 722)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2008-02-07 12:20:21 UTC (rev 723)
@@ -301,6 +301,13 @@
user.getBodyConfiguration().setBodyDataID(bodyDataID);
bodyPanel.bodyData = dataManager.getBodyData(bodyDataID);
bodyPanel.renderable.initBody(bodyPanel.bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
+
+ Attachment[] attachments = user.getBodyConfiguration().getAttachments();
+ for (int i = 0; i < attachments.length; i++) {
+ J3DAttachment j3dAttachment = new J3DAttachment(attachments[i], dataManager);
+ bodyPanel.renderable.attach(j3dAttachment);
+ }
+
saveBodyConfiguration();
}
@@ -331,6 +338,13 @@
user.setBodyConfiguration(createBodyConfiguration(doc));
bodyPanel.bodyData = dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID());
bodyPanel.renderable.initBody(bodyPanel.bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
+
+ Attachment[] attachments = user.getBodyConfiguration().getAttachments();
+ for (int i = 0; i < attachments.length; i++) {
+ J3DAttachment j3dAttachment = new J3DAttachment(attachments[i], dataManager);
+ bodyPanel.renderable.attach(j3dAttachment);
+ }
+
accountDoc.setBodyConfigurationID(bodyConfigurationID);
webClient.updateAccount(accountDoc);
@@ -370,6 +384,51 @@
return completedInitialLoad;
}
+ public void addAttachment(String ownerUsername, String templateID) {
+ try {
+ long id = Long.parseLong(templateID);
+ BodyConfigurationDocument doc = new BodyConfigurationDocument(user.getBodyConfiguration());
+ AttachmentDocument[] attachDocs = doc.getAttachmentDocuments();
+ for (int i = 0; i < attachDocs.length; i++) {
+ if (attachDocs[i].getTemplateID() == id) {
+ return;
+ }
+ }
+ System.out.println("Adding attachment: " + id);
+ doc.addAttachment(ownerUsername, id);
+ webClient.updateBodyConfiguration(doc);
+ bodyPanel.fetchNewBodyConfiguration();
+ } catch (NumberFormatException e) {
+ System.err.println("Bad number: " + templateID);
+ } catch (IOException e) {
+ System.err.println("Could not update: " + e);
+ }
+ }
+
+ public void removeAttachment(String attachmentID) {
+ try {
+ long id = Long.parseLong(attachmentID);
+ BodyConfigurationDocument doc = new BodyConfigurationDocument(user.getBodyConfiguration());
+ AttachmentDocument[] attachDocs = doc.getAttachmentDocuments();
+ for (int i = 0; i < attachDocs.length; i++) {
+ if (attachDocs[i].getAttachmentID() == id) {
+ System.out.println("Removing attachment " + id);
+ doc.removeAttachment(id);
+ webClient.updateBodyConfiguration(doc);
+ bodyPanel.fetchNewBodyConfiguration();
+ return;
+ } else {
+ System.out.println("Not removing attachment " + attachDocs[i].getAttachmentID());
+ }
+ }
+ System.out.println("Could not find an attachment to remove: " + id);
+ } catch (NumberFormatException e) {
+ System.err.println("Bad number: " + attachmentID);
+ } catch (IOException e) {
+ System.err.println("Could not update: " + e);
+ }
+ }
+
private class SpacelessContext implements Context {
public InputStream getPageContentStream(long thingID, long pageID) {
@@ -445,6 +504,12 @@
user.setBodyConfiguration(createBodyConfiguration(webClient.getDefaultBodyConfiguration(accountDoc.getUsername())));
bodyData = dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID());
renderable.initBody(bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
+
+ Attachment[] attachments = user.getBodyConfiguration().getAttachments();
+ for (int i = 0; i < attachments.length; i++) {
+ J3DAttachment j3dAttachment = new J3DAttachment(attachments[i], dataManager);
+ renderable.attach(j3dAttachment);
+ }
}
private void addDirectionalLight(Color3f color, Vector3f direction) {
@@ -558,7 +623,6 @@
try {
return webClient.getTemplateGeometryStream(username, templateID, lod);
} catch (IOException e) {
- System.err.println("Could not fetch template geometry: " + username + ", " + templateID + ", " + lod);
return null;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|