I don't think it's fair to say that you managed to do in 350 lines of code what the other guy did in 2000 - let's keep in mind that he has a working loader and you are asking for the file format to be modified. All too often with "it's so easy" methods, they trade flexibility for less coding and end up limited to certain use cases.
However, I can see that a little work from me will save you a lot of time (and this issue has also come up with Java loaders using the same concept of rigid class mappings), so I will add an option to skip the shortening of zero-values in the next update. If you can let me know the OS you're using then I'll get you a preview build as soon as it's ready.
Apart from the niggling feeling that modifying the format to accommodate the shortcomings of one loader implementation is backwards, it does worry me a bit that I am opening the door for something that will need to be continually chased around after in future. For example, when new properties are added, will they confuse the loader again and require further options to be set up?
Even for the current case, I am not sure if this one change will be sufficient - is this the only property where you have trouble? Have you successfully loaded a file that has those values replaced with the full property? How about custom properties, which depend on having only some properties present, and should not have default values initialized for the properties that do not exist... for example, these are both valid custom properties:
Code: Select all
{
"name": "timeout",
"float": 2.5
}
{
"name": "breakable",
"bool": true
}
I don't know the details of how the class template works, but I am guessing it would not like this either...
I have been meaning to make a scene which has every possible feature in it (every fixture type, every joint type, all custom property types etc), that people writing loaders could use to check if their implementation is correct. I'll see if I can get that done soon too, maybe it will help us find anything else that needs to be handled.
About converting the file by some kind of script, on Linux (and probably Mac too), you could use this to replace the position elements with the full version:
Code: Select all
sed 's/\"position\" *: *0/\"position\":\{\"x\":0.0,\"y\":0.0\}/' inputfile > outputfile
There is a win32 port of sed that you might be able to use on Windows too. You could set this up to run automatically after the raw info file is exported by using a system hook. Search for "system hooks" in the help for details on that.