summaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorpaulby <[email protected]>2007-03-01 23:25:28 +0000
committerpaulby <[email protected]>2007-03-01 23:25:28 +0000
commita4681c797ef3f606e2c050e63439bc1467601e19 (patch)
tree6ceae0b88bd5d93cf8632aaaaf9b8d9882610489 /src/classes
parent95e41ab37db4bf9e1181022421b791107e8b64db (diff)
Fix issue 453, add support of SceneGraphObject name field
Issue number: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.java.net/svn/j3d-core-utils~svn/trunk@154 9497e636-51bd-65ba-982d-a4982e1767a5
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/share/com/sun/j3d/utils/scenegraph/io/retained/Controller.java3
-rw-r--r--src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/SceneGraphObjectState.java22
2 files changed, 24 insertions, 1 deletions
diff --git a/src/classes/share/com/sun/j3d/utils/scenegraph/io/retained/Controller.java b/src/classes/share/com/sun/j3d/utils/scenegraph/io/retained/Controller.java
index 38b6204..60b03be 100644
--- a/src/classes/share/com/sun/j3d/utils/scenegraph/io/retained/Controller.java
+++ b/src/classes/share/com/sun/j3d/utils/scenegraph/io/retained/Controller.java
@@ -113,8 +113,9 @@ public abstract class Controller extends java.lang.Object {
SceneGraphIO interface
2) Add missing duplicateOnCloneTree flag
(bug 4690159)
+ * 3 = Java3D 1.5.1 1) Add support for SceneGraphObject Name field
*/
- protected int outputFileVersion = 2;
+ protected int outputFileVersion = 3;
/**
* When running the application within webstart this may not be the
diff --git a/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/SceneGraphObjectState.java b/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/SceneGraphObjectState.java
index 8a49aa9..dba35e7 100644
--- a/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/SceneGraphObjectState.java
+++ b/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/SceneGraphObjectState.java
@@ -134,6 +134,7 @@ public abstract class SceneGraphObjectState {
}
writeUserData( out );
+ writeString(node.getName(), out);
writeCapabilities( out );
}
@@ -179,6 +180,9 @@ public abstract class SceneGraphObjectState {
symbol = control.getSymbolTable().createSymbol( this, node, nodeID );
readUserData( in );
+ if (control.getCurrentFileVersion()>2) {
+ node.setName(readString(in));
+ }
readCapabilities( in );
}
@@ -503,4 +507,22 @@ public abstract class SceneGraphObjectState {
node = null;
}
+ /**
+ * Read and return a possibly null string
+ */
+ protected String readString(DataInput in) throws IOException {
+ if (in.readBoolean())
+ return (in.readUTF());
+ return null;
+ }
+
+ /**
+ * Write a possibly null string to the stream
+ */
+ protected void writeString(String str, DataOutput out) throws IOException {
+ out.writeBoolean(str!=null);
+ if (str!=null)
+ out.writeUTF(str);
+ }
+
}