#include <eggFile.h>
Inheritance diagram for EggFile:
Public Member Functions | |
EggFile () | |
void | from_command_line (EggData *data, const Filename &source_filename, const Filename &dest_filename, const string &egg_comment) |
Accepts the information about the egg file as supplied from the command line. | |
void | scan_textures () |
Scans the egg file for texture references and updates the _textures list appropriately. | |
void | get_textures (pset< TextureImage * > &result) const |
Fills up the indicated set with the set of textures referenced by this egg file. | |
void | pre_txa_file () |
Does some processing prior to scanning the .txa file. | |
void | match_txa_groups (const PaletteGroups &groups) |
Adds the indicated set of groups, read from the .txa file, to the set of groups to which the egg file is assigned. | |
void | post_txa_file () |
Once the egg file has been matched against all of the matching lines the .txa file, do whatever adjustment is necessary. | |
const PaletteGroups & | get_explicit_groups () const |
Returns the set of PaletteGroups that the egg file has been explicitly assigned to in the .txa file. | |
PaletteGroup * | get_default_group () const |
Returns the PaletteGroup that was specified as the default group on the command line at the time the egg file last appeared on the command line. | |
const PaletteGroups & | get_complete_groups () const |
Returns the complete set of PaletteGroups that the egg file is assigned to. | |
void | clear_surprise () |
Removes the 'surprise' flag; this file has been successfully matched against a line in the .txa file. | |
bool | is_surprise () const |
Returns true if this particular egg file is a 'surprise', i.e. | |
void | mark_stale () |
Marks this particular egg file as stale, meaning that something has changed, such as the location of a texture within its palette, which causes the egg file to need to be regenerated. | |
bool | is_stale () const |
Returns true if the egg file needs to be updated, i.e. | |
void | build_cross_links () |
Calls TextureImage::note_egg_file() and SourceTextureImage::increment_egg_count() for each texture the egg file references, and PaletteGroup::increment_egg_count() for each palette group it wants. | |
void | apply_properties_to_source () |
Calls apply_properties_to_source() for each texture reference, updating all the referenced source textures with the complete set of property information from this egg file. | |
void | choose_placements () |
Once all the textures have been assigned to groups (but before they may actually be placed), chooses a suitable TexturePlacement for each texture that appears in the egg file. | |
bool | has_data () const |
Returns true if the EggData for this EggFile has ever been loaded. | |
void | update_egg () |
Once all textures have been placed appropriately, updates the egg file with all the information to reference the new textures. | |
void | remove_egg () |
Removes this egg file from all things that reference it, in preparation for removing it from the database. | |
bool | read_egg () |
Reads in the egg file from its _source_filename. | |
bool | write_egg () |
Writes out the egg file to its _dest_filename. | |
void | write_description (ostream &out, int indent_level=0) const |
Writes a one-line description of the egg file and its group assignments to the indicated output stream. | |
void | write_texture_refs (ostream &out, int indent_level=0) const |
Writes the list of texture references to the indicated output stream, one per line. | |
virtual void | write_datagram (BamWriter *writer, Datagram &datagram) |
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file. | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written. | |
virtual TypeHandle | get_type () const |
virtual void | finalize () |
virtual TypeHandle | force_init_type (void) |
int | get_type_index () const |
bool | is_of_type (TypeHandle handle) const |
bool | is_exact_type (TypeHandle handle) const |
void | set_name (const string &name) |
void | clear_name () |
bool | has_name () const |
const string & | get_name () const |
void | output (ostream &out) const |
Static Public Member Functions | |
void | register_with_read_factory () |
Registers the current object as something that can be read from a Bam file. | |
TypeHandle | get_class_type () |
void | init_type () |
Static Public Attributes | |
TypedWritable *const | Null |
Protected Member Functions | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram(). | |
Static Protected Member Functions | |
TypedWritable * | make_EggFile (const FactoryParams ¶ms) |
This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read. | |
Protected Attributes | |
string | _name |
Private Types | |
typedef pvector< TextureReference * > | Textures |
Private Member Functions | |
void | remove_backstage (EggGroupNode *node) |
Recursively walks the egg hierarchy and removes any "backstage" nodes found from the scene graph completely. | |
Private Attributes | |
EggData * | _data |
Filename | _current_directory |
Filename | _source_filename |
Filename | _dest_filename |
string | _egg_comment |
Textures | _textures |
bool | _first_txa_match |
PaletteGroups | _explicitly_assigned_groups |
PaletteGroup * | _default_group |
PaletteGroups | _complete_groups |
bool | _is_surprise |
bool | _is_stale |
int | _num_textures |
Static Private Attributes | |
TypeHandle | _type_handle |
It may reference a number of textures, and may also be assigned to a number of groups. All of its textures will try to assign themselves to one of its groups.
Definition at line 54 of file eggFile.h.
|
|
|
Definition at line 52 of file eggFile.cxx. References _first_txa_match. |
|
Calls apply_properties_to_source() for each texture reference, updating all the referenced source textures with the complete set of property information from this egg file.
Definition at line 416 of file eggFile.cxx. References _textures. |
|
Calls TextureImage::note_egg_file() and SourceTextureImage::increment_egg_count() for each texture the egg file references, and PaletteGroup::increment_egg_count() for each palette group it wants. This sets up some of the back references to support determining an ideal texture assignment. Definition at line 367 of file eggFile.cxx. References get_complete_groups(), TextureImage::get_groups(), Namable::get_name(), nout, and PaletteGroups::write(). |
|
Once all the textures have been assigned to groups (but before they may actually be placed), chooses a suitable TexturePlacement for each texture that appears in the egg file. This will be necessary to do at some point before writing out the egg file anyway, and doing it before the textures are placed allows us to decide what the necessary UV range is for each to-be-placed texture. Definition at line 447 of file eggFile.cxx. References _current_directory, _data, _egg_comment, _source_filename, DSearchPath::append_directory(), EggData::begin(), Filename::empty(), Filename::exists(), EggData::insert(), EggData::load_externals(), nassertr, nout, NULL, EggData::read(), remove_backstage(), and EggData::resolve_filenames(). |
|
Removes the 'surprise' flag; this file has been successfully matched against a line in the .txa file.
Definition at line 289 of file eggFile.cxx. References _complete_groups, _default_group, _explicitly_assigned_groups, PaletteGroups::clear(), PaletteGroups::insert(), and PaletteGroups::make_complete(). |
|
Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written. The return value is the number of pointers processed from the list. Reimplemented from TypedWritable. Definition at line 792 of file eggFile.cxx. |
|
Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().
Reimplemented from TypedWritable. Definition at line 852 of file eggFile.cxx. Referenced by write_texture_refs(). |
|
Accepts the information about the egg file as supplied from the command line.
Definition at line 71 of file eggFile.cxx. References _current_directory, _default_group, _dest_filename, _egg_comment, _source_filename, and pal. |
|
Reimplemented from Namable. |
|
Returns the complete set of PaletteGroups that the egg file is assigned to. This is the set of all the groups it is explicitly assigned to, plus all the groups that these groups depend on. Definition at line 274 of file eggFile.cxx. Referenced by build_cross_links(), and is_stale(). |
|
Returns the PaletteGroup that was specified as the default group on the command line at the time the egg file last appeared on the command line.
Definition at line 255 of file eggFile.cxx. References _is_stale. |
|
Returns the set of PaletteGroups that the egg file has been explicitly assigned to in the .txa file.
Definition at line 238 of file eggFile.cxx. References _is_surprise. |
|
Fills up the indicated set with the set of textures referenced by this egg file. It is the user's responsibility to ensure the set is empty before making this call; otherwise, the new textures will be appended to the existing set. Definition at line 163 of file eggFile.cxx. References _explicitly_assigned_groups, _first_txa_match, PaletteGroups::clear(), and PaletteGroups::make_union(). |
|
Reimplemented from TypedWritable. |
|
Returns true if the EggData for this EggFile has ever been loaded.
Definition at line 501 of file eggFile.cxx. |
|
Reimplemented from Namable. Definition at line 134 of file eggFile.h. References _type_handle. |
|
Returns true if the egg file needs to be updated, i.e. some palettizations have changed affecting it, or false otherwise. Definition at line 342 of file eggFile.cxx. References _textures, PaletteGroups::count(), get_complete_groups(), TexturePlacement::get_group(), TextureImage::get_groups(), TextureReference::get_placement(), TextureReference::get_texture(), PaletteGroups::make_intersection(), and NULL. Referenced by update_egg(). |
|
Returns true if this particular egg file is a 'surprise', i.e. it wasn't matched by a line in the .txa file that didn't include the keyword 'cont'. Definition at line 306 of file eggFile.cxx. |
|
This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.
Definition at line 829 of file eggFile.cxx. |
|
Marks this particular egg file as stale, meaning that something has changed, such as the location of a texture within its palette, which causes the egg file to need to be regenerated.
Definition at line 325 of file eggFile.cxx. References _textures, and TextureReference::apply_properties_to_source(). |
|
Adds the indicated set of groups, read from the .txa file, to the set of groups to which the egg file is assigned.
Definition at line 197 of file eggFile.cxx. References _explicitly_assigned_groups. |
|
Once the egg file has been matched against all of the matching lines the .txa file, do whatever adjustment is necessary.
Definition at line 224 of file eggFile.cxx. References _complete_groups. |
|
Does some processing prior to scanning the .txa file.
Definition at line 179 of file eggFile.cxx. |
|
Reads in the egg file from its _source_filename. It is only valid to call this if it has not already been read in, e.g. from the command line. Returns true if successful, false if there is an error. Definition at line 561 of file eggFile.cxx. References EggGroupNode::iterator. |
|
Registers the current object as something that can be read from a Bam file.
Definition at line 730 of file eggFile.cxx. |
|
Recursively walks the egg hierarchy and removes any "backstage" nodes found from the scene graph completely. These aren't part of the egg scene anyway, and removing them early helps reduce confusion. Definition at line 694 of file eggFile.cxx. References _current_directory, _dest_filename, _egg_comment, Palettizer::_read_pi_version, _source_filename, and DatagramIterator::get_string(). Referenced by choose_placements(). |
|
Removes this egg file from all things that reference it, in preparation for removing it from the database.
Definition at line 537 of file eggFile.cxx. References _textures, and TextureReference::write(). |
|
Scans the egg file for texture references and updates the _textures list appropriately. This assumes the egg file was supplied on the command line and thus the _data member is available. Definition at line 114 of file eggFile.cxx. |
|
Once all textures have been placed appropriately, updates the egg file with all the information to reference the new textures.
Definition at line 518 of file eggFile.cxx. References _default_group, _explicitly_assigned_groups, PaletteGroups::empty(), Namable::get_name(), indent(), is_stale(), and NULL. |
|
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.
Reimplemented from TypedWritable. Definition at line 748 of file eggFile.cxx. |
|
Writes a one-line description of the egg file and its group assignments to the indicated output stream.
Definition at line 642 of file eggFile.cxx. References _default_group, _explicitly_assigned_groups, _num_textures, _textures, PaletteGroups::complete_pointers(), TypedWritable::complete_pointers(), DCAST_INTO_R, and NULL. |
|
Writes out the egg file to its _dest_filename. Returns true if successful, false if there is an error. Definition at line 614 of file eggFile.cxx. |
|
Writes the list of texture references to the indicated output stream, one per line.
Definition at line 669 of file eggFile.cxx. References fillin(), params, and parse_params(). |
|
Definition at line 109 of file eggFile.h. Referenced by clear_surprise(), and post_txa_file(). |
|
Definition at line 98 of file eggFile.h. Referenced by choose_placements(), from_command_line(), and remove_backstage(). |
|
Definition at line 97 of file eggFile.h. Referenced by choose_placements(), and has_data(). |
|
Definition at line 108 of file eggFile.h. Referenced by clear_surprise(), from_command_line(), update_egg(), and write_description(). |
|
Definition at line 100 of file eggFile.h. Referenced by from_command_line(), and remove_backstage(). |
|
Definition at line 101 of file eggFile.h. Referenced by choose_placements(), from_command_line(), and remove_backstage(). |
|
Definition at line 107 of file eggFile.h. Referenced by clear_surprise(), get_textures(), match_txa_groups(), update_egg(), and write_description(). |
|
Definition at line 106 of file eggFile.h. Referenced by EggFile(), and get_textures(). |
|
Definition at line 111 of file eggFile.h. Referenced by get_default_group(), and has_data(). |
|
Definition at line 110 of file eggFile.h. Referenced by get_explicit_groups(). |
|
Definition at line 128 of file eggFile.h. Referenced by write_description(). |
|
Definition at line 99 of file eggFile.h. Referenced by choose_placements(), from_command_line(), and remove_backstage(). |
|
Definition at line 104 of file eggFile.h. Referenced by apply_properties_to_source(), is_stale(), mark_stale(), remove_egg(), write_description(), and write_egg(). |
|
Reimplemented from Namable. Definition at line 42 of file eggFile.cxx. Referenced by init_type(). |