Is there a way to save the state of a world and space into the XODE DOM (so that it can be saved to an xml file)?
Not yet I’m afraid.
Although it’s not too hard to add, just iterate though the ODE World & Space building the objects XODE counterparts and then write that out to disk. The main problem is that you would need more constructors for the XODE objects so you can pass the data directly in.
How urgently do you need this feature?
Will.
I don’t need the feature urgently, I thought that there may have been something obvious that I was missing in the documentation. Some of my framework is tightly coupled with ODE (bad software engineering on my part :-[, or maybe just unavoidable :-/) so I might have to end up writing my own persistence for ode anyway.
One could simply iterate over the ODE scene and write out the XML however using the XODE* objects is probably better as you can easily tell the correct attributes from the instance variables.
If I were to code it, it would probably be a two step process like this:
public class SomeClass {
public XODERoot generateXODETree(World world, Space space) {
// iterates though the ODE scene creating XODE objects
}
}
public class XODERoot {
//...
public Document getXODEXML() {
// recursivly builds the XODE structure into DOM structure and returns the results.
}
}
I may as well make them Serializable as well, that’s not too hard at all as they are basically just struts already - a few variables would need to be marked ‘transient’ but that’s about all.
Will.
I have paved the way for this support.
Firstly I fixed some problems with the loader which should have been fixed a long time ago.
Secondly I added some method stubs which one day will be used to create a XODETree from an ODE World and Space. In fact I implemented everything except the code to extract properties from the Geoms and Joints. This requires some changes to the Odejava core so the geometrical properties can be extracted (e.g. X,Y,Z lengths of a Box).
I don’t have an ETA on this, it’s on the back burner and will be worked on when I have the time (like I did today). I definitely want this feature added in, partially because this parser is the official XODE reference implementation so I want it to be as complete as it can be and partially because it would be useful to have.
Also, XODE trees should now be serializable using Java Serialization I think. I haven’t tested it so there are probably bugs, but I went though and made the classes serializable (i.e. implemented the Serializable interface, added the transient modifier when appropriate, etc…).
Will.