esp::metadata::managers::SceneDatasetAttributesManager class

Base classes

template<class T, ManagedObjectAccess Access>
class AttributesManager<attributes::SceneDatasetAttributes, ManagedObjectAccess::Share>
Class template defining responsibilities and functionality for managing esp::metadata::attributes::AbstractAttributes constructs.

Constructors, destructors, conversion operators

SceneDatasetAttributesManager(PhysicsAttributesManager::ptr physicsAttributesMgr, PbrShaderAttributesManager::ptr pbrShaderAttributesMgr) explicit

Public functions

auto createObject(const std::string& attributesTemplateHandle, bool registerTemplate = true) -> attributes::SceneDatasetAttributes::ptr override
Creates an instance of a dataset template described by passed string. For dataset templates, this a file name.
void setValsFromJSONDoc(attributes::SceneDatasetAttributes::ptr attribs, const io::JsonGenericValue& jsonConfig) override
Method to take an existing attributes and set its values from passed json config file.
void setCurrPhysicsManagerAttributesHandle(const std::string& handle)
This will set the current physics manager attributes that is governing the world that this SceneDatasetAttributesManager's datasets will be created in. This is used so that upon creation of new esp::metadata::attributes::SceneDatasetAttributes, PhysicsManagerAttributes defaults can be set in the esp::metadata::attributes::SceneDatasetAttributes before any scene-specific values are set.
void setDefaultPbrShaderAttributesHandle(const std::string& pbrHandle)
This will set the current default PBR/IBL Shader configuration attributes. This is used so that upon creation of new esp::metadata::attributes::SceneDatasetAttributes, the default esp::metadata::attributes::PbrShaderAttributes can be set in the esp::metadata::attributes::SceneDatasetAttributes before any scene-specific values are set.

Protected functions

void validateMap(const std::string& dsDir, const std::string& jsonTag, std::map<std::string, std::string>& map)
This will validate a loaded dataset map with file location values from the dataset config, by attempting to either verify those locations are valid files, or else prefix the given location with the dataset root directory.
template<typename U>
void readDatasetJSONCell(const std::string& dsDir, const char* tag, const io::JsonGenericValue& jsonConfig, const U& attrMgr, std::map<std::string, std::string>* strKeyMap = nullptr)
Verify a particular subcell exists within the dataset_config.JSON file, and if so, handle reading the possible JSON sub-cells it might hold, using the passed attributesManager for the dataset being processed.
template<typename U>
void readDatasetConfigsJSONCell(const std::string& dsDir, const char* tag, const io::JsonGenericValue& jCell, const U& attrMgr)
This will parse an individual element in a "configs" cell array in the dataset_config.JSON file.
auto initNewObjectInternal(const std::string& handleName, bool builtFromConfig) -> attributes::SceneDatasetAttributes::ptr override
Used Internally. Create and configure newly-created dataset attributes with any default values, before any specific values are set.
void deleteObjectInternalFinalize(int templateID, const std::string& templateHandle) override
This method will perform any necessary updating that is attributesManager-specific upon template removal, such as removing a specific template handle from the list of file-based template handles in ObjectAttributesManager. This should only be called esp::core::managedContainers::ManagedContainerBase.
void resetFinalize() override
Any dataset-attributes-specific resetting that needs to happen on reset.
auto registerObjectFinalize(attributes::SceneDatasetAttributes::ptr SceneDatasetAttributes, const std::string& SceneDatasetAttributesHandle, bool forceRegistration) -> int override
Add a std::shared_ptr<attributesType> object to the objectLibrary_. Verify that render and collision handles have been set properly. We are doing this since these values can be modified by the user.

Protected variables

std::string physicsManagerAttributesHandle_
Name of currently used physicsManagerAttributes.
std::string defaultPbrShaderAttributesHandle_
Name of currently used default PbrShaderAttributes.
PhysicsAttributesManager::ptr physicsAttributesManager_
Reference to PhysicsAttributesManager to give access to default physics manager attributes settings when esp::metadata::attributes::SceneDatasetAttributes are created within Dataset.
PbrShaderAttributesManager::ptr pbrShaderAttributesManager_
Reference to the PbrShaderAttributesManager to give access to various PBR/IBL Shader configuration parameters and settings.

Function documentation

attributes::SceneDatasetAttributes::ptr esp::metadata::managers::SceneDatasetAttributesManager::createObject(const std::string& attributesTemplateHandle, bool registerTemplate = true) override

Creates an instance of a dataset template described by passed string. For dataset templates, this a file name.

Parameters
attributesTemplateHandle the origin of the desired dataset template to be created.
registerTemplate whether to add this template to the library. If the user is going to edit this template, this should be false - any subsequent editing will require re-registration. Defaults to true. If specified as true, then this function returns a copy of the registered template.
Returns a reference to the newly-created template.

If a template exists with this handle, this existing template will be overwritten with the newly created one if registerTemplate is true.

void esp::metadata::managers::SceneDatasetAttributesManager::setValsFromJSONDoc(attributes::SceneDatasetAttributes::ptr attribs, const io::JsonGenericValue& jsonConfig) override

Method to take an existing attributes and set its values from passed json config file.

Parameters
attribs (out) an existing attributes to be modified.
jsonConfig json document to parse

void esp::metadata::managers::SceneDatasetAttributesManager::setCurrPhysicsManagerAttributesHandle(const std::string& handle)

This will set the current physics manager attributes that is governing the world that this SceneDatasetAttributesManager's datasets will be created in. This is used so that upon creation of new esp::metadata::attributes::SceneDatasetAttributes, PhysicsManagerAttributes defaults can be set in the esp::metadata::attributes::SceneDatasetAttributes before any scene-specific values are set.

Parameters
handle The string handle referencing the esp::metadata::attributes::PhysicsManagerAttributes governing the current esp::physics::PhysicsManager.

void esp::metadata::managers::SceneDatasetAttributesManager::setDefaultPbrShaderAttributesHandle(const std::string& pbrHandle)

This will set the current default PBR/IBL Shader configuration attributes. This is used so that upon creation of new esp::metadata::attributes::SceneDatasetAttributes, the default esp::metadata::attributes::PbrShaderAttributes can be set in the esp::metadata::attributes::SceneDatasetAttributes before any scene-specific values are set.

Parameters
pbrHandle The string handle referencing the esp::metadata::attributes::PbrShaderAttributes used to configure the current PBR/IBL shader for all objects, unless overridden in Scene Instances.

void esp::metadata::managers::SceneDatasetAttributesManager::validateMap(const std::string& dsDir, const std::string& jsonTag, std::map<std::string, std::string>& map) protected

This will validate a loaded dataset map with file location values from the dataset config, by attempting to either verify those locations are valid files, or else prefix the given location with the dataset root directory.

Parameters
dsDir the dataset's root directory
jsonTag the appropriate tag for the map being read
map A ref to the dataset's map that is being populated.

template<typename U>
void esp::metadata::managers::SceneDatasetAttributesManager::readDatasetJSONCell(const std::string& dsDir, const char* tag, const io::JsonGenericValue& jsonConfig, const U& attrMgr, std::map<std::string, std::string>* strKeyMap = nullptr) protected

Verify a particular subcell exists within the dataset_config.JSON file, and if so, handle reading the possible JSON sub-cells it might hold, using the passed attributesManager for the dataset being processed.

Parameters
dsDir The root directory of the dataset attributes being built.
tag The name of the JSON cell being processed - corresponds to what type of data is being loaded from dataset configuration (i.e. stages, objects, etc)
jsonConfig The sub cell in the json document being processed.
attrMgr The dataset's attributes manager for tag 's data.
strKeyMap

template<typename U>
void esp::metadata::managers::SceneDatasetAttributesManager::readDatasetConfigsJSONCell(const std::string& dsDir, const char* tag, const io::JsonGenericValue& jCell, const U& attrMgr) protected

This will parse an individual element in a "configs" cell array in the dataset_config.JSON file.

Parameters
dsDir
tag The name of the JSON cell being processed - corresponds to what type of data is being loaded from dataset configuration (i.e. stages, objects, etc)
jCell The sub cell within the "configs" array in the json document being processed.
attrMgr The dataset's attributes manager for tag 's data.

attributes::SceneDatasetAttributes::ptr esp::metadata::managers::SceneDatasetAttributesManager::initNewObjectInternal(const std::string& handleName, bool builtFromConfig) override protected

Used Internally. Create and configure newly-created dataset attributes with any default values, before any specific values are set.

Parameters
handleName handle name to be assigned to dataset attributes
builtFromConfig Whether this SceneDatasetAttributes is being built from a config file (i.e. handleName is the name of a configuration file) or from some other source.
Returns Newly created but unregistered SceneDatasetAttributes pointer, with only default values set.

void esp::metadata::managers::SceneDatasetAttributesManager::deleteObjectInternalFinalize(int templateID, const std::string& templateHandle) override protected

This method will perform any necessary updating that is attributesManager-specific upon template removal, such as removing a specific template handle from the list of file-based template handles in ObjectAttributesManager. This should only be called esp::core::managedContainers::ManagedContainerBase.

Parameters
templateID the ID of the template to remove
templateHandle the string key of the attributes desired.

int esp::metadata::managers::SceneDatasetAttributesManager::registerObjectFinalize(attributes::SceneDatasetAttributes::ptr SceneDatasetAttributes, const std::string& SceneDatasetAttributesHandle, bool forceRegistration) override protected

Add a std::shared_ptr<attributesType> object to the objectLibrary_. Verify that render and collision handles have been set properly. We are doing this since these values can be modified by the user.

Parameters
SceneDatasetAttributes The attributes template.
SceneDatasetAttributesHandle The key for referencing the template in the objectLibrary_.
forceRegistration Will register object even if conditional registration checks fail.
Returns The index in the objectLibrary_ of the registered template.