Sunday, August 19, 2007

opensim XML save/load spoiler

First a little rant: I officially dislike A-320 airplane. 8 hour flight with the feet in strange position such that the knees are almost hitting my ears does hurt. Also, if you pull the seat back, this further takes away from the person behind you. And to add to that, the headphones given out are borken, so even no way to get the consolation in music. pfff. Adding to that, the internet in the hotel "does not work". The latter was easy though. DHCP server went dead. a couple of manual tweaks - and I am online :-)

Anyway, enough noise - to the meat of the post...

Apparently the code to save/load the prims to/from XML is already there. So, I made a small hack to save the prims into XML file and load from there. Obviously besides the mere backup, it also gives the possibility for some funny experiments - e.g. fully algorithmically generated content, which can be imported.

The speed of import is not so great, and I think we will need to heavily optimize the routines later, but at least it works! :)

opensim-manyprims2

This is supposed to be 2500-prim-figure, with the function Z=sqrt(X*X+Y*Y). For some reason I thought it might be a sphere, but I think I forgot something somewhere - it obviously does not look like sphere.

opensim-manyprims

This one I like even more - 10000 prims :) Although, as you can see on both - apparently not all the prims "get through". There are also fancy errors on the console while importing the generated XML (not related to XML content), so maybe some stuff simply does not get imported.

I'll cleanup the code later on and then submit the patch.

UPD: Looks like even though there are errors, it still does get imported, here's a beautifum 2500-prim version, which sometimes loads fully into client, sometimes not:

opensim-manyprims3

And the patch itself is in the bug#294 (I did not thorougly test the code yet - only on standalone prims, the CLI is very very experimental and has to change).

UPD2: My half-assed patch went in, available in r1707. There are two CLI commands (not shown in the help as of now): "save-xml [filename]" and "load-xml [filename]". By default they save/load to/from "test.xml".

I will need to revamp the code to move it away from kind of "backup/restore" as it is now to "export/import" - backup/restore will need to be handled using the datastore infra which we already have.

2 comments:

Anonymous said...

You will tell us that you plan to make a tool for those algorythmicaly generated things? Or a tool for python generated things, like Blender has? In the later case, you would have opportunity to feel proud as one that made dandellion learn Python at last! :D

Dalien said...

I've used Ruby :)

http://pastebin.ca/663170 is the script to generate the xml for the pictures that I made.

Also, currently the prims are stored in the SQLite table (although not by default) - so, this is another way.

be it python, visual basic - does not matter much :)