Saving the scenegraph to the disk?

I’m currently building my world editor and i m loocking for a way to save
the scene graph (ie all under render and render2D) like pickling.
However on nodepath, pickling does not work perfectly.

Is there another way that to use the good scene editor d?

For example, i was thinking to use reflection to know the list of attribute of any nodepath then store the value of this attributes (in xml file) then restore it at runtime. Is it possible ? or will i fail in attribute inherited from the C part of the engine…

You can write out a bam file from almost any NodePath with, e.g.:


render.writeBamFile(Filename('scene.bam'))

Note that there are some nodes and attributes (like Cameras, for instance) that don’t write out to bam files very well, but most things you care about do.

The problem with a bam file is that it’s not a good place for long-term storage, since a new version of Panda may invalidate all old bam files. You can run the program bam2egg to convert it to an egg file, but this won’t pick up animated models. Also, bam files don’t store references to external files; instead, two different bam files that reference the same model will have a complete copy of that model.

For this reason, it might be better to design a level editor that builds up your scene using the Egg library, and then writes out an egg file. The SceneEditor that is supplied with Panda works in this way.

David

Is it ok if i use the scene editor for my game?(license , future compatibilty break ?)

Perfectly OK. The Panda SceneEditor is distributed under the Panda license, so there’s no license compatibility issues; and we do plan to support it indefinitely, so it won’t be going away any time soon.

This is not to be confused with the code in direct/src/leveleditor, which is not related to the Panda SceneEditor; the code in this directory will be going away soon.

David

looks like direct/src/leveleditor was part of a disney project…