esp::metadata::managers::StageAttributesManager class

Base classes

template<class T, ManagedObjectAccess Access>
class AbstractObjectAttributesManager<attributes::StageAttributes, ManagedObjectAccess::Copy>
Class template defining responsibilities and functionality for managing esp::metadata::attributes::AbstractObjectAttributes constructs.

Constructors, destructors, conversion operators

StageAttributesManager(PhysicsAttributesManager::ptr physicsAttributesManager) explicit

Public functions

void setCurrPhysicsManagerAttributesHandle(const std::string& handle)
This will set the current physics manager attributes that is governing the world that this StageAttributesManager's scenes will be created in. This is used so that upon creation of new esp::metadata::attributes::StageAttributes, PhysicsManagerAttributes defaults can be set in the esp::metadata::attributes::StageAttributes before any scene-specific values are set.
void setCurrCfgVals(const std::string& lightSetup, bool frustumCulling)
copy current esp::sim::SimulatorConfiguration driven values as defaults, to make them available for stage attributes initialization.
auto createPrimBasedAttributesTemplate(const std::string& primAttrTemplateHandle, bool registerTemplate = true) -> attributes::StageAttributes::ptr override
Creates an instance of a stage template described by passed string, which should be a reference to an existing primitive asset template to be used in the construction of the stage (as render and collision mesh). It returns existing instance if there is one, and nullptr if fails.
void setValsFromJSONDoc(attributes::StageAttributes::ptr attribs, const io::JsonGenericValue& jsonConfig) override
Method to take an existing attributes and set its values from passed json config file.

Protected functions

void createDefaultPrimBasedAttributesTemplates() override
Create and save default primitive asset-based object templates, saving their handles as non-deletable default handles.
void setDefaultAssetNameBasedAttributes(attributes::StageAttributes::ptr attributes, bool setFrame, const std::string& meshHandle, const std::function<void(int)>& assetTypeSetter) override
Perform file-name-based attributes initialization. This is to take the place of the AssetInfo::fromPath functionality, and is only intended to provide default values and other help if certain mistakes are made by the user, such as specifying an asset handle in json but not specifying the asset type corresponding to that handle. These settings should not restrict anything, only provide defaults.
auto initNewObjectInternal(const std::string& handleName, bool builtFromConfig) -> attributes::StageAttributes::ptr override
Used Internally. Create and configure newly-created 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 internally from esp::core::managedContainers::ManagedContainerBase.
auto registerObjectFinalize(attributes::StageAttributes::ptr StageAttributesTemplate, const std::string& StageAttributesHandle, 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.
void resetFinalize() override
Any scene-attributes-specific resetting that needs to happen on reset.

Protected variables

PhysicsAttributesManager::ptr physicsAttributesManager_
Reference to PhysicsAttributesManager to give access to default physics manager attributes settings when esp::metadata::attributes::StageAttributes are created.
std::string cfgLightSetup_
Current lighting default value based on current esp::sim::SimulatorConfiguration settings. Potentially overridden by scene-specific json.
bool cfgFrustumCulling_
Current frustum culling setting based on current esp::sim::SimulatorConfiguration settings. Potentially overridden by scene-specific json.
std::string physicsManagerAttributesHandle_
Name of currently used physicsManagerAttributes.

Function documentation

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

This will set the current physics manager attributes that is governing the world that this StageAttributesManager's scenes will be created in. This is used so that upon creation of new esp::metadata::attributes::StageAttributes, PhysicsManagerAttributes defaults can be set in the esp::metadata::attributes::StageAttributes 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::StageAttributesManager::setCurrCfgVals(const std::string& lightSetup, bool frustumCulling)

copy current esp::sim::SimulatorConfiguration driven values as defaults, to make them available for stage attributes initialization.

Parameters
lightSetup the config-specified light setup
frustumCulling whether or not (semantic) stage should be partitioned for culling.

attributes::StageAttributes::ptr esp::metadata::managers::StageAttributesManager::createPrimBasedAttributesTemplate(const std::string& primAttrTemplateHandle, bool registerTemplate = true) override

Creates an instance of a stage template described by passed string, which should be a reference to an existing primitive asset template to be used in the construction of the stage (as render and collision mesh). It returns existing instance if there is one, and nullptr if fails.

Parameters
primAttrTemplateHandle The handle to an existing primitive asset template. Fails if does not.
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.
Returns a reference to the desired stage template, or nullptr if fails.

void esp::metadata::managers::StageAttributesManager::setValsFromJSONDoc(attributes::StageAttributes::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::StageAttributesManager::setDefaultAssetNameBasedAttributes(attributes::StageAttributes::ptr attributes, bool setFrame, const std::string& meshHandle, const std::function<void(int)>& assetTypeSetter) override protected

Perform file-name-based attributes initialization. This is to take the place of the AssetInfo::fromPath functionality, and is only intended to provide default values and other help if certain mistakes are made by the user, such as specifying an asset handle in json but not specifying the asset type corresponding to that handle. These settings should not restrict anything, only provide defaults.

Parameters
attributes The AbstractObjectAttributes object to be configured
setFrame whether the frame should be set or not (only for render assets in scenes)
meshHandle Mesh Handle to check.
assetTypeSetter Setter for mesh type.

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

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

Parameters
handleName handle name to be assigned to attributes
builtFromConfig whether this stage is being built from a config file (i.e. handleName is file name for config) or from some other source.
Returns Newly created but unregistered StageAttributes pointer, with only default values set.

void esp::metadata::managers::StageAttributesManager::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 internally from 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::StageAttributesManager::registerObjectFinalize(attributes::StageAttributes::ptr StageAttributesTemplate, const std::string& StageAttributesHandle, 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
StageAttributesTemplate The attributes template.
StageAttributesHandle 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 object template.