|
VR-Engage
2.2
|
DtPlayerCreationPalette serves as a catalog of all entities and roles that can be played in VR-Engage. It loads entity definitions from simulation model sets (SMS) files and provides methods for accessing role configurations, display layouts, and other metadata necessary for creating player stations.
This class maintains its own thread-safe access to role definition files and provides asynchronous loading capabilities for better performance.
#include <playerCreationPalette.h>
Classes | |
| struct | DtPaletteEntry |
Public Types | |
| using | DtEntityMap = std::map<DtEntityType, std::shared_ptr<DtPaletteEntry>> |
| using | DtIterator = DtEntityMap::iterator |
Public Member Functions | |
| DtPlayerCreationPalette (DtPlayerStationApp *app) | |
| virtual | ~DtPlayerCreationPalette () |
| virtual void | tick () |
| virtual void | setSmsList (const std::vector< DtFilename > &smsList) |
| virtual DtIterator | getIterator () |
| virtual bool | getNext (DtIterator &iter, DtEntityType *nextType=NULL, std::shared_ptr< DtPaletteEntry > *nextEntry=NULL) |
| std::shared_ptr< DtPaletteEntry > | findEntry (const DtEntityType &type) |
| virtual bool | isValid (const DtEntityType &type, const std::string &role="", const std::string &display="") |
| virtual const std::vector< std::string > | getRoleList (const DtEntityType &type) |
| virtual std::string | findRoleForSlot (const DtEntityType &type, const std::string &slotName) |
| virtual std::string | findSlotForRole (const DtEntityType &type, const std::string &roleName) |
| virtual std::shared_ptr< DtEntityRoleDescriptor > | getRoleDescriptor (const DtEntityType &type, const std::string &role) |
| virtual DtInitTable | getRoleTemplate (const DtEntityType &type, const std::string &role) |
| virtual DtInitTable | getPlayerConfiguration (const DtEntityType &type, const std::string &role, const std::string &display) |
| virtual const std::set< std::string > & | categories () const |
| virtual const std::set< std::string > & | countries () const |
| virtual void | reloadRoleConfig (const DtEntityType &entityType) |
| virtual const std::vector< DtFilename > & | getSMSList () const |
| virtual DtFilename | findFile (const std::string &file) |
| virtual DtInitializer * | initializer () |
Protected Member Functions | |
| virtual void | buildFromSMSAsync () |
| virtual bool | buildFromSMS (DtPlayerStationApp *, const std::vector< DtFilename > &smsList) |
| void | setDataPathsForSms (std::vector< std::string > paths) |
| void | appendDataPathsForSms (std::string path) |
| void | clearDataPathsForSms () |
| virtual void | getSMSList (std::vector< DtString > &smsList) const |
| virtual void | getSMSSearchPaths (std::vector< DtFilename > &searchPaths) const |
| virtual std::shared_ptr< makVre::DtVreModelSetEntry > | loadModelSetEntry (const std::string &filename) |
| std::shared_ptr< DtEntityRoleDescriptor > | findRole (const DtPaletteEntry &entry, const std::string &role) |
| std::shared_ptr< DtEntityRoleDescriptor > | findRole (const DtPaletteEntry &entry) |
Static Protected Member Functions | |
| static int | getDataPathsForSms (lua_State *L) |
Protected Attributes | |
| DtEntityMap | myCreationPaletteMap |
| std::shared_ptr< DtPaletteEntry > | myDefaultPaletteEntry |
| std::set< std::string > | myAllCategories |
| std::set< std::string > | myAllCountries |
| DtPlayerStationApp * | myApp |
| DtInitializer * | myInitializer |
| std::vector< DtFilename > | mySmsList |
| std::vector< DtFilename > | myIncomingSmsList |
| tbb::mutex | myBuildMutex |
| bool | myAsyncBuilding |
| std::unique_ptr< SmsLoadCompleteMessage > | mySmsLoadCompleteMessage |
| tbb::task_arena | myArena |
Static Protected Attributes | |
| static std::vector< std::string > | theSmsRoleSearchPaths |
| using makVre::DtPlayerCreationPalette::DtEntityMap = std::map<DtEntityType, std::shared_ptr<DtPaletteEntry>> |
Type definition for a map of entity types to palette entries.
| using makVre::DtPlayerCreationPalette::DtIterator = DtEntityMap::iterator |
Type definition for an iterator over the entity map.
| makVre::DtPlayerCreationPalette::DtPlayerCreationPalette | ( | DtPlayerStationApp * | app | ) |
Constructor.
| app | Pointer to the player station application |
Creates a new palette instance associated with the application. Initializes the palette but does not load entity data automatically.
|
virtual |
Virtual destructor.
Cleans up resources, including the initializer and any loaded entity data.
|
virtual |
Updates the palette state.
Called once per frame to update the palette, handling any asynchronous loading operations and processing completed loads.
|
virtual |
Sets the list of simulation model sets (SMS) to load.
| smsList | Vector of SMS filenames to load |
Updates the list of simulation model sets from which to load entity definitions. This will trigger an asynchronous reload of the palette.
|
virtual |
Gets an iterator to the beginning of the entity map.
Returns an iterator for traversing all entities in the palette.
|
virtual |
Advances to the next entity in the palette.
| iter | Iterator to advance |
| nextType | Optional pointer to receive the next entity type |
| nextEntry | Optional pointer to receive the next palette entry |
Advances the iterator to the next entity and optionally retrieves the type and entry information for that entity.
| std::shared_ptr< DtPaletteEntry > makVre::DtPlayerCreationPalette::findEntry | ( | const DtEntityType & | type | ) |
Finds an entity by its type.
| type | Entity type to search for |
Looks up an entity in the palette by its entity type identifier.
|
virtual |
Checks if an entity type, role, and display layout combination is valid.
| type | Entity type to check |
| role | Optional role name to check (empty to check only entity type) |
| display | Optional display layout to check (empty to check only entity and role) |
Verifies whether a specific entity type exists in the palette and optionally whether it supports the specified role and display layout.
|
virtual |
Gets the list of available roles for an entity type.
| type | Entity type to get roles for |
Returns a list of all roles that can be played for the specified entity type.
|
virtual |
Finds a role that corresponds to a slot name.
| type | Entity type to search in |
| slotName | Name of the slot to find the role for |
Maps from a slot name (used in embarkation) to the corresponding role name.
|
virtual |
Finds a slot that corresponds to a role name.
| type | Entity type to search in |
| roleName | Name of the role to find the slot for |
Maps from a role name to the corresponding slot name (used in embarkation).
|
virtual |
Gets the descriptor for a specific role.
| type | Entity type to look up |
| role | Role name to get the descriptor for |
Returns detailed information about a specific role, including file paths, display layouts, and other configuration metadata.
|
virtual |
Gets the base template for a role.
| type | Entity type to look up |
| role | Role name to get the template for |
Returns the base template configuration for a role before any display-specific settings are applied.
|
virtual |
Gets the complete configuration for a player station.
| type | Entity type to configure |
| role | Role name to configure |
| display | Display layout to use |
Returns the complete configuration for a player station, combining the role template with display-specific settings and other overrides.
|
inlinevirtual |
Gets all categories in the palette.
Returns a set of all unique categories across all entities in the palette. Categories are used for filtering and organizing entities in the UI.
References myAllCategories.
|
inlinevirtual |
Gets all countries in the palette.
Returns a set of all unique countries across all entities in the palette. Countries are used for filtering and organizing entities in the UI.
References myAllCountries.
|
virtual |
Reloads the role configuration for an entity type.
| entityType | Entity type to reload |
Reloads the role configuration data found in the .entity file for a specific entity type. This is used for hot-reloading when entity files are modified.
|
virtual |
Gets the current list of simulation model sets.
Returns the list of simulation model set (SMS) files that are currently being used to populate the palette.
|
virtual |
Finds a file in the SMS directories.
| file | Name of the file to find |
Searches for a file in all SMS directories and returns its full path. This is used to locate role definition files, entity files, and other resources.
|
virtual |
Gets the palette's initializer.
Returns a pointer to the DtInitializer owned by this class, which is used for interfacing with Lua role definitions. This initializer can be accessed from both the player creation palette and the choose role panel.
|
protectedvirtual |
Initiates asynchronous building of the palette from SMS files.
Starts an asynchronous task to rebuild the palette from the current set of SMS files. This is used to avoid blocking the main thread during palette loading.
|
protectedvirtual |
Builds the palette from SMS files.
| app | Pointer to the player station application |
| smsList | List of SMS files to load from |
Loads all entity definitions from the specified SMS files and populates the palette with the resulting entities and roles.
|
staticprotected |
Lua callback to get data paths for SMS.
| L | Lua state pointer |
Callback function for Lua to retrieve the SMS data paths.
|
protected |
Sets the data paths for SMS.
| paths | Vector of path strings to set |
Sets the list of data paths used for locating SMS resources.
|
protected |
Adds a data path for SMS.
| path | Path string to add |
Appends a new data path to the list of SMS resource locations.
|
protected |
Removes all SMS data paths.
Clears the list of data paths used for locating SMS resources.
|
protectedvirtual |
Gets the list of SMS files to search.
| smsList | Vector to populate with SMS file names |
Populates the provided vector with the list of SMS files to search when loading an entity file. Returns the contents of mySmsList if specified, or the app's default SMS list otherwise.
|
protectedvirtual |
Gets the search paths for model set entries.
| searchPaths | Vector to populate with search paths |
Populates the provided vector with the list of SMS paths (including inherited ones) to search when loading a model set entry.
|
protectedvirtual |
Loads a model set entry.
| filename | Name of the file to load |
Loads and parses a model set entry from the specified filename.
|
protected |
Finds a role in a palette entry by name.
| entry | Palette entry to search in |
| role | Name of the role to find |
Searches for a specific role within a palette entry by name.
|
protected |
Finds any role in a palette entry.
| entry | Palette entry to search in |
Returns the first available role within a palette entry.
|
staticprotected |
Static instance of SMS role search paths (for Lua access)
|
protected |
Map of entity types to palette entries.
|
protected |
Default palette entry (used when a specific entry is not found)
|
protected |
Set of all unique categories across all entities.
Referenced by categories().
|
protected |
Set of all unique countries across all entities.
Referenced by countries().
|
protected |
Pointer to the player station application.
|
protected |
Initializer for Lua role definitions.
|
protected |
Current list of SMS files to load from.
|
protected |
Incoming list of SMS files for the next rebuild.
|
protected |
Mutex for synchronizing build operations.
|
protected |
Flag indicating whether an asynchronous build is in progress.
|
protected |
Message to send when SMS loading completes.
|
protected |
Task arena for asynchronous operations.