class
AssetAttributesManager
Contents
Base classes
-
template<class AttribsPtr>class AttributesManager
- Template Class defining responsibilities for managing attributes for different types of objects, such as scenes, primitive assets, physical objects, etc.
Public static variables
-
static const std::
map<PrimObjTypes, const char*> PrimitiveNames3DMap - Constant Map holding names of all Magnum 3D primitive classes supported, keyed by PrimObjTypes enum entry. Note final entry is not a valid primitive.
Constructors, destructors, conversion operators
-
AssetAttributesManager(assets::
ResourceManager& resourceManager)
Public functions
-
auto createAttributesTemplate(const std::
string& primClassName, bool registerTemplate = true) -> AbstractPrimitiveAttributes::ptr override - Should only be called internally. Creates an instance of a primtive asset attributes template described by passed string. For primitive assets this is the Magnum primitive class name.
-
auto createDefaultAttributesTemplate(const std::
string& primClassName, bool registerTemplate = false) -> AbstractPrimitiveAttributes::ptr override - Creates an instance of a template holding default values. For asset attributes this is the same functionality as createAttributesTemplate.
- auto createAttributesTemplate(PrimObjTypes primObjType, bool registerTemplate = true) -> AbstractPrimitiveAttributes::ptr
- Should only be called internally. Creates an instance of a primtive asset attributes template described by passed enum value. For primitive assets this mapes to the Magnum primitive class name.
-
auto getTemplateHandlesByPrimType(PrimObjTypes primType,
bool contains = true) const -> std::
vector<std:: string> - Get list of primitive asset template handles used as keys in primitiveAssetTemplateLibrary_ related to passed primitive descriptor enum.
- auto getDefaultCapsuleTemplate(bool isWireFrame) -> CapsulePrimitiveAttributes::ptr
- Return the default capsule template, either solid or wireframe.
-
auto getCapsuleTemplate(const std::
string& templateHndle) -> CapsulePrimitiveAttributes::ptr - Return the spedified capsule template.
- auto getDefaultConeTemplate(bool isWireFrame) -> ConePrimitiveAttributes::ptr
- Return the default cone template, either solid or wireframe.
-
auto getConeTemplate(const std::
string& templateHndle) -> ConePrimitiveAttributes::ptr - Return the spedified cone template, either solid or wireframe.
- auto getDefaultCubeTemplate(bool isWireFrame) -> CubePrimitiveAttributes::ptr
- Return the default cube template, either solid or wireframe.
-
auto getCubeTemplate(const std::
string& templateHndle) -> CubePrimitiveAttributes::ptr - Return the spedified cube template.
- auto getDefaultCylinderTemplate(bool isWireFrame) -> CylinderPrimitiveAttributes::ptr
- Return the default cylinder template, either solid or wireframe.
-
auto getCylinderTemplate(const std::
string& templateHndle) -> CylinderPrimitiveAttributes::ptr - Return the spedified cylinder template.
- auto getDefaultIcosphereTemplate(bool isWireFrame) -> IcospherePrimitiveAttributes::ptr
- Return the default icosphere template, either solid or wireframe.
-
auto getIcosphereTemplate(const std::
string& templateHndle) -> IcospherePrimitiveAttributes::ptr - Return the spedified icosphere template.
- auto getDefaultUVSphereTemplate(bool isWireFrame) -> UVSpherePrimitiveAttributes::ptr
- Return the default UVSphere template, either solid or wireframe.
-
auto getUVSphereTemplate(const std::
string& templateHndle) -> UVSpherePrimitiveAttributes::ptr - Return the spedified cube template.
Protected types
-
using Map_Of_PrimTypeCtors = std::
map<std:: string, AbstractPrimitiveAttributes::ptr(AssetAttributesManager::*)()> - Define a map type referencing function pointers to createPrimAttributes() keyed by string names of classes being instanced, as defined in PrimNames3D.
Protected functions
-
void setDefaultFileNameBasedAttributes(CORRADE_
UNUSED AbstractPrimitiveAttributes::ptr attributes, CORRADE_ UNUSED bool setFrame, CORRADE_ UNUSED const std:: string& meshHandle, CORRADE_ UNUSED std:: function<void(int)> meshTypeSetter) override - Not used by AbstractPrimitiveAttributes.
-
void updateTemplateHandleLists(CORRADE_
UNUSED int templateID, CORRADE_ UNUSED 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.
-
auto verifyTemplateHandle(const std::
string& templateHandle, const std:: string& attrType) -> bool - Verify that passed template handle describes attributes of type specified by passed primtive name (ie "cube", "capsule")
-
auto registerAttributesTemplateFinalize(AbstractPrimitiveAttributes::ptr attributesTemplate,
const std::
string& ignored = "") -> int override - Add an AbstractPrimitiveAttributes object to the templateLibrary_
. - auto initNewAttribsInternal(AbstractPrimitiveAttributes::ptr newAttributes) -> AbstractPrimitiveAttributes::ptr override
- Used Internally. Configure newly-created attributes with any default values, before any specific values are set.
-
auto buildPrimAttributes(const std::
string& primClassName) -> AbstractPrimitiveAttributes::ptr - Build an AbstractPrimtiveAttributes object of type associated with passed class name.
-
template<typename T, bool isWireFrame, PrimObjTypes primitiveType>auto createPrimAttributes() -> AbstractPrimitiveAttributes::ptr
- Build a shared pointer to the appropriate attributes for passed object type as defined in PrimObjTypes, where each entry except END_
PRIM_ OBJ_ TYPES corresponds to a Magnum Primitive type. - void resetFinalize() override
- Any Assset-attributes-specific resetting that needs to happen on reset.
- void buildCtorFuncPtrMaps() override
- This function will assign the appropriately configured function pointers for createPrimAttributes calls for each type of supported primitive to the primTypeConstructorMap, keyed by type of primtive.
Protected variables
-
Map_
Of_ PrimTypeCtors primTypeConstructorMap_ - Map of function pointers to instantiate a primitive attributes object, keyed by the Magnum primitive class name as listed in PrimNames3D. A primitive attributes object is instanced by accessing the approrpiate function pointer.
-
std::
map<std:: string, std:: string> defaultPrimAttributeHandles_ - Map relating primitive class name to default attributes template handle. There should always be a template for each of these handles.
Function documentation
AbstractPrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: createAttributesTemplate(const std:: string& primClassName,
bool registerTemplate = true) override
Should only be called internally. Creates an instance of a primtive asset attributes template described by passed string. For primitive assets this is the Magnum primitive class name.
Parameters | |
---|---|
primClassName | A string descriptor of the primitive asset template to be created, corresponding to the Magnum Primitive class name. |
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 desired template. |
AbstractPrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: createDefaultAttributesTemplate(const std:: string& primClassName,
bool registerTemplate = false) override
Creates an instance of a template holding default values. For asset attributes this is the same functionality as createAttributesTemplate.
Parameters | |
---|---|
primClassName | A string descriptor of the primitive asset template to be created, corresponding to the Magnum Primitive class name. |
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 false. If specified as true, then this function returns a copy of the registered template. |
Returns | a reference to the desired template. |
AbstractPrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: createAttributesTemplate(PrimObjTypes primObjType,
bool registerTemplate = true)
Should only be called internally. Creates an instance of a primtive asset attributes template described by passed enum value. For primitive assets this mapes to the Magnum primitive class name.
Parameters | |
---|---|
primObjType | an enum value denoting the class of the primitive to instantiate |
registerTemplate | whether to add this template to the library or not. If the user is going to edit this template, this should be false. |
Returns | a reference to the desired template. |
std:: vector<std:: string> esp:: assets:: managers:: AssetAttributesManager:: getTemplateHandlesByPrimType(PrimObjTypes primType,
bool contains = true) const
Get list of primitive asset template handles used as keys in primitiveAssetTemplateLibrary_ related to passed primitive descriptor enum.
Parameters | |
---|---|
primType | Enum describing primitive type |
contains | whether to search for keys containing, or not containing, subStr |
Returns | list containing 0 or more string keys corresponding to templates in primitiveAssetTemplateLibrary_ that contain the passed substring |
CapsulePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getDefaultCapsuleTemplate(bool isWireFrame)
Return the default capsule template, either solid or wireframe.
Parameters | |
---|---|
isWireFrame | whether should be wireframe or solid template |
Returns | appropriately cast template |
CapsulePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getCapsuleTemplate(const std:: string& templateHndle)
Return the spedified capsule template.
Parameters | |
---|---|
templateHndle | The handle of the desired capsule template. Verifies that handle is to specified template type |
Returns | appropriately cast template, or nullptr if template handle incorrectly specified. |
ConePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getDefaultConeTemplate(bool isWireFrame)
Return the default cone template, either solid or wireframe.
Parameters | |
---|---|
isWireFrame | whether should be wireframe or solid template |
Returns | appropriately cast template |
ConePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getConeTemplate(const std:: string& templateHndle)
Return the spedified cone template, either solid or wireframe.
Parameters | |
---|---|
templateHndle | The handle of the desired cone template. Verifies that handle is to specified template type |
Returns | appropriately cast template, or nullptr if template handle incorrectly specified. |
CubePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getDefaultCubeTemplate(bool isWireFrame)
Return the default cube template, either solid or wireframe.
Parameters | |
---|---|
isWireFrame | whether should be wireframe or solid template |
Returns | appropriately cast template |
CubePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getCubeTemplate(const std:: string& templateHndle)
Return the spedified cube template.
Parameters | |
---|---|
templateHndle | The handle of the desired cube template. Verifies that handle is to specified template type |
Returns | appropriately cast template, or nullptr if template handle incorrectly specified. |
CylinderPrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getDefaultCylinderTemplate(bool isWireFrame)
Return the default cylinder template, either solid or wireframe.
Parameters | |
---|---|
isWireFrame | whether should be wireframe or solid template |
Returns | appropriately cast template |
CylinderPrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getCylinderTemplate(const std:: string& templateHndle)
Return the spedified cylinder template.
Parameters | |
---|---|
templateHndle | The handle of the desired cylinder template. Verifies that handle is to specified template type |
Returns | appropriately cast template, or nullptr if template handle incorrectly specified. |
IcospherePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getDefaultIcosphereTemplate(bool isWireFrame)
Return the default icosphere template, either solid or wireframe.
Parameters | |
---|---|
isWireFrame | whether should be wireframe or solid template |
Returns | appropriately cast template |
IcospherePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getIcosphereTemplate(const std:: string& templateHndle)
Return the spedified icosphere template.
Parameters | |
---|---|
templateHndle | The handle of the desired icosphere template. Verifies that handle is to specified template type |
Returns | appropriately cast template, or nullptr if template handle incorrectly specified. |
UVSpherePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getDefaultUVSphereTemplate(bool isWireFrame)
Return the default UVSphere template, either solid or wireframe.
Parameters | |
---|---|
isWireFrame | whether should be wireframe or solid template |
Returns | appropriately cast template |
UVSpherePrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: getUVSphereTemplate(const std:: string& templateHndle)
Return the spedified cube template.
Parameters | |
---|---|
templateHndle | The handle of the desired cube template. Verifies that handle is to specified template type |
Returns | appropriately cast template, or nullptr if template handle incorrectly specified. |
void esp:: assets:: managers:: AssetAttributesManager:: updateTemplateHandleLists(CORRADE_ UNUSED int templateID,
CORRADE_ UNUSED 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.
Parameters | |
---|---|
templateID | the ID of the template to remove |
templateHandle | the string key of the attributes desired. |
bool esp:: assets:: managers:: AssetAttributesManager:: verifyTemplateHandle(const std:: string& templateHandle,
const std:: string& attrType) protected
Verify that passed template handle describes attributes of type specified by passed primtive name (ie "cube", "capsule")
Parameters | |
---|---|
templateHandle | The handle to test. |
attrType | Type of primitive the attributes owning templateHandle describe. |
Returns | If template handle describes template for objects of desired primitive class name |
int esp:: assets:: managers:: AssetAttributesManager:: registerAttributesTemplateFinalize(AbstractPrimitiveAttributes::ptr attributesTemplate,
const std:: string& ignored = "") override protected
Add an AbstractPrimitiveAttributes object to the templateLibrary_
Parameters | |
---|---|
attributesTemplate | The attributes template. |
ignored | Not used for asset attributes templates - handle is derived by configuration. |
Returns | The index in the templateLibrary_ |
AbstractPrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: initNewAttribsInternal(AbstractPrimitiveAttributes::ptr newAttributes) override protected
Used Internally. Configure newly-created attributes with any default values, before any specific values are set.
Parameters | |
---|---|
newAttributes | Newly created attributes. |
AbstractPrimitiveAttributes::ptr esp:: assets:: managers:: AssetAttributesManager:: buildPrimAttributes(const std:: string& primClassName) protected
Build an AbstractPrimtiveAttributes object of type associated with passed class name.
Parameters | |
---|---|
primClassName | Magnum::Primitives class name of primitive being constructed |