Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
EggFile Class Reference

This represents a single egg file known to the palettizer. More...

`#include "eggFile.h"`

Inheritance diagram for EggFile:

## Public Member Functions
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 | 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 | 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.
void | clear_surprise ()
| Removes the 'surprise' flag; this file has been successfully matched against a line in the .txa 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.
bool | from_command_line (EggData *data, const Filename &source_filename, const Filename &dest_filename, const std::string &egg_comment)
| Accepts the information about the egg file as supplied from the command line.
const PaletteGroups & | get_complete_groups () const
| Returns the complete set of PaletteGroups that the egg file is assigned to.
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_explicit_groups () const
| Returns the set of PaletteGroups that the egg file has been explicitly assigned to in the .txa file.
const Filename & | get_source_filename () const
| Returns the filename this egg file was read from.
void | get_textures (pset< TextureImage * > &result) const
| Fills up the indicated set with the set of textures referenced by this egg file.
virtual TypeHandle | get_type () const
bool | had_data () const
| Returns true if the EggData for this EggFile has ever been loaded in this session.
bool | has_data () const
| Returns true if the EggData for this EggFile has been loaded, and not yet released.
bool | is_stale () const
| Returns true if the egg file needs to be updated, i.e.
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.
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.
void | pre_txa_file ()
| Does some processing prior to scanning the .txa file.
bool | read_egg (bool noabs)
| Reads in the egg file from its _source_filename.
void | release_egg_data ()
| Releases the memory that was loaded by a previous call to read_egg().
void | remove_egg ()
| Removes this egg file from all things that reference it, in preparation for removing it from the database.
void | scan_textures ()
| Scans the egg file for texture references and updates the _textures list appropriately.
void | update_egg ()
| Once all textures have been placed appropriately, updates the egg file with all the information to reference the new textures.
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.
void | write_description (std::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.
bool | write_egg ()
| Writes out the egg file to its _dest_filename.
void | write_texture_refs (std::ostream &out, int indent_level=0) const
| Writes the list of texture references to the indicated output stream, one per line.
Public Member Functions inherited from TypedWritable
| TypedWritable (const TypedWritable &copy)
virtual ReferenceCount * | as_reference_count ()
| Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type.
vector_uchar | encode_to_bam_stream () const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object.
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
virtual void | finalize (BamReader *manager)
| Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.
virtual TypeHandle | force_init_type ()
UpdateSeq | get_bam_modified () const
| Returns the current bam_modified counter.
void | mark_bam_modified ()
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
void | operator= (const TypedWritable &copy)
virtual bool | require_fully_complete () const
| Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.
virtual void | update_bam_nested (BamWriter *manager)
| Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates.
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
int | get_best_parent_from_Set (const std::set< int > &) const
int | get_type_index () const
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from Namable
| Namable (const std::string &initial_name="")
void | clear_name ()
| Resets the Namable's name to empty.
const std::string & | get_name () const
bool | has_name () const
| Returns true if the Namable has a nonempty name set, false if the name is empty.
void | output (std::ostream &out) const
| Outputs the Namable.
void | set_name (const std::string &name)

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
static void | register_with_read_factory ()
| Registers the current object as something that can be read from a Bam file.
Static Public Member Functions inherited from TypedWritable
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
| Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes.
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
static TypeHandle | get_class_type ()
static void | init_type ()
| This function is declared non-inline to work around a compiler bug in g++ 2.96.
Static Public Member Functions inherited from Namable
static TypeHandle | get_class_type ()
static void | init_type ()

## Additional Inherited Members
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from Namable
| get_name
| set_name
Static Public Attributes inherited from TypedWritable
static TypedWritable *const | Null = nullptr

## Detailed Description

This represents a single egg file known to the palettizer.

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 36 of file eggFile.h.

## Constructor & Destructor Documentation

## ◆ EggFile()

EggFile::EggFile | ( |  | ) |

Definition at line 42 of file eggFile.cxx.

## Member Function Documentation

## ◆ apply_properties_to_source()

void EggFile::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.

Definition at line 363 of file eggFile.cxx.

## ◆ build_cross_links()

void EggFile::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.

This sets up some of the back references to support determining an ideal texture assignment.

Definition at line 324 of file eggFile.cxx.

References TextureImage::note_egg_file().

## ◆ choose_placements()

void EggFile::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.

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 380 of file eggFile.cxx.

References PaletteGroups::begin(), PaletteGroups::count(), PaletteGroups::empty(), get_complete_groups(), TextureImage::get_groups(), TextureImage::get_placement(), and PaletteGroups::make_intersection().

Referenced by Palettizer::read_stale_eggs().

## ◆ clear_surprise()

void EggFile::clear_surprise | ( |  | ) |

Removes the 'surprise' flag; this file has been successfully matched against a line in the .txa file.

Definition at line 284 of file eggFile.cxx.

Referenced by TxaLine::match_egg().

## ◆ complete_pointers()

int EggFile::complete_pointers | ( | TypedWritable ** | p_list,
|  | BamReader * | manager )
| virtual

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 739 of file eggFile.cxx.

References TypedWritable::complete_pointers().

## ◆ from_command_line()

bool EggFile::from_command_line | ( | EggData * | data,
|  | const Filename & | source_filename,
|  | const Filename & | dest_filename,
|  | const std::string & | egg_comment )

Accepts the information about the egg file as supplied from the command line.

Returns true if the egg file is valid, false otherwise.

Definition at line 56 of file eggFile.cxx.

References ExecutionEnvironment::get_cwd, and Filename::make_absolute().

## ◆ get_class_type()

static TypeHandle EggFile::get_class_type | ( |  | ) |
| inline static

Definition at line 119 of file eggFile.h.

## ◆ get_complete_groups()

const PaletteGroups & EggFile::get_complete_groups | ( |  | ) | const

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 275 of file eggFile.cxx.

Referenced by choose_placements(), and TextureImage::note_egg_file().

## ◆ get_default_group()

PaletteGroup * EggFile::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.

Definition at line 265 of file eggFile.cxx.

Referenced by TextureImage::write_source_pathnames().

## ◆ get_explicit_groups()

const PaletteGroups & EggFile::get_explicit_groups | ( |  | ) | const

Returns the set of PaletteGroups that the egg file has been explicitly assigned to in the .txa file.

Definition at line 256 of file eggFile.cxx.

Referenced by TextureImage::write_source_pathnames().

## ◆ get_source_filename()

const Filename & EggFile::get_source_filename | ( |  | ) | const

Returns the filename this egg file was read from.

Definition at line 90 of file eggFile.cxx.

Referenced by Palettizer::read_stale_eggs().

## ◆ get_textures()

void EggFile::get_textures | ( | pset< TextureImage * > & | result | ) | const

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 209 of file eggFile.cxx.

Referenced by Palettizer::process_all(), and Palettizer::process_command_line_eggs().

## ◆ get_type()

virtual TypeHandle EggFile::get_type | ( |  | ) | const
| inline virtual

Reimplemented from TypedWritable.

Definition at line 129 of file eggFile.h.

## ◆ had_data()

bool EggFile::had_data | ( |  | ) | const

Returns true if the EggData for this EggFile has ever been loaded in this session.

Definition at line 437 of file eggFile.cxx.

Referenced by Palettizer::read_stale_eggs(), and Palettizer::write_eggs().

## ◆ has_data()

bool EggFile::has_data | ( |  | ) | const

Returns true if the EggData for this EggFile has been loaded, and not yet released.

Definition at line 428 of file eggFile.cxx.

Referenced by Palettizer::write_eggs().

## ◆ init_type()

static void EggFile::init_type | ( |  | ) |
| inline static

Definition at line 122 of file eggFile.h.

## ◆ is_stale()

bool EggFile::is_stale | ( |  | ) | const

Returns true if the egg file needs to be updated, i.e.

some palettizations have changed affecting it, or false otherwise.

Definition at line 312 of file eggFile.cxx.

Referenced by Palettizer::read_stale_eggs(), and write_description().

## ◆ is_surprise()

bool EggFile::is_surprise | ( |  | ) | const

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 293 of file eggFile.cxx.

Referenced by Palettizer::report_pi().

## ◆ mark_stale()

void EggFile::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.

Definition at line 303 of file eggFile.cxx.

## ◆ match_txa_groups()

void EggFile::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.

Definition at line 230 of file eggFile.cxx.

Referenced by TxaLine::match_egg().

## ◆ post_txa_file()

void EggFile::post_txa_file | ( |  | ) |

Once the egg file has been matched against all of the matching lines the .txa file, do whatever adjustment is necessary.

Definition at line 248 of file eggFile.cxx.

Referenced by Palettizer::process_all(), and Palettizer::process_command_line_eggs().

## ◆ pre_txa_file()

void EggFile::pre_txa_file | ( |  | ) |

Does some processing prior to scanning the .txa file.

Definition at line 220 of file eggFile.cxx.

Referenced by Palettizer::process_all(), and Palettizer::process_command_line_eggs().

## ◆ read_egg()

bool EggFile::read_egg | ( | bool | noabs | ) |

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.

This may also be called after a previous call to release_egg_data(), in order to re-read the same egg file.

Definition at line 479 of file eggFile.cxx.

References DSearchPath::append_directory(), EggTextureCollection::find_used_textures(), FilenameUnifier::make_user_filename(), and EggTextureCollection::uniquify_trefs().

Referenced by Palettizer::read_stale_eggs(), and Palettizer::write_eggs().

## ◆ register_with_read_factory()

void EggFile::register_with_read_factory | ( |  | ) |
| static

Registers the current object as something that can be read from a Bam file.

Definition at line 696 of file eggFile.cxx.

References BamReader::get_factory().

Referenced by init_palettizer().

## ◆ release_egg_data()

void EggFile::release_egg_data | ( |  | ) |

Releases the memory that was loaded by a previous call to read_egg().

Definition at line 552 of file eggFile.cxx.

Referenced by Palettizer::read_stale_eggs(), and Palettizer::write_eggs().

## ◆ remove_egg()

void EggFile::remove_egg | ( |  | ) |

Removes this egg file from all things that reference it, in preparation for removing it from the database.

Definition at line 461 of file eggFile.cxx.

References TexturePlacement::remove_egg().

Referenced by Palettizer::read_stale_eggs(), and Palettizer::remove_egg_file().

## ◆ scan_textures()

void EggFile::scan_textures | ( |  | ) |

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 101 of file eggFile.cxx.

References EggTextureCollection::find_used_textures(), TextureReference::from_egg(), TextureReference::from_egg_quick(), TextureReference::has_uvs(), TextureReference::is_equivalent(), and EggTextureCollection::uniquify_trefs().

Referenced by Palettizer::process_all(), Palettizer::process_command_line_eggs(), and Palettizer::read_stale_eggs().

## ◆ update_egg()

void EggFile::update_egg | ( |  | ) |

Once all textures have been placed appropriately, updates the egg file with all the information to reference the new textures.

Definition at line 446 of file eggFile.cxx.

Referenced by Palettizer::write_eggs().

## ◆ write_datagram()

void EggFile::write_datagram | ( | BamWriter * | writer,
|  | Datagram & | datagram )
| virtual

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 706 of file eggFile.cxx.

References Datagram::add_bool(), Datagram::add_string(), Datagram::add_uint32(), FilenameUnifier::make_bam_filename(), TypedWritable::write_datagram(), and BamWriter::write_pointer().

## ◆ write_description()

void EggFile::write_description | ( | std::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.

Definition at line 590 of file eggFile.cxx.

References indent(), and is_stale().

Referenced by Palettizer::report_pi().

## ◆ write_egg()

bool EggFile::write_egg | ( |  | ) |

Writes out the egg file to its _dest_filename.

Returns true if successful, false if there is an error.

Definition at line 568 of file eggFile.cxx.

References FilenameUnifier::make_user_filename().

Referenced by Palettizer::write_eggs().

## ◆ write_texture_refs()

void EggFile::write_texture_refs | ( | std::ostream & | out,
|  | int | indent_level = 0 ) const

Writes the list of texture references to the indicated output stream, one per line.

Definition at line 611 of file eggFile.cxx.

Referenced by Palettizer::report_pi().

The documentation for this class was generated from the following files:

- pandatool/src/palettizer/eggFile.h
- pandatool/src/palettizer/eggFile.cxx