Palettes::PalettePage class

A page in an Palettes palette that contains multiple items (Palettes::PaletteItem).

Items are laid out in rows/columns of cells; each item has an icon that is displayed on its cell. Pages belong to a specific category (Palettes::PaletteCategory). A page can belong to a DLC group.

Base classes

class DefaultRefCounted
The default implementation of a reference counted class.
class Object
This class represents a basic reference counted object.

Public static variables

static const uint32_t TYPE

Constructors, destructors, conversion operators

PalettePage()
~PalettePage() virtual

Public functions

auto Load(const ResourceKey& name, uint32_t thumbnailGroupID, uint32_t arg_8 = 0, uint32_t layoutID = 0, uint32_t arg_10 = 0) -> bool
Loads a page from the .prop file specified, as well as all its items.
auto ReadProp(const ResourceKey& name, uint32_t layoutID = 0) -> bool
Loads the configuration .prop file of this page; this does not load the items contained on it.
auto ReadItemsModule(const ResourceKey& pageName, const ResourceKey& moduleName, uint32_t thumbnailGroupID) -> void
Reads a .prop file that contains items contained in this page.
auto GetItemAt(size_t nIndex) -> PaletteItem*
Returns the palette item at the given index.
auto AddRef() -> int override
auto Release() -> int override
auto Cast(uint32_t) const -> void* override

Public variables

uint32_t mLayoutID
The instance ID of the layout file that will be used in this page.
uint32_t mDefaultUIClassID
The UI class ID given by default to items that are not .prop files or they don't define the 'paletteItemUIClassId' property.
float mfItemHeight
The height of each item in the page, in pixels.
float mfItemWidth
The width of each item in the page, in pixels.
float mfHorizontalOffset
The horizontal offset which item icons are moved relative to their respective cells, in pixels.
float mfVerticalOffset
The vertical offset which item icons are moved relative to their respective cells, in pixels.
float mfHorizontalSpacing
The horizontal spacing left between cells, in pixels.
float mfVerticalSpacing
The vertical spacing left between cells, in pixels.
bool mbIgnoreOverrideThumbnailGroup
bool mbNoResolutionScale
Math::Rectangle mBorder
Interior blank space in the page borders, in pixels.
float mfItemPercentageWidth
A value that scales items horizontally, relative to their cells' width.
float mfItemAspectRatio
bool mbUseRelativeLayout
bool mbUseAbsoluteItemSize
bool mbUseAbsoluteBorderSizes
If true, the values in the mBorder field are measured in pixels, otherwise they are a fraction of the panel size.
float mfItemMaxPercentageHeight
A value that scales items vertically, relative to their cells' height.
int mnNumRows
The number of rows of items can fit in the page; that is, how many items fit vertically.
int mnNumColumns
The number of columns of items can fit in the page; that is, how many items fit horizontally.
uint32_t mnSequenceNumber
An integer number that defines the order of this page inside the category.
uint32_t mSetID
The ID of the DLC group this page belongs to (0x00000001 is the base game).
int field_60
ResourceKey mParentCategory
The ResourceKey of the category this page belongs to.
eastl::vector<PaletteItemPtr> mItems
The items contained in this page, ordered by columns.

Function documentation

bool Palettes::PalettePage::Load(const ResourceKey& name, uint32_t thumbnailGroupID, uint32_t arg_8 = 0, uint32_t layoutID = 0, uint32_t arg_10 = 0)

Loads a page from the .prop file specified, as well as all its items.

Parameters
name The ResourceKey that points to the .prop file of the page.
thumbnailGroupID The ID of the folder that contains the icons for the parts in the palette, such as 0x02231C8B ('CreaturePartIcons~').
arg_8
layoutID The instance ID of the layout file that the page will use. If this is specified, the property 'palettePageLayoutFile' will be ignored.
arg_10
Returns True if the .prop file existed and was read, false otherwise.

The items are loaded from different .prop files contained in a specific folder; the ID of that folder is calculated in the following expression: (groupID & 0x00FF00FF) | 0x40006D00, where 'groupID' is the group ID of the .prop file of the palette page being loaded.

bool Palettes::PalettePage::ReadProp(const ResourceKey& name, uint32_t layoutID = 0)

Loads the configuration .prop file of this page; this does not load the items contained on it.

Parameters
name The ResourceKey that points to the .prop file.
layoutID The instance ID of the layout file that the page will use. If this is specified, the property 'palettePageLayoutFile' will be ignored.
Returns True if the .prop file existed and was read, false otherwise.

palettePageNumRows * palettePageNumColumns will be allocated in the vector field 'mItems' (all the values will be nullptr, however).

void Palettes::PalettePage::ReadItemsModule(const ResourceKey& pageName, const ResourceKey& moduleName, uint32_t thumbnailGroupID)

Reads a .prop file that contains items contained in this page.

Parameters
pageName The ResourceKey of the .prop file of the page.
moduleName The ResourceKey of the .prop file of the items module.
thumbnailGroupID The group ID where the icons of the items are stored.

PaletteItem* Palettes::PalettePage::GetItemAt(size_t nIndex)

Returns the palette item at the given index.

Parameters
nIndex

The behaviour is undefined if the index is out of bounds.

Variable documentation

uint32_t Palettes::PalettePage::mLayoutID

The instance ID of the layout file that will be used in this page.

By default it's 0xD8006607.

float Palettes::PalettePage::mfHorizontalOffset

The horizontal offset which item icons are moved relative to their respective cells, in pixels.

For example, an offset of 2 means the item icon will be displayed at X + 2 from where it should be.

float Palettes::PalettePage::mfVerticalOffset

The vertical offset which item icons are moved relative to their respective cells, in pixels.

For example, an offset of 2 means the item icon will be displayed at Y + 2 from where it should be.

int Palettes::PalettePage::mnNumRows

The number of rows of items can fit in the page; that is, how many items fit vertically.

Items in coordinates that exceed these limitations will not be displayed. The page space will be vertically divided in this number of cells.

int Palettes::PalettePage::mnNumColumns

The number of columns of items can fit in the page; that is, how many items fit horizontally.

Items in coordinates that exceed these limitations will not be displayed. The page space will be horizontally divided in this number of cells.

uint32_t Palettes::PalettePage::mnSequenceNumber

An integer number that defines the order of this page inside the category.

Pages with lower sequence number go first.

eastl::vector<PaletteItemPtr> Palettes::PalettePage::mItems

The items contained in this page, ordered by columns.

The index of a certain cell is mnNumRows * column + row. If the item is nullptr, the corresponding cell is left blank.