unreal_functions

Remote functions for unreal.

xrfeitoria.utils.functions.unreal_functions.check_asset_in_engine(path: str, raise_error: bool = False) bool[source]

Check if an asset exists in the engine.

Parameters:
  • path (str) – asset path in unreal, e.g. “/Game/Resources/Mat0”

  • raise_error (bool) – raise error if the asset does not exist

Returns:

bool – True if the asset exists, False otherwise

Raises:

ValueError – if the asset does not exist and raise_error is True

xrfeitoria.utils.functions.unreal_functions.delete_asset(asset_path: str) None[source]

Delete asset.

Parameters:

asset_path (str) – asset path in unreal, e.g. “/Game/Resources/Mat0”

xrfeitoria.utils.functions.unreal_functions.duplicate_asset(src_path: str, dst_path: str, replace: bool = False) None[source]

Duplicate asset in unreal.

Parameters:
  • src_path (str) – source asset path in unreal, e.g. “/Game/Resources/Mat0”

  • dst_path (str) – destination asset path in unreal, e.g. “/Game/Resources/Mat1”

xrfeitoria.utils.functions.unreal_functions.get_mask_color(stencil_value: int) Tuple[int, int, int][source]

Retrieves the RGB color value associated with the given stencil value.

Parameters:

stencil_value (int) – The stencil value for which to retrieve the color.

Returns:

Tuple[int, int, int] – The RGB color value associated with the stencil value.

xrfeitoria.utils.functions.unreal_functions.get_mask_color_file() str[source]

Returns the path of the mask color file.

Returns:

str – The path of the mask color file.

xrfeitoria.utils.functions.unreal_functions.get_rotation_to_look_at(location: Tuple[float, float, float], target: Tuple[float, float, float]) Tuple[float, float, float][source]

Get the rotation of an object to look at another object.

Parameters:
  • location (Vector) – Location of the object.

  • target (Vector) – Location of the target object.

Returns:

Vector – Rotation of the object.

xrfeitoria.utils.functions.unreal_functions.get_skeleton_names(actor_asset_path: str) List[str][source]

Retrieves the names of the bones in the skeleton of a SkeletalMeshActor (also can be child class of it).

Parameters:

actor_asset_path (str) – The asset path of the SkeletalMeshActor.

Returns:

List[str] – The names of the bones in the skeleton.

xrfeitoria.utils.functions.unreal_functions.import_anim(path: str, skeleton_path: str, dest_path: str | None = None, replace: bool = True) List[str][source]

Import animation to the default asset path.

Parameters:
  • path (str) – The file path to import, e.g. “D:/assets/SMPL_XL-Animation.fbx”.

  • skeleton_path (str) – The path to the skeleton, e.g. “/Game/XRFeitoriaUnreal/Assets/SMPL_XL_Skeleton”.

  • dest_path (str, optional) – The destination directory in the engine. Defaults to None, falls back to {skeleton_path.parent}/Animation.

  • replace (bool, optional) – whether to replace the existing asset. Defaults to True.

Returns:

List[str] – A list of paths to the imported animations, e.g. [“/Game/XRFeitoriaUnreal/Assets/SMPL_XL-Animation”].

xrfeitoria.utils.functions.unreal_functions.import_asset(path: str | List[str], dst_dir_in_engine: str | None = None, replace: bool = True, with_parent_dir: bool = True) str | List[str][source]

Import assets to the default asset path.

Parameters:
  • path (Union[str, List[str]]) – a file path or a list of file paths to import, e.g. “D:/assets/SMPL_XL.fbx”

  • dst_dir_in_engine (Optional[str], optional) – destination directory in the engine. Defaults to None falls back to ‘/Game/XRFeitoriaUnreal/Assets’

  • replace (bool, optional) – whether to replace the existing asset. Defaults to True.

  • with_parent_dir (bool, optional) – whether to create a parent directory that contains the imported asset. If False, the imported asset will be in dst_dir_in_engine directly. Defaults to True.

Returns:

Union[str, List[str]] – a path or a list of paths to the imported assets, e.g. “/Game/XRFeitoriaUnreal/Assets/SMPL_XL”

xrfeitoria.utils.functions.unreal_functions.new_seq_data(asset_path: str, sequence_path: str, map_path: str) None[source]

Create a new data asset of sequence data.

Parameters:
  • asset_path (str) – path of the data asset.

  • sequence_path (str) – path of the sequence asset.

  • map_path (str) – path of the map asset.

Returns:

unreal.DataAsset – the created data asset.

Notes

SequenceData Properties:
  • “SequencePath”: str

  • “MapPath”: str

xrfeitoria.utils.functions.unreal_functions.open_asset(asset_path: str) None[source]

Open asset.

Parameters:

asset_path (str) – asset path in unreal, e.g. “/Game/Resources/Mat0”

xrfeitoria.utils.functions.unreal_functions.open_level(asset_path: str) None[source]

Open a level.

Parameters:

asset_path (str) – asset path in unreal, e.g. “/Game/Maps/Map0”

xrfeitoria.utils.functions.unreal_functions.save_current_level(asset_path: str | None = None) None[source]

Save the current opened level.