15 #ifndef PALETTEGROUP_H
16 #define PALETTEGROUP_H
18 #include "pandatoolbase.h"
20 #include "paletteGroups.h"
21 #include "textureProperties.h"
24 #include "typedWritable.h"
28 #include "vector_string.h"
100 int _dependency_level;
101 int _dependency_order;
130 bool _has_margin_override;
131 int _margin_override;
138 static void init_type() {
139 TypedWritable::init_type();
140 Namable::init_type();
141 register_type(_type_handle,
"PaletteGroup",
142 TypedWritable::get_class_type(),
143 Namable::get_class_type());
146 return get_class_type();
void setup_shadow_images()
Ensures that each PaletteImage's _shadow_image has the correct filename and image types...
void update_unknown_textures(const TxaFile &txa_file)
Checks for new information on any textures within the group for which some of the saved information i...
bool has_margin_override() const
Returns the set of groups this group depends on.
const PaletteGroups & get_groups() const
Returns the set of groups this group depends on.
void optimal_resize()
Attempts to resize each PalettteImage down to its smallest possible size.
void place_all()
Once all the textures have been assigned to this group, try to place them all onto suitable PaletteIm...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
bool is_none_texture_swap() const
Returns textureswap information is set or not, True if it's not set.
Base class for objects that can be written to and read from Bam files.
This is the highest level of grouping for TextureImages.
void unplace(TexturePlacement *placement)
Removes the texture from its position on a PaletteImage, if it has been so placed.
int get_dirname_order() const
Returns the dependency order of this group.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void group_with(PaletteGroup *other)
Indicates a dependency of this group on some other group.
This is a particular collection of textures, within a PaletteGroup, that all share the same TexturePr...
void add_texture_swap_info(const string sourceTextureName, const vector_string &swapTextures)
Store textureswap information from textures.txa.
void write_image_info(ostream &out, int indent_level=0) const
Writes a list of the PaletteImages associated with this group, and all of their textures, to the indicated output stream.
void reset_dependency_level()
Unconditionally sets the dependency level and order of this group to zero, in preparation for a later...
bool is_preferred_over(const PaletteGroup &other) const
Returns true if this group should be preferred for adding textures over the other group...
A base class for all things which can have a name.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This corresponds to a particular assignment of a TextureImage with a PaletteGroup, and specifically describes which PaletteImage (if any), and where on the PaletteImage, the TextureImage has been assigned to.
int get_margin_override() const
Returns the set of groups this group depends on.
void update_images(bool redo_all)
Regenerates each PaletteImage on this group that needs it.
int get_dependency_order() const
Returns the dependency order of this group.
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...
void set_dependency_level(int level)
Sets the dependency level of this group to the indicated level, provided that level is not lower than...
PalettePage * get_page(const TextureProperties &properties)
Returns the page associated with the indicated properties.
void set_dirname(const string &dirname)
Sets the directory name associated with the palette group.
const string & get_dirname() const
Returns the directory name associated with the palette group.
int get_dependency_level() const
Returns the dependency level of this group.
void reset_images()
Throws away all of the current PaletteImages, so that new ones may be created (and the packing made m...
bool set_dependency_order()
Updates the dependency order of this group.
void get_complete_placements(pvector< TexturePlacement * > &placements) const
Adds the set of TexturePlacements associated with this group and all dependent groups to the indicate...
void increment_egg_count()
Increments by one the number of egg files that are known to reference this PaletteGroup.
virtual void finalize(BamReader *manager)
This method is called by the BamReader after all pointers everywhere in the world have been completel...
TexturePlacement * prepare(TextureImage *texture)
Marks the indicated Texture as ready for placing somewhere within this group, and returns a placehold...
A class to retrieve the individual data elements previously stored in a Datagram. ...
This represents a single source texture that is referenced by one or more egg files.
int get_egg_count() const
Returns the number of egg files that share this PaletteGroup.
TypeHandle is the identifier used to differentiate C++ class types.
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.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
bool has_dirname() const
Returns true if the directory name has been explicitly set for this group.
void clear_depends()
Eliminates all the dependency information for this group.
void get_placements(pvector< TexturePlacement * > &placements) const
Adds the set of TexturePlacements associated with this group to the indicated vector.
This represents a single egg file known to the palettizer.
This represents the .txa file (usually textures.txa) that contains the user instructions for resizing...
void set_margin_override(const int override)
Returns the set of groups this group depends on.
This is the set of characteristics of a texture that, if different from another texture, prevent the two textures from sharing a PaletteImage.