App::Thumbnail_cImportExport class

A class related with the .PNG files of creations.

It can be used to get the path to the My Spore Creations folder:

eastl::string16 path;
ThumbnailImportExport.GetFolderPath(TypeIDs::crt, path);
// Now path is something like 'C:\Users\...\My Documents\My Spore Creations\Creatures'

You can also use it to save a Resource::ResourceObject into a .png with Thumbnail_cImportExport::SavePNG()

Base classes

class IUnmanagedMessageListener
Same as App::IMessageListener, but this one does not use ref-counting.

Public static functions

static auto Get() -> Thumbnail_cImportExport*

Public functions

auto GetFolderPath(uint32_t creationType, eastl::string16& dst) -> bool
Gets the filepath of the folder where the .PNGs of the creation type are stored.
auto FolderPathFromLocale(uint32_t instanceID, eastl::string16& dst, uint32_t tableID = 0xFFFFFFFF) -> bool
Used to obtain a path from a locale file, by default 0x19F76D11.locale, similar to the one that would return GetFolderPath()
auto SavePNG(Resource::ResourceObject* pResource, RenderWare::Raster* pImage, Resource::Database* database, bool forceReplace = false, bool disableSteganography = false) -> bool
Encodes the given resource into a .png image and saves it, both in the given package and in the "My Spore Creations" in the user Documents folder.
auto ImportPNG(const char16_t* path, ResourceKey& key) -> bool
Reads the PNG file from the given file path, and adds the creation found within to the Sporepedia if it hasn't been added yet.

Function documentation

bool App::Thumbnail_cImportExport::GetFolderPath(uint32_t creationType, eastl::string16& dst)

Gets the filepath of the folder where the .PNGs of the creation type are stored.

Parameters
creationType One of the types in TypeIDs, such as 'crt', 'bld',...
dst out The eastl::string where the path will be written.

bool App::Thumbnail_cImportExport::SavePNG(Resource::ResourceObject* pResource, RenderWare::Raster* pImage, Resource::Database* database, bool forceReplace = false, bool disableSteganography = false)

Encodes the given resource into a .png image and saves it, both in the given package and in the "My Spore Creations" in the user Documents folder.

Parameters
pResource The resource object to encode inside the PNG. It will be encoded using the appropriate Resource::IResourceFactory
pImage The raster that is written as the image
database The Database taht contains the pollen metadata, and where the PNG will be saved
forceReplace [Optional] If false (by default), if the .png already exists in the folder, it will try writing variants like (1), (2),...
disableSteganography [Optional] If false (by default), the data in the .png will be stored in a special way meant to save space.
Returns true on success, false if something failed.

In the package, the image will be saved using the same ResourceKey as the resource, but with a TypeIDs::png type. The function expects a TypeIDs::pollen_metadata file to exist in that same folder, which will be used to write the metadata (name, description, author, etc) of the creation.

bool App::Thumbnail_cImportExport::ImportPNG(const char16_t* path, ResourceKey& key)

Reads the PNG file from the given file path, and adds the creation found within to the Sporepedia if it hasn't been added yet.

Parameters
path The full path to the file being read.
key Resource key to the creation being read.
Returns 'true' on success, 'false' if something failed.