|
From: <tre...@us...> - 2008-02-06 01:19:52
|
Revision: 709
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=709&view=rev
Author: trevorolio
Date: 2008-02-05 17:19:59 -0800 (Tue, 05 Feb 2008)
Log Message:
-----------
Added the back end and 3D rendering of attachment geometries and appearances, but not yet morphs or skin textures.
Also no example UI for picking attachments in the body editor, yet.
The "time to private parts" for Ogoglio starts now.
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-06 01:19:48 UTC (rev 708)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2008-02-06 01:19:59 UTC (rev 709)
@@ -51,13 +51,16 @@
import com.ogoglio.client.WebAPIClient;
import com.ogoglio.client.WebAPIClientWire;
import com.ogoglio.client.WebAPIDescriptor;
+import com.ogoglio.client.model.Attachment;
import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.client.model.BodyDataProvider;
import com.ogoglio.client.model.Space;
+import com.ogoglio.client.model.Template;
import com.ogoglio.client.model.TemplateDataProvider;
import com.ogoglio.client.model.User;
import com.ogoglio.client.model.Space.Context;
import com.ogoglio.util.UIConstants;
+import com.ogoglio.viewer.j3d.J3DAttachment;
import com.ogoglio.viewer.j3d.J3DBodyData;
import com.ogoglio.viewer.j3d.J3DCamera;
import com.ogoglio.viewer.j3d.J3DCanvas;
@@ -68,8 +71,11 @@
import com.ogoglio.viewer.j3d.body.MorphDeltaMap;
import com.ogoglio.viewer.j3d.bvh.Bvh;
import com.ogoglio.xml.AccountDocument;
+import com.ogoglio.xml.AttachmentDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.BodyDataDocument;
+import com.ogoglio.xml.BodySettingDocument;
+import com.ogoglio.xml.TemplateDocument;
/*
* NOTE: String arrays don't function in LiveConnect in IE, so we use the getXXXCount and getXXX(index) pattern
@@ -205,8 +211,8 @@
if (user == null || bodyPanel == null || bodyPanel.renderable == null) {
return;
}
- new Thread(){
- public void run(){
+ new Thread() {
+ public void run() {
try {
// Obtain the size of the displayed canvas
@@ -243,7 +249,7 @@
} catch (Throwable e) {
e.printStackTrace();
}
-
+
}
}.start();
}
@@ -322,7 +328,7 @@
System.err.println("Could not fetch body config");
return;
}
- user.setBodyConfiguration(new BodyConfiguration(doc));
+ user.setBodyConfiguration(createBodyConfiguration(doc));
bodyPanel.bodyData = dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID());
bodyPanel.renderable.initBody(bodyPanel.bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
accountDoc.setBodyConfigurationID(bodyConfigurationID);
@@ -334,9 +340,29 @@
}
}
+ private BodyConfiguration createBodyConfiguration(BodyConfigurationDocument configDoc) {
+ BodyConfiguration config = new BodyConfiguration(configDoc.getBodyConfigurationID(), configDoc.getDisplayName(), configDoc.getBodyDataID(), configDoc.getBaseTextureName());
+ BodySettingDocument[] settingDocs = configDoc.getBodySettingDocuments();
+ for (int i = 0; i < settingDocs.length; i++) {
+ config.addSetting(settingDocs[i].getSettingName(), settingDocs[i].getSetting());
+ }
+ AttachmentDocument[] attachmentDocs = configDoc.getAttachmentDocuments();
+ for (int i = 0; i < attachmentDocs.length; i++) {
+ try {
+ TemplateDocument templateDoc = webClient.getTemplateDocument(attachmentDocs[i].getTemplateOwner(), attachmentDocs[i].getTemplateID());
+ Template template = new Template(templateDoc);
+ Attachment attachment = new Attachment(attachmentDocs[i].getAttachmentID(), template, config);
+ config.addAttachment(attachment);
+ } catch (IOException e) {
+ System.err.println("Could not find template " + attachmentDocs[i].getTemplateID() + " for attachment: " + e);
+ }
+ }
+ return config;
+ }
+
private class SpacelessUser extends User {
public SpacelessUser(String username, BodyConfigurationDocument bodyConfigDoc) {
- super(new Space(new SpacelessContext(), 1, "Space", "nobody", false, 0, UIConstants.LIGHT_BLUE), username, new Transform3D(), new BodyConfiguration(bodyConfigDoc), null, null, null, null);
+ super(new Space(new SpacelessContext(), 1, "Space", "nobody", false, 0, UIConstants.LIGHT_BLUE), username, new Transform3D(), createBodyConfiguration(bodyConfigDoc), null, null, null, null);
}
}
@@ -400,6 +426,13 @@
renderable = new J3DUserRenderable(user, bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
renderable.setCamera(camera);
renderable.getCameraBehavior().setAllowXRotation(false);
+
+ Attachment[] attachments = user.getBodyConfiguration().getAttachments();
+ for (int i = 0; i < attachments.length; i++) {
+ J3DAttachment j3dAttachment = new J3DAttachment(attachments[i], dataManager);
+ renderable.attach(j3dAttachment);
+ }
+
userGroup.addChild(renderable);
return true;
} catch (Exception e) {
@@ -409,7 +442,7 @@
}
public void fetchNewBodyConfiguration() throws IOException {
- user.setBodyConfiguration(new BodyConfiguration(webClient.getDefaultBodyConfiguration(accountDoc.getUsername())));
+ user.setBodyConfiguration(createBodyConfiguration(webClient.getDefaultBodyConfiguration(accountDoc.getUsername())));
bodyData = dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID());
renderable.initBody(bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
}
@@ -522,11 +555,21 @@
private class TemplateProvider implements TemplateDataProvider {
public InputStream getTemplateGeometry(String username, long templateID, int lod) {
- return null;
+ try {
+ return webClient.getTemplateGeometryStream(username, templateID, lod);
+ } catch (IOException e) {
+ System.err.println("Could not fetch template geometry: " + username + ", " + templateID + ", " + lod);
+ return null;
+ }
}
public InputStream getTemplateResource(String username, long templateID, String resourceName) {
- return null;
+ try {
+ return webClient.getTemplateResourceStream(username, templateID, resourceName);
+ } catch (IOException e) {
+ System.err.println("Could not fetch template resource: " + username + ", " + templateID + ", " + resourceName);
+ return null;
+ }
}
public String getTemplateScript(String username, long templateID) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <tre...@us...> - 2008-02-12 04:59:04
|
Revision: 737
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=737&view=rev
Author: trevorolio
Date: 2008-02-11 20:59:08 -0800 (Mon, 11 Feb 2008)
Log Message:
-----------
Changes for the new avatar art.
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-12 04:58:31 UTC (rev 736)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2008-02-12 04:59:08 UTC (rev 737)
@@ -45,6 +45,7 @@
import javax.swing.JLabel;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
+import javax.vecmath.Vector3d;
import javax.vecmath.Vector3f;
import com.ogoglio.client.WebAPIAuthenticator;
@@ -562,6 +563,17 @@
}
+ public void setView(float x, float y, float z, float rotX, float rotY, float rotZ){
+ if(bodyPanel.camera == null){
+ return;
+ }
+ bodyPanel.camera.setToDefaultLocation();
+ bodyPanel.camera.setRelativePosition(x, y, z);
+ Transform3D rotTransform = new Transform3D();
+ rotTransform.setEuler(new Vector3d(rotX, rotY, rotZ));
+ bodyPanel.camera.getTransformGroup().setTransform(rotTransform);
+ }
+
public void start() {
authCookie = getParameter("loginCookie");
if (authCookie == null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2008-02-13 04:07:32
|
Revision: 744
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=744&view=rev
Author: trevorolio
Date: 2008-02-12 20:07:33 -0800 (Tue, 12 Feb 2008)
Log Message:
-----------
Now add and remove attachments without reloading the entire body.
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-13 04:06:40 UTC (rev 743)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2008-02-13 04:07:33 UTC (rev 744)
@@ -299,17 +299,21 @@
if (user == null || bodyPanel == null || bodyPanel.renderable == null) {
return;
}
- 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();
+ BodyConfiguration bodyConfiguration = user.getBodyConfiguration();
+ bodyConfiguration.setBodyDataID(bodyDataID);
+ Attachment[] attachments = bodyConfiguration.getAttachments();
for (int i = 0; i < attachments.length; i++) {
- J3DAttachment j3dAttachment = new J3DAttachment(attachments[i], dataManager);
- bodyPanel.renderable.attach(j3dAttachment);
+ bodyConfiguration.removeAttachment(attachments[i].getAttachmentID());
}
+ String[] settings = bodyConfiguration.getSettingNames();
+ for (int i = 0; i < settings.length; i++) {
+ bodyConfiguration.removeSetting(settings[i]);
+ }
+
+ saveBodyConfiguration();
- saveBodyConfiguration();
+ bodyPanel.bodyData = dataManager.getBodyData(bodyDataID);
+ bodyPanel.renderable.initBody(bodyPanel.bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
}
public void saveBodyConfiguration() {
@@ -386,19 +390,35 @@
}
public void addAttachment(String ownerUsername, String templateID) {
+ System.out.println("Adding attachment with templateID: " + 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) {
+ System.out.println("Already have that attachment: " + templateID);
return;
}
}
- System.out.println("Adding attachment: " + id);
+
doc.addAttachment(ownerUsername, id);
webClient.updateBodyConfiguration(doc);
- bodyPanel.fetchNewBodyConfiguration();
+ doc = webClient.getDefaultBodyConfiguration(user.getUsername());
+ System.out.println(doc);
+ attachDocs = doc.getAttachmentDocuments();
+ for (int i = 0; i < attachDocs.length; i++) {
+ if (attachDocs[i].getTemplateID() == id) {
+ TemplateDocument templateDoc = webClient.getTemplateDocument(attachDocs[i].getTemplateOwner(), attachDocs[i].getTemplateID());
+ Template template = new Template(templateDoc);
+ Attachment attachment = new Attachment(attachDocs[i].getAttachmentID(), template, user.getBodyConfiguration());
+ user.getBodyConfiguration().addAttachment(attachment);
+
+ J3DAttachment j3dAttachment = new J3DAttachment(attachment, dataManager);
+ bodyPanel.renderable.attach(j3dAttachment);
+ }
+ }
+
} catch (NumberFormatException e) {
System.err.println("Bad number: " + templateID);
} catch (IOException e) {
@@ -407,16 +427,18 @@
}
public void removeAttachment(String attachmentID) {
+ System.out.println("Removing attachment: " + 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);
+ System.out.println("Found attachment to remove: " + id);
doc.removeAttachment(id);
webClient.updateBodyConfiguration(doc);
- bodyPanel.fetchNewBodyConfiguration();
+ bodyPanel.renderable.unattach(id);
+ user.getBodyConfiguration().removeAttachment(id);
return;
} else {
System.out.println("Not removing attachment " + attachDocs[i].getAttachmentID());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|