|
From: <tre...@us...> - 2008-02-13 04:08:08
|
Revision: 745
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=745&view=rev
Author: trevorolio
Date: 2008-02-12 20:08:09 -0800 (Tue, 12 Feb 2008)
Log Message:
-----------
Now add and remove attachments without reloading the entire body.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skeleton.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2008-02-13 04:07:33 UTC (rev 744)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2008-02-13 04:08:09 UTC (rev 745)
@@ -326,4 +326,23 @@
skin.addDecal(bodyImage);
}
}
+
+ public void unattach(long attachmentID) {
+ J3DAttachment[] attaches = getAttachments();
+ for (int i = 0; i < attaches.length; i++) {
+ if(attaches[i].getAttachment().getAttachmentID() == attachmentID){
+ attachments.remove(i);
+ attaches[i].detach();
+
+ if(attaches[i].getBodyImage() != null){
+ skin.removeDecal(attaches[i].getBodyImage());
+ }
+ return;
+ }
+ }
+ }
+
+ public J3DAttachment[] getAttachments() {
+ return (J3DAttachment[])attachments.toArray(new J3DAttachment[0]);
+ }
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skeleton.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skeleton.java 2008-02-13 04:07:33 UTC (rev 744)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skeleton.java 2008-02-13 04:08:09 UTC (rev 745)
@@ -54,6 +54,11 @@
public Attachment() {
addChild(transformGroup);
+ setCapability(BranchGroup.ALLOW_PICKABLE_READ);
+ setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
+ setCapability(BranchGroup.ALLOW_CHILDREN_READ);
+ setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
+ setCapability(BranchGroup.ALLOW_DETACH);
}
public TransformGroup getTransformGroup(){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|