BamWriter
from panda3d.core import BamWriter
- class BamWriter
Bases:
BamEnums
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by a BamReader.
A Bam file can be thought of as a linear collection of objects. Each object is an instance of a class that inherits, directly or indirectly, from TypedWritable. The objects may include pointers to other objects; the BamWriter automatically manages these (with help from code within each class) and writes all referenced objects to the file in such a way that the pointers may be correctly restored later.
This is the abstract interface and does not specifically deal with disk files, but rather with a DatagramSink of some kind, which simply accepts a linear stream of Datagrams. It is probably written to a disk file, but it might conceivably be streamed directly to a network or some such nonsense.
Bam files are most often used to store scene graphs or subgraphs, and by convention they are given filenames ending in the extension “.bam” when they are used for this purpose. However, a Bam file may store any arbitrary list of TypedWritable objects; in this more general usage, they are given filenames ending in “.boo” to differentiate them from the more common scene graph files.
See also BamFile, which defines a higher-level interface to read and write Bam files on disk.
Inheritance diagram
- __init__(*args, **kwargs)
- file_endian
- file_stdfloat_double
- file_texture_mode
- file_version
- filename
- flush()
C++ Interface: flush(const BamWriter self)
- /**
Ensures that all data written thus far is manifested on the output stream.
*/
- getFileEndian()
C++ Interface: get_file_endian(BamWriter self)
- /**
Returns the endian preference indicated by the Bam file currently being
written. This does not imply that every number is stored using the
indicated convention, but individual objects may choose to respect this
flag when recording data.
*/
- getFileMajorVer()
C++ Interface: get_file_major_ver(BamWriter self)
- /**
Returns the major version number of the Bam file currently being written.
*/
- getFileMinorVer()
C++ Interface: get_file_minor_ver(BamWriter self)
- /**
Returns the minor version number of the Bam file currently being written.
*/
- getFileStdfloatDouble()
C++ Interface: get_file_stdfloat_double(BamWriter self)
- /**
Returns true if the file will store all “standard” floats as 64-bit
doubles, or false if they are 32-bit floats. This isn’t runtime settable;
it’s based on the compilation flags of the version of Panda that generated
this file.
*/
- getFileTextureMode()
C++ Interface: get_file_texture_mode(BamWriter self)
- /**
Returns the BamTextureMode preference indicated by the Bam file currently
being written. Texture objects written to this Bam file will be encoded
according to the specified mode.
*/
- getFilename()
C++ Interface: get_filename(BamWriter self)
- /**
If a BAM is a file, then the BamWriter should contain the name of the file.
This enables the writer to convert pathnames in the BAM to relative to the
directory containing the BAM.
*/
- getRootNode()
C++ Interface: get_root_node(BamWriter self)
- /**
Returns the root node of the part of the scene graph we are currently
writing out. This is used for determining what to make NodePaths relative
to.
*/
- getTarget()
C++ Interface: get_target(const BamWriter self)
- /**
Returns the current target of the BamWriter as set by set_target() or the
constructor.
*/
- get_file_endian()
C++ Interface: get_file_endian(BamWriter self)
- /**
Returns the endian preference indicated by the Bam file currently being
written. This does not imply that every number is stored using the
indicated convention, but individual objects may choose to respect this
flag when recording data.
*/
- get_file_major_ver()
C++ Interface: get_file_major_ver(BamWriter self)
- /**
Returns the major version number of the Bam file currently being written.
*/
- get_file_minor_ver()
C++ Interface: get_file_minor_ver(BamWriter self)
- /**
Returns the minor version number of the Bam file currently being written.
*/
- get_file_stdfloat_double()
C++ Interface: get_file_stdfloat_double(BamWriter self)
- /**
Returns true if the file will store all “standard” floats as 64-bit
doubles, or false if they are 32-bit floats. This isn’t runtime settable;
it’s based on the compilation flags of the version of Panda that generated
this file.
*/
- get_file_texture_mode()
C++ Interface: get_file_texture_mode(BamWriter self)
- /**
Returns the BamTextureMode preference indicated by the Bam file currently
being written. Texture objects written to this Bam file will be encoded
according to the specified mode.
*/
- get_filename()
C++ Interface: get_filename(BamWriter self)
- /**
If a BAM is a file, then the BamWriter should contain the name of the file.
This enables the writer to convert pathnames in the BAM to relative to the
directory containing the BAM.
*/
- get_root_node()
C++ Interface: get_root_node(BamWriter self)
- /**
Returns the root node of the part of the scene graph we are currently
writing out. This is used for determining what to make NodePaths relative
to.
*/
- get_target()
C++ Interface: get_target(const BamWriter self)
- /**
Returns the current target of the BamWriter as set by set_target() or the
constructor.
*/
- hasObject()
C++ Interface: has_object(BamWriter self, const TypedWritable obj)
- /**
Returns true if the object has previously been written (or at least
requested to be written) to the bam file, or false if we’ve never heard of
it before.
*/
- has_object()
C++ Interface: has_object(BamWriter self, const TypedWritable obj)
- /**
Returns true if the object has previously been written (or at least
requested to be written) to the bam file, or false if we’ve never heard of
it before.
*/
- init()
C++ Interface: init(const BamWriter self)
- /**
Initializes the BamWriter prior to writing any objects to its output
stream. This includes writing out the Bam header.
This returns true if the BamWriter successfully initialized, false
otherwise.
*/
- root_node
- setFileMinorVer()
C++ Interface: set_file_minor_ver(const BamWriter self, int minor_ver)
- /**
Changes the minor .bam version to write. This should be called before
init(). Each Panda version has only a fairly narrow range of versions it
is able to write; consult the .bam documentation for more information.
*/
- setFileTextureMode()
C++ Interface: set_file_texture_mode(const BamWriter self, int file_texture_mode)
- /**
Changes the BamTextureMode preference for the Bam file currently being
written. Texture objects written to this Bam file will be encoded
according to the specified mode.
This should be called after the call to init(), or it will be overwritten
with the default mode in the config file.
*/
- setRootNode()
C++ Interface: set_root_node(const BamWriter self, TypedWritable root_node)
- /**
Sets the root node of the part of the scene graph we are currently writing
out. NodePaths written to this bam file will be relative to this node.
*/
- setTarget()
C++ Interface: set_target(const BamWriter self, DatagramSink target)
- /**
Changes the destination of future datagrams written by the BamWriter. This
also implicitly calls init() if it has not already been called.
*/
- set_file_minor_ver()
C++ Interface: set_file_minor_ver(const BamWriter self, int minor_ver)
- /**
Changes the minor .bam version to write. This should be called before
init(). Each Panda version has only a fairly narrow range of versions it
is able to write; consult the .bam documentation for more information.
*/
- set_file_texture_mode()
C++ Interface: set_file_texture_mode(const BamWriter self, int file_texture_mode)
- /**
Changes the BamTextureMode preference for the Bam file currently being
written. Texture objects written to this Bam file will be encoded
according to the specified mode.
This should be called after the call to init(), or it will be overwritten
with the default mode in the config file.
*/
- set_root_node()
C++ Interface: set_root_node(const BamWriter self, TypedWritable root_node)
- /**
Sets the root node of the part of the scene graph we are currently writing
out. NodePaths written to this bam file will be relative to this node.
*/
- set_target()
C++ Interface: set_target(const BamWriter self, DatagramSink target)
- /**
Changes the destination of future datagrams written by the BamWriter. This
also implicitly calls init() if it has not already been called.
*/
- target
- writeObject()
C++ Interface: write_object(const BamWriter self, const TypedWritable obj)
- /**
Writes a single object to the Bam file, so that the
BamReader::read_object() can later correctly restore the object and all its
pointers.
This implicitly also writes any additional objects this object references
(if they haven’t already been written), so that pointers may be fully
resolved.
This may be called repeatedly to write a sequence of objects to the Bam
file, but typically (especially for scene graph files, indicated with the
.bam extension), only one object is written directly from the Bam file: the
root of the scene graph. The remaining objects will all be written
recursively by the first object.
Returns true if the object is successfully written, false otherwise.
*/
- write_object()
C++ Interface: write_object(const BamWriter self, const TypedWritable obj)
- /**
Writes a single object to the Bam file, so that the
BamReader::read_object() can later correctly restore the object and all its
pointers.
This implicitly also writes any additional objects this object references
(if they haven’t already been written), so that pointers may be fully
resolved.
This may be called repeatedly to write a sequence of objects to the Bam
file, but typically (especially for scene graph files, indicated with the
.bam extension), only one object is written directly from the Bam file: the
root of the scene graph. The remaining objects will all be written
recursively by the first object.
Returns true if the object is successfully written, false otherwise.
*/