I’ m still fancing to have a kind of serialization system for the scenegraph object.
Like being able to pickle a nodepath and/or a node and unpickle it ready to use.
As i remember there was one issue because python object was not stored.
Now there is setPythonTag.
if i do
x = Actor(yada yada)
and then a pickle of x, will i be able to restore it after?
There is a serialization system built into panda — in fact, BAM files are serialized scene graph trees. But the serialization system is for more than just storing nodes - you’re also supposed to be able to send them back and forth via socket and the like.
I haven’t studied the serialization APIs much, but you’ll find that almost every panda object contains these methods:
static void register_with_read_factory();
virtual void write_datagram(BamWriter *manager, Datagram &dg);
virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
static TypedWritable *make_from_bam(const FactoryParams ¶ms);
void fillin(DatagramIterator &scan, BamReader *manager);
I believe that these are all related to the serialization (and unserialization) process. Also, the classes “BamReader,” “BamWriter,” and “BamFile” are all potentially useful.
Just a question concerning backward compatibilty.
If i Bamify an object with Panda 1.0 and something change in bam in Panda 1.5.
can i Bam=>Egg in panda 1.0 then egg=>Bam in panda 1.5 to be able to reuse my objects (here a scenegraph)?
ie is there backward compatibility for egg file? for bam file?
Very good question indeed! Though I guess it’s difficult to forsee what v1.5 will bring - that’s approx. 16 months off, after all!
Also interesting to note that there’s also bam2egg, for no particular reason I always imagined BAM to be a dead end - maybe I just mixed it up with “BAM, you’re dead!”
Ok so i’ve tried Bam to save my scenegraph via this function:
I manage to save and view in pview scenegraph with Models & Actors.
However i still no manage to save scenegraph with lights in.
I got a deprecated LigthAttrib warnings at saving time
and Pview does some memory read errors before crashing at loading time.
So i will still work to fix the SceneEditor. … Very Usefull but you need a relaxin pill when you use because of the so many cases where a click oout of the focused windows simply crash the Editor!!!
Unfortunately, bam2egg is a bit of a hack. There’s a lot of data loss.