Open 3D Engine ROS2 Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
ROS2::PrefabMakerUtils Namespace Reference

Common utils for Prefab Maker classes. More...

Functions

void AddRequiredComponentsToEntity (AZ::EntityId entityId)
 
AZ::IO::Path GetAzModelAssetPathFromModelPath (const AZ::IO::Path &modelPath)
 
void SetEntityTransformLocal (const gz::math::Pose3d &origin, AZ::EntityId entityId)
 
AzToolsFramework::Prefab::PrefabEntityResult CreateEntity (AZ::EntityId parentEntityId, const AZStd::string &name)
 
void SetEntityParent (AZ::EntityId entityId, AZ::EntityId parentEntityId)
 
AZStd::string MakeEntityName (const AZStd::string &rootName, const AZStd::string &type, size_t index=0)
 
AZStd::optional< Utils::AvailableAssetGetAssetFromPath (const Utils::UrdfAssetMap &sdfAssetsMapping, const AZStd::string &sdfMeshPath)
 
AZStd::optional< Utils::AvailableAssetGetAssetFromPath (const Utils::UrdfAssetMap &sdfAssetsMapping, const std::string &sdfMeshPath)
 

Detailed Description

Common utils for Prefab Maker classes.

Function Documentation

◆ AddRequiredComponentsToEntity()

void ROS2::PrefabMakerUtils::AddRequiredComponentsToEntity ( AZ::EntityId  entityId)

Add required components to the entity. Calling this will ensure all the required (default) components are added.

Parameters
entityIdentity to modify.

◆ CreateEntity()

AzToolsFramework::Prefab::PrefabEntityResult ROS2::PrefabMakerUtils::CreateEntity ( AZ::EntityId  parentEntityId,
const AZStd::string &  name 
)

Create a prefab entity in a hierarchy. The new entity will not yet be active.

Parameters
parentEntityIdid of parent entity for this new entity. Passing an invalid id would get the entity in the current context (for example, an entity which is currently open in the Editor).
namename for the new entity.
Returns
a result which is either a created prefab entity or an error.

◆ GetAssetFromPath() [1/2]

AZStd::optional< Utils::AvailableAsset > ROS2::PrefabMakerUtils::GetAssetFromPath ( const Utils::UrdfAssetMap &  sdfAssetsMapping,
const AZStd::string &  sdfMeshPath 
)

Get an Asset for a specified mesh given its path and mapping.

Parameters
sdfAssetsMappingmapping of SDF assets.
sdfMeshPatha path to the mesh for which the Asset is requested.
Returns
Asset for the mesh, if found in the mapping.

◆ GetAssetFromPath() [2/2]

AZStd::optional< Utils::AvailableAsset > ROS2::PrefabMakerUtils::GetAssetFromPath ( const Utils::UrdfAssetMap &  sdfAssetsMapping,
const std::string &  sdfMeshPath 
)

Get Asset from path. Version for std::string.

See also
GetAssetFromPath.

◆ GetAzModelAssetPathFromModelPath()

AZ::IO::Path ROS2::PrefabMakerUtils::GetAzModelAssetPathFromModelPath ( const AZ::IO::Path &  modelPath)

For a given model, return path to its Assets.

Parameters
modelPathpath to the model.
Returns
path to assets directory for this model.

◆ MakeEntityName()

AZStd::string ROS2::PrefabMakerUtils::MakeEntityName ( const AZStd::string &  rootName,
const AZStd::string &  type,
size_t  index = 0 
)

Create an entity name from arguments.

Parameters
rootNameroot of entity's name.
typetype of entity, depending on corresponding SDF tag. For example, "visual".
indexindex of entity, useful when multiple visuals or colliders are present for a single link.
Returns
entity name, for example "robotBumper_visual_1".

◆ SetEntityParent()

void ROS2::PrefabMakerUtils::SetEntityParent ( AZ::EntityId  entityId,
AZ::EntityId  parentEntityId 
)

Set the parent entity for an entity. The entity getting parent is expected to be inactive.

Parameters
entityIdthe id for entity that needs a parent.
parentEntityIdthe id for the parent entity.

◆ SetEntityTransformLocal()

void ROS2::PrefabMakerUtils::SetEntityTransformLocal ( const gz::math::Pose3d &  origin,
AZ::EntityId  entityId 
)

Set the transform for an entity.

Parameters
originpose for the entity to set.
entityIdentity which will be modified.