esp::metadata::attributes::SceneObjectInstanceAttributes class

This class describes an instance of a stage, object or articulated object in a scene - its template name, translation from the origin, rotation, motiontype, and other values required to instantiate the construct described.

Base classes

class AbstractAttributes
Base class for all implemented attributes. Inherits from esp::core::managedContainers::AbstractFileBasedManagedObject so the attributes can be managed by a esp::core::managedContainers::ManagedContainer.

Derived classes

class SceneAOInstanceAttributes
This class describes an instance of an articulated object in a scene.

Constructors, destructors, conversion operators

SceneObjectInstanceAttributes(const std::string& handle, const std::string& type = "SceneObjectInstanceAttributes") explicit
SceneObjectInstanceAttributes handle is also the handle of the underlying AbstractObjectAttributes for the object being instanced.
SceneObjectInstanceAttributes(const std::string& handle, const std::shared_ptr<AbstractObjectAttributes>& baseObjAttribs) protected explicit
Called only from SceneInstanceAttributesManager, to create and initialize an instance attributes from an existing object attributes.

Public functions

void setTranslation(const Mn::Vector3& translation)
Set the translation from the origin of the described stage/object instance.
auto getTranslation() const -> Mn::Vector3
Get the translation from the origin of the described stage/object instance.
void setTranslationOrigin(const std::string& translation_origin)
Set a value representing the mechanism used to create this scene instance - should map to an enum value in @InstanceTranslationOriginMap. This acts as an instance-specific override to the scene-instance-wide setting.
auto getTranslationOrigin() const -> SceneInstanceTranslationOrigin
Get the value representing the mechanism used to create this scene instance - should map to an enum value in @InstanceTranslationOriginMap. This acts as an instance-specific override to the scene-instance-wide setting.
auto getTranslationOriginStr() const -> std::string
Get string representation of translation origin.
void setRotation(const Mn::Quaternion& rotation)
Set the rotation of the object.
auto getRotation() const -> Mn::Quaternion
Get the rotation of the object.
void setIsInstanceVisible(bool isVisible)
If not visible can add dynamic non-rendered object into a scene object. If is not visible then should not add object to drawables.
auto getIsInstanceVisible() const -> int
void clearIsInstanceVisible()
void setMotionType(const std::string& motionType)
Set the motion type for the object. Ignored for stage instances.
auto getMotionType() const -> esp::physics::MotionType
Get the motion type for the object. Ignored for stage instances.
void setShaderType(const std::string& shader_type)
Set the default shader to use for an object or stage. Uses values specified in stage or object attributes if not overridden here. Uses map of string values in JSON to esp::metadata::attributes::ObjectInstanceShaderType int values.
auto getShaderType() const -> ObjectInstanceShaderType
Get the default shader to use for an object or stage. This may be overriding a stage or object config specification.
auto getUniformScale() const -> float
Get the uniform scaling of the instanced object. Want this to be a float for consumption in instance creation.
void setUniformScale(double uniform_scale)
Set the uniform scaling of the instanced object. Want this to be a float for consumption in instance creation.
auto getNonUniformScale() const -> Mn::Vector3
Get the non-uniform scale vector of the described stage/object instance.
void setNonUniformScale(const Mn::Vector3& non_uniform_scale)
Set the non-uniform scale vector of the described stage/object instance.
auto getApplyScaleToMass() const -> bool
Object and Articulated Object Instance only. Get whether or not to apply geometric scaling to mass (i.e. to maintain object mean density)
void setApplyScaleToMass(bool apply_scale_to_mass)
Object and Articulated Object Instance only. Set whether or not to apply geometric scaling to mass (i.e. to maintain object mean density)
auto getMassScale() const -> double
Get or set the mass scaling of the instanced object.
void setMassScale(double mass_scale)
void writeValuesToJson(io::JsonGenericValue& jsonObj, io::JsonAllocator& allocator) const override
Populate a JSON object with all the first-level values held in this SceneObjectInstanceAttributes. Default is overridden to handle special cases for SceneObjectInstanceAttributes.
auto getObjectInfoHeader() const -> std::string override
Retrieve a comma-separated string holding the header values for the info returned for this managed object.
auto getObjectInfo() const -> std::string override
Retrieve a comma-separated informational string about the contents of this managed object.

Protected functions

auto getObjectInfoInternal() const -> std::string override
Retrieve a comma-separated informational string about the contents of this managed object.
auto getObjectInfoHeaderInternal() const -> std::string override
Retrieve a comma-separated string holding the header values for the info returned for this managed object, type-specific.
auto getSceneObjInstanceInfoInternal() const -> std::string virtual
Retrieve a comma-separated informational string about the contents of this managed object.
auto getSceneObjInstanceInfoHeaderInternal() const -> std::string virtual
Retrieve a comma-separated informational string about the contents of this managed object.
void writeValuesToJsonInternal(io::JsonGenericValue& jsonObj, io::JsonAllocator& allocator) const virtual
Populate the passed JSON object with all the first-level values specific to this SceneObjectInstanceAttributes. This is to facilitate SceneAOInstanceAttributes-specific values to be written.

Function documentation

esp::metadata::attributes::SceneObjectInstanceAttributes::SceneObjectInstanceAttributes(const std::string& handle, const std::shared_ptr<AbstractObjectAttributes>& baseObjAttribs) explicit protected

Called only from SceneInstanceAttributesManager, to create and initialize an instance attributes from an existing object attributes.

Called internally. SceneObjectInstanceAttributes handle is also the handle of the underlying AbstractObjectAttributes for the object being instanced. This initializes the instance attributes with the values from the passed object attributes.