Load()/save()

ceacy

19-01-2007 20:02:11

Hi,
I would like to save and restore ode state. I saw there was a class designed for that purpose, DotLoader, but it appears that it won't be implemented yet ...
As i really need it, i'm wishing to try to do it ; but there is a lot of things i don't know :/ :
- what is currently done, and what is still to do ?
- what xml format is planned to be used ? XODE ?
- what are these "ode save/load facilities" the roadmap mentions ?

Thanks you,
Ceacy.

tuan kuranes

20-01-2007 12:24:09

- what is currently done, and what is still to do ?
Done : Load vehicle, ragdoll, file containing both.
Todo : Load basic objects (cube, sphere, ... and compound, offset, transforms) and all Save function (not that hard, just mimic load method to a save method...)
- what xml format is planned to be used ? XODE ?
current OgreOde xml format...

- what are these "ode save/load facilities" the roadmap mentions ?
Ode has a save load that are not exposed in OgreODe:
dWorldExportDIF (dWorldID w, FILE *file, const char *world_name);
didn't tried it at all.

ceacy

20-01-2007 20:30:21

I tried dWorldExportDIF() : the output is in Lua syntax :
-- Dynamics Interchange Format v0.1

world = dynamics.world {
gravity = {0,-9.81,0},
ODE = {
ERP = 0.8,
CFM = 1e-04,
auto_disable = {
linear_threshold = 1e-04,
angular_threshold = 1e-04,
average_samples = 1,
idle_time = 0,
idle_steps = 10,
},
},
}
body = {}
body[0] = dynamics.body {
world = world,
pos = {1363.155,6.130237,506.8812},
q = {0.395462,0,0.9184823,0},
lvel = {0,-2.053758e-06,0},
avel = {0,0,0},
mass = 40,
I = {{1096.059,0,0},{0,666.2322,0},{0,0,1096.059}},
ODE = {
no_gravity = 1,
auto_disable = {
linear_threshold = 1e-04,
angular_threshold = 1e-04,
average_samples = 1,
idle_time = 0,
idle_steps = 10,
time_left = -0.05,
steps_left = 9,
},
},
geometry = {
{
type = "transform",
pos = {0,28.55529,0},
q = {0.7071068,0.7071067,0,0},
geometry = {
type = "capsule",
radius = 6.132689,
length = 32.57982,
}
},
},
}

It can't be used as-it, can it ?

Oh, and : is there a reference document for the .ogreode format ? And what are the parameters the save() and load() functions take ?

ObjectList *load(const Ogre::String &filename, const Ogre::StringVector &objects_names, const Ogre::StringVector &instance_names);
void save(const Ogre::String &filename, const Ogre::StringVector &objects_names, ObjectList *objects);


Lastly : when using the loader, do the user have to call setWorld() and setSpace() before anything else ? What is the use of the setSpace() function ? (loading inside a specific space ? for saving, does that change anything ?)

Thank you,
Ceacy.

tuan kuranes

22-01-2007 12:15:36

It can't be used as-it, can it ?

You'll have to make a diff parser so that it generates good OgreOde objects too...
is there a reference document for the .ogreode format ?
I don't think so. Sample file is the reference. But don't be afraid to extend/change it.
ObjectList *load(const Ogre::String &filename, const Ogre::StringVector &objects_names, const Ogre::StringVector &instance_names);
filename is xml file containing object(s)
objects_names would be type of ogreode object names ("vehicle, ragdoll, etc.") you want to instantiate
instance_names is name you want object instance to have

void save(const Ogre::String &filename, const Ogre::StringVector &objects_names, ObjectList *objects);
filename is xml file containing object(s)
objects_names would be type of ogreode object names ("vehicle, ragdoll, etc.") you want to instantiate
ObjectList is the list of object to save
when using the loader, do the user have to call setWorld() and setSpace() before anything else ?
yes.
What is the use of the setSpace() function ?
It just specify the space in which object will be loaded.

for saving, does that change anything ?
No, those two are unneeded for save

ceacy

22-01-2007 21:37:44

ObjectList *load(const Ogre::String &filename, const Ogre::StringVector &objects_names, const Ogre::StringVector &instance_names);
filename is xml file containing object(s)
objects_names would be type of ogreode object names ("vehicle, ragdoll, etc.") you want to instantiate
instance_names is name you want object instance to have
void save(const Ogre::String &filename, const Ogre::StringVector &objects_names, ObjectList *objects);
filename is xml file containing object(s)
objects_names would be type of ogreode object names ("vehicle, ragdoll, etc.") you want to instantiate
ObjectList is the list of object to save

I don't really get it : to load objects, you have to know their type and names ? Or is objects_names filled with the names the parser will found ?