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 setDefaultPbrShaderAttrHandle(const std::string& pbrHandle)
Set the curent default PbrShaderAttributes to use on all new scene instances. This can be overridden from within individual scene instances.
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, const std::shared_ptr<attributes::AbstractObjectAttributes>& baseObjAttribs = nullptr) -> attributes::SceneObjectInstanceAttributes::ptr
This will return a attributes::SceneObjectInstanceAttributes object with passed handle.
auto createEmptyAOInstanceAttributes(const std::string& handle, const std::shared_ptr<attributes::ArticulatedObjectAttributes>& aObjAttribs = nullptr) -> attributes::SceneAOInstanceAttributes::ptr
This will return a attributes::SceneObjectInstanceAttributes object with passed handle.
void finalizeAttrPathsBeforeRegister(const attributes::SceneInstanceAttributes::ptr& attributes) const override
This function will be called to finalize attributes' paths before registration, moving fully qualified paths to the appropriate hidden attribute fields. This can also be called without registration to make sure the paths specified in an attributes are properly configured.

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 setAbstractObjectAttributesFromJson(const attributes::SceneObjectInstanceAttributes::ptr& attributes, const io::JsonGenericValue& jCell)
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::managedContainers::ManagedContainerBase.
void resetFinalize() override
Any scene-instance-attributes-specific resetting that needs to happen on reset.
auto preRegisterObjectFinalize(attributes::SceneInstanceAttributes::ptr object, const std::string& objectHandle, bool forceRegistration) -> core::managedContainers::ManagedObjectPreregistration override
Not required for this manager.
void postRegisterObjectHandling(int objectID, const std::string& objectHandle) override
Not required for this manager.

Protected variables

std::string defaultPbrShaderAttributesHandle_
Name of the attributes used for the default Pbr/Ibl shader configuration. This can be overwritten by the SceneInstances.

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

void esp::metadata::managers::SceneInstanceAttributesManager::finalizeAttrPathsBeforeRegister(const attributes::SceneInstanceAttributes::ptr& attributes) const override

This function will be called to finalize attributes' paths before registration, moving fully qualified paths to the appropriate hidden attribute fields. This can also be called without registration to make sure the paths specified in an attributes are properly configured.

Parameters
attributes The attributes to be filtered.

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::setAbstractObjectAttributesFromJson(const attributes::SceneObjectInstanceAttributes::ptr& attributes, const io::JsonGenericValue& jCell) 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::managedContainers::ManagedContainerBase.

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

core::managedContainers::ManagedObjectPreregistration esp::metadata::managers::SceneInstanceAttributesManager::preRegisterObjectFinalize(attributes::SceneInstanceAttributes::ptr object, const std::string& objectHandle, bool forceRegistration) override protected

Not required for this manager.

Parameters
object the managed object to be registered
objectHandle the name to register the managed object with. Expected to be valid.
forceRegistration Should register object even if conditional registration checks fail.
Returns Whether the preregistration has succeeded and what handle to use to register the object if it has.

This method will perform any essential updating to the managed object before registration is performed. If this updating fails, registration will also fail.

void esp::metadata::managers::SceneInstanceAttributesManager::postRegisterObjectHandling(int objectID, const std::string& objectHandle) override protected

Not required for this manager.

Parameters
objectID the ID of the successfully registered managed object
objectHandle The name of the managed object

This method will perform any final manager-related handling after successfully registering an object.

See esp::attributes::managers::ObjectAttributesManager for an example.