NDEVR
API Documentation
LibraryManager

Manages loading Models from a group that is stored either on a remote server or locally on the disk in a compressed or uncompressed folder. More...

Collaboration diagram for LibraryManager:
[legend]

Public Member Functions

 LibraryManager (QTModelManager *manager, const File &library_folder)
 Constructs a LibraryManager that loads models from the given folder.
void addLayer (Model &model)
 Adds a layer to the given model from the library.
void addToLibrary (const UUID &object, UUID library_object)
 Adds an existing scene object to the library under the given library ID.
bool assignToModel (UUID id, Model &model)
 Assigns a library model to an existing scene model.
void centerModel (Model &model)
 Centers the given model at the origin.
Model findObject (const UUID &id)
 Finds and returns a Model object for the given library ID.
Buffer< TranslatedStringgetCategories () const
 Returns all unique category names across library models.
String getIcon (const UUID &id) const
 Returns the icon name for the given library model.
Buffer< UUIDgetIDs () const
 Returns all model UUIDs in the library.
Buffer< UUIDgetIDsByCategory (const TranslatedString &category)
 Returns all model UUIDs belonging to the given category.
std::function< bool(UUID, Model &)> getModelCallback ()
 Returns a callback function for resolving library models by UUID.
TranslatedString getName (const UUID &id) const
 Returns the display name for the given library model.
TranslatedString getSearchTerms (const UUID &id) const
 Returns the search terms associated with the given library model.
String getType (const UUID &id) const
 Returns the type string for the given library model.
Buffer< StringgetTypes () const
 Returns all unique type strings across library models.
bool hasID (const UUID &id) const
 Returns whether the library contains a model with the given ID.
QTModelManagermanager ()
 Returns the model manager backing this library.
void modelAdded (UUID id)
 Emitted when a model is added to the library.
uint04 modelCount () const
 Returns the total number of models in the library.
void modelRemoved (UUID id)
 Emitted when a model is removed from the library.
void pullFromArchiveFile (File file)
 Imports library models from an archive file.
void recomputeAll ()
 Recomputes the cached data for all library objects.
void recomputeObject (UUID)
 Recomputes the cached data for a single library object.
void recomputeObjects (const Buffer< UUID > &ids)
 Recomputes the cached data for multiple library objects.
void removeFromLibrary (const Buffer< UUID > &object)
 Removes multiple models from the library.
void removeFromLibrary (const UUID &object)
 Removes a single model from the library.
void saveAllImagesToFolder (File folder)
 Saves all library model images to the specified folder.
void saveImagesToFolder (const Buffer< UUID > &ids, File folder)
 Saves images for specific library models to the specified folder.
void saveToArchiveFile (const Buffer< UUID > &ids, File file)
 Saves specific library models to an archive file.
void saveToArchiveFile (File file)
 Saves the entire library to an archive file.
void updateFromArchive ()
 Reloads the library from the archive folder on disk.

Protected Member Functions

void updateFromArchive (const File &file)
 Reloads library entries from the specified archive file.
void updateFromArchive (const UUID &file)
 Reloads a single library entry from its archive by UUID.
bool writeToLibrary (const UUID &object_to_write, UUID library_id)
 Writes a scene object into the library storage.

Protected Attributes

File m_archive_path
 The root folder containing library archives.
Dictionary< UUID, TranslatedStringm_categories
 Maps model UUIDs to category names.
Buffer< UUIDm_ids
 All model UUIDs in the library.
DesignObjectLookup m_library_lookup
 Lookup table for library design objects.
QTModelManagerm_manager
 The model manager providing scene data.
Dictionary< UUID, TranslatedStringm_names
 Maps model UUIDs to display names.
Dictionary< UUID, TranslatedStringm_search_terms
 Maps model UUIDs to search terms.
Dictionary< UUID, Stringm_types
 Maps model UUIDs to type strings.

Detailed Description

Manages loading Models from a group that is stored either on a remote server or locally on the disk in a compressed or uncompressed folder.


Definition at line 41 of file LibraryManager.h.

Constructor & Destructor Documentation

◆ LibraryManager()

LibraryManager::LibraryManager ( QTModelManager * manager,
const File & library_folder )

Constructs a LibraryManager that loads models from the given folder.

Parameters
[in]managerThe model manager providing scene data.
[in]library_folderThe folder containing library model archives.

References manager().

Member Function Documentation

◆ addLayer()

void LibraryManager::addLayer ( Model & model)

Adds a layer to the given model from the library.

Parameters
[in]modelThe model to add a layer to.

◆ addToLibrary()

void LibraryManager::addToLibrary ( const UUID & object,
UUID library_object )

Adds an existing scene object to the library under the given library ID.

Parameters
[in]objectThe UUID of the scene object to add.
[in]library_objectThe target library UUID to file it under.

◆ assignToModel()

bool LibraryManager::assignToModel ( UUID id,
Model & model )

Assigns a library model to an existing scene model.

Parameters
[in]idThe UUID of the library model.
[in]modelThe scene model to assign to.
Returns
True if assignment succeeded.

◆ centerModel()

void LibraryManager::centerModel ( Model & model)

Centers the given model at the origin.

Parameters
[in]modelThe model to center.

◆ findObject()

Model LibraryManager::findObject ( const UUID & id)

Finds and returns a Model object for the given library ID.

Parameters
[in]idThe UUID of the library model to find.
Returns
The Model object.

◆ getCategories()

Buffer< TranslatedString > LibraryManager::getCategories ( ) const

Returns all unique category names across library models.

Returns
A buffer of translated category names.

◆ getIcon()

String LibraryManager::getIcon ( const UUID & id) const

Returns the icon name for the given library model.

Parameters
[in]idThe UUID of the library model.
Returns
The icon name string.

◆ getIDs()

Buffer< UUID > LibraryManager::getIDs ( ) const
inline

Returns all model UUIDs in the library.

Returns
A buffer of UUIDs.

Definition at line 110 of file LibraryManager.h.

References m_ids.

◆ getIDsByCategory()

Buffer< UUID > LibraryManager::getIDsByCategory ( const TranslatedString & category)

Returns all model UUIDs belonging to the given category.

Parameters
[in]categoryThe category to filter by.
Returns
A buffer of matching UUIDs.

◆ getModelCallback()

std::function< bool(UUID, Model &)> LibraryManager::getModelCallback ( )

Returns a callback function for resolving library models by UUID.

Returns
A callback that takes a UUID and Model reference, returning true on success.

◆ getName()

TranslatedString LibraryManager::getName ( const UUID & id) const
inline

Returns the display name for the given library model.

Parameters
[in]idThe UUID of the library model.
Returns
The translated display name.

Definition at line 62 of file LibraryManager.h.

References m_names.

◆ getSearchTerms()

TranslatedString LibraryManager::getSearchTerms ( const UUID & id) const
inline

Returns the search terms associated with the given library model.

Parameters
[in]idThe UUID of the library model.
Returns
The translated search terms.

Definition at line 80 of file LibraryManager.h.

References m_search_terms.

◆ getType()

String LibraryManager::getType ( const UUID & id) const
inline

Returns the type string for the given library model.

Parameters
[in]idThe UUID of the library model.
Returns
The type string.

Definition at line 71 of file LibraryManager.h.

References m_types.

◆ getTypes()

Buffer< String > LibraryManager::getTypes ( ) const

Returns all unique type strings across library models.

Returns
A buffer of type strings.

◆ hasID()

bool LibraryManager::hasID ( const UUID & id) const

Returns whether the library contains a model with the given ID.

Parameters
[in]idThe UUID to check.
Returns
True if the library contains the ID.

◆ manager()

QTModelManager * LibraryManager::manager ( )
inline

Returns the model manager backing this library.

Returns
A pointer to the QTModelManager.

Definition at line 195 of file LibraryManager.h.

References m_manager.

Referenced by LibraryManager().

◆ modelAdded()

void LibraryManager::modelAdded ( UUID id)

Emitted when a model is added to the library.

Parameters
[in]idThe UUID of the added model.

◆ modelCount()

uint04 LibraryManager::modelCount ( ) const

Returns the total number of models in the library.

Returns
The model count.

◆ modelRemoved()

void LibraryManager::modelRemoved ( UUID id)

Emitted when a model is removed from the library.

Parameters
[in]idThe UUID of the removed model.

◆ pullFromArchiveFile()

void LibraryManager::pullFromArchiveFile ( File file)

Imports library models from an archive file.

Parameters
[in]fileThe archive file to import from.

◆ recomputeObject()

void LibraryManager::recomputeObject ( UUID )

Recomputes the cached data for a single library object.

Parameters
[in]idThe UUID of the object to recompute (unnamed parameter).

◆ recomputeObjects()

void LibraryManager::recomputeObjects ( const Buffer< UUID > & ids)

Recomputes the cached data for multiple library objects.

Parameters
[in]idsThe UUIDs of objects to recompute.

◆ removeFromLibrary() [1/2]

void LibraryManager::removeFromLibrary ( const Buffer< UUID > & object)

Removes multiple models from the library.

Parameters
[in]objectThe UUIDs of models to remove.

◆ removeFromLibrary() [2/2]

void LibraryManager::removeFromLibrary ( const UUID & object)

Removes a single model from the library.

Parameters
[in]objectThe UUID of the model to remove.

◆ saveAllImagesToFolder()

void LibraryManager::saveAllImagesToFolder ( File folder)

Saves all library model images to the specified folder.

Parameters
[in]folderThe destination folder for images.

◆ saveImagesToFolder()

void LibraryManager::saveImagesToFolder ( const Buffer< UUID > & ids,
File folder )

Saves images for specific library models to the specified folder.

Parameters
[in]idsThe UUIDs of models whose images to save.
[in]folderThe destination folder for images.

◆ saveToArchiveFile() [1/2]

void LibraryManager::saveToArchiveFile ( const Buffer< UUID > & ids,
File file )

Saves specific library models to an archive file.

Parameters
[in]idsThe UUIDs of models to include.
[in]fileThe destination archive file.

◆ saveToArchiveFile() [2/2]

void LibraryManager::saveToArchiveFile ( File file)

Saves the entire library to an archive file.

Parameters
[in]fileThe destination archive file.

◆ updateFromArchive() [1/2]

void LibraryManager::updateFromArchive ( const File & file)
protected

Reloads library entries from the specified archive file.

Parameters
[in]fileThe archive file to reload from.

◆ updateFromArchive() [2/2]

void LibraryManager::updateFromArchive ( const UUID & file)
protected

Reloads a single library entry from its archive by UUID.

Parameters
[in]fileThe UUID identifying the archive entry.

◆ writeToLibrary()

bool LibraryManager::writeToLibrary ( const UUID & object_to_write,
UUID library_id )
protected

Writes a scene object into the library storage.

Parameters
[in]object_to_writeThe UUID of the object to write.
[in]library_idThe target library UUID.
Returns
True if the write succeeded.

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