AlexMeng1986 / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

Create a file inspector for .blend and .bullet files, and improve parsing/writing such data #112

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

Added a sub project related to file loading.
It uses a different method of loading files than bParse.

Instead of recursively testing file to memory structures for
differences it builds an offset table.

This table is used to add file data to memory data in one pass.
Later the offset tables could be saved in the DNA file,
then the only potentially long lookup times will be when linking
the two tables together.

It also includes a file compiler, which can be used with a custom CMake
target during build time, so there is no need for separate
32 / 64 bit DNA files anymore.

The file inspector application uses this new interface to load / save
projects.

This has turned into a very lengthy project, but it is now in in a
semi - usable state.

Original issue reported on code.google.com by erwin.coumans on 12 Oct 2010 at 6:43

GoogleCodeExporter commented 9 years ago
See http://code.google.com/p/gamekit/source/detail?r=718

Original comment by erwin.coumans on 12 Oct 2010 at 6:44

GoogleCodeExporter commented 9 years ago
One of the challenges of the old bParse and makesdna is that it is hard to 
extend the file format with new user-defined DNA. For example, people might 
want to extend the .bullet format/DNA with user-data.

Does this File Binary Tables/FBT make this easier?

Is there an API to extend the DNA with user-data structs?

Original comment by erwin.coumans on 12 Oct 2010 at 6:48

GoogleCodeExporter commented 9 years ago
This should make it easy to extend user defined DNA now,

For instance if you wanted to extend bullet files with new data, you would take 
the Bullet.h file(s) add the new classes / structures needed, then recompile 
with the CMake macro ADD_FBT or ADD_FBT_VALIDATOR, the new changes would then 
be reflected in the compiled DNA. These become the memory lookup tables, during 
the file parse. 

ADD_FBT is the default macro which only compiles the tables, where as 
ADD_FBT_VALIDATOR adds an extra step in debugging, it asserts during compile 
time that type sizes are correctly calculated for the current platform.

It's still experimental, but the same could be done for .blend files.

To prevent data loss in the .blend, you would need to use the reflect function
http://code.google.com/p/gamekit/source/browse/trunk/Tools/FileTools/File/fbtFil
e.cpp#696
http://code.google.com/p/gamekit/source/browse/trunk/Tools/FileTools/FileFormats
/Blend/fbtBlend.cpp#125

then write your custom structures to the end of writeData

Original comment by snailr...@gmail.com on 12 Oct 2010 at 11:54