27 set_program_brief(
"convert a native Panda .bam file to an .egg file");
28 set_program_description
29 (
"This program converts native Panda bam files to egg. The conversion " 30 "is somewhat incomplete; running egg2bam followed by bam2egg should not " 31 "be expected to yield the same egg file you started with.");
35 "Specify the coordinate system of the input " + _format_name +
36 " file. By default, this is taken from the Config.prc file, which " 37 "is currently " + format_string(get_default_coordinate_system()) +
".");
39 _coordinate_system = get_default_coordinate_system();
49 if (!bam_file.
open_read(_input_filename)) {
50 nout <<
"Unable to read " << _input_filename <<
"\n";
54 nout << _input_filename <<
" : Bam version " 62 if (
object !=
nullptr &&
71 while (
object !=
nullptr || !bam_file.
is_eof()) {
72 if (
object !=
nullptr) {
74 if (ref_ptr !=
nullptr) {
77 objects.push_back(
object);
84 _data->set_coordinate_system(_coordinate_system);
86 if (objects.size() == 1 &&
87 objects[0]->is_of_type(PandaNode::get_class_type())) {
92 nout <<
"File does not contain a scene graph.\n";
99 int main(
int argc,
char *argv[]) {
The principle public interface to reading and writing Bam disk files.
A basic node of the scene graph or data graph.
bool open_read(const Filename &bam_filename, bool report_errors=true)
Attempts to open the indicated filename for reading.
bool is_exact_type(TypeHandle handle) const
Returns true if the current object is the indicated type exactly.
bool resolve()
This must be called after one or more objects have been read via calls to read_object() in order to r...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
int get_file_major_ver()
Returns the major version number of the file currently being read, or the system current major versio...
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void close()
Closes the input or output stream.
This is our own Panda specialization on the default STL vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool save_egg_data(EggData *data, PandaNode *node)
Another convenience function; works like save_egg_file() but populates an EggData instead of writing ...
bool is_eof() const
Returns true if the reader has reached end-of-file, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void write_egg_file()
Writes out the egg file as the normal result of the program.
void ref() const
Explicitly increments the reference count.
A base class for all things that want to be reference-counted.
This program reads a bam file, for instance as written out from a real-time interaction session,...
This is the general base class for a file-converter program that reads some model file format and gen...
int get_file_minor_ver()
Returns the minor version number of the file currently being read, or the system current minor versio...
TypedWritable * read_object()
Reads and returns the next object from the Bam file, or NULL if the end of the file has been reached,...