esp::metadata::managers::SceneInstanceAttributesManager class

Base classes

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

Constructors, destructors, conversion operators

SceneInstanceAttributesManager()

Public functions

auto createObject(const std::string& sceneInstanceHandle, bool registerTemplate = true) -> attributes::SceneInstanceAttributes::ptr override
Creates the descriptive attributes template for a scene instance described by passed string.
void setValsFromJSONDoc(attributes::SceneInstanceAttributes::ptr attribs, const io::JsonGenericValue& jsonConfig) override
Method to take an existing attributes and set its values from passed json config file.
auto createEmptyInstanceAttributes(const std::string& handle) -> attributes::SceneObjectInstanceAttributes::ptr
This will return a attributes::SceneObjectInstanceAttributes object with passed handle.
auto createEmptyAOInstanceAttributes(const std::string& handle) -> attributes::SceneAOInstanceAttributes::ptr
This will return a attributes::SceneObjectInstanceAttributes object with passed handle.

Protected functions

auto getTranslationOriginVal(const io::JsonGenericValue& jsonDoc) const -> std::string
Gets the name/key value of the appropriate enum corresponding to the desired Translation Origin used to determine the location of the asset in the scene instance. The purpose of this value is to know whether to correct placement by location of COM of object when instance is created.
auto createInstanceAttributesFromJSON(const io::JsonGenericValue& jCell) -> attributes::SceneObjectInstanceAttributes::ptr
Used Internally. Create a esp::metadata::attributes::SceneObjectInstanceAttributes object from the passed JSON doc.
auto createAOInstanceAttributesFromJSON(const io::JsonGenericValue& jCell) -> attributes::SceneAOInstanceAttributes::ptr
Used Internally. Create a esp::metadata::attributes::SceneAOInstanceAttributes object from the passed JSON doc, describing the initial state of an instance of an articulated object.
void loadAbstractObjectAttributesFromJson(const attributes::SceneObjectInstanceAttributes::ptr& attributes, const io::JsonGenericValue& jCell) const
Populate an existing metadata::attributes::SceneObjectInstanceAttributes from a JSON config.
auto initNewObjectInternal(const std::string& sceneInstanceHandle, bool builtFromConfig) -> attributes::SceneInstanceAttributes::ptr override
Used Internally. Create and configure newly-created scene instance 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::ManagedContainerBase.
void resetFinalize() override
Any scene-instance-attributes-specific resetting that needs to happen on reset.
auto registerObjectFinalize(attributes::SceneInstanceAttributes::ptr sceneInstanceAttributes, const std::string& sceneInstanceAttributesHandle, 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.
auto isValidPrimitiveAttributes(const std::string& handle) -> bool override
This function is meaningless for this manager's ManagedObjects.

Function documentation

attributes::SceneInstanceAttributes::ptr esp::metadata::managers::SceneInstanceAttributesManager::createObject(const std::string& sceneInstanceHandle, bool registerTemplate = true) override

Creates the descriptive attributes template for a scene instance described by passed string.

Parameters
sceneInstanceHandle 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::SceneInstanceAttributesManager::setValsFromJSONDoc(attributes::SceneInstanceAttributes::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

std::string esp::metadata::managers::SceneInstanceAttributesManager::getTranslationOriginVal(const io::JsonGenericValue& jsonDoc) const protected

Gets the name/key value of the appropriate enum corresponding to the desired Translation Origin used to determine the location of the asset in the scene instance. The purpose of this value is to know whether to correct placement by location of COM of object when instance is created.

Parameters
jsonDoc document where value may be specified.
Returns the int value to set for translation_origin in instance attributes.

attributes::SceneObjectInstanceAttributes::ptr esp::metadata::managers::SceneInstanceAttributesManager::createInstanceAttributesFromJSON(const io::JsonGenericValue& jCell) protected

Used Internally. Create a esp::metadata::attributes::SceneObjectInstanceAttributes object from the passed JSON doc.

Parameters
jCell JSON object containing the description of the stage or object instance.
Returns the constructed esp::metadata::attributes::SceneObjectInstanceAttributes object

attributes::SceneAOInstanceAttributes::ptr esp::metadata::managers::SceneInstanceAttributesManager::createAOInstanceAttributesFromJSON(const io::JsonGenericValue& jCell) protected

Used Internally. Create a esp::metadata::attributes::SceneAOInstanceAttributes object from the passed JSON doc, describing the initial state of an instance of an articulated object.

Parameters
jCell JSON object containing the description of the articulated object instance.
Returns the constructed esp::metadata::attributes::SceneAOInstanceAttributes object

void esp::metadata::managers::SceneInstanceAttributesManager::loadAbstractObjectAttributesFromJson(const attributes::SceneObjectInstanceAttributes::ptr& attributes, const io::JsonGenericValue& jCell) const protected

Populate an existing metadata::attributes::SceneObjectInstanceAttributes from a JSON config.

Parameters
attributes the attributes to populate with JSON values
jCell JSON document to parse

attributes::SceneInstanceAttributes::ptr esp::metadata::managers::SceneInstanceAttributesManager::initNewObjectInternal(const std::string& sceneInstanceHandle, bool builtFromConfig) override protected

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

Parameters
sceneInstanceHandle handle name to be assigned to scene instance attributes
builtFromConfig Whether this scene is being constructed from a config file or from some other source.
Returns Newly created but unregistered SceneInstanceAttributes pointer, with only default values set.

void esp::metadata::managers::SceneInstanceAttributesManager::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::ManagedContainerBase.

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

int esp::metadata::managers::SceneInstanceAttributesManager::registerObjectFinalize(attributes::SceneInstanceAttributes::ptr sceneInstanceAttributes, const std::string& sceneInstanceAttributesHandle, 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
sceneInstanceAttributes The attributes template.
sceneInstanceAttributesHandle 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.

bool esp::metadata::managers::SceneInstanceAttributesManager::isValidPrimitiveAttributes(const std::string& handle) override protected

This function is meaningless for this manager's ManagedObjects.

Parameters
handle Ignored.
Returns false