// Copyright PICO Technology Co., Ltd. All rights reserved. // This plugin incorporates portions of the UnrealĀ® Engine. UnrealĀ® is a trademark or registered trademark of Epic Games, Inc. in the United States of America and elsewhere. // Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "PXR_MRTypes.h" #include "PXR_AnchorComponent.h" #include "PXR_MRFunctionLibrary.generated.h" UCLASS() class PICOXRMR_API UPICOXRMRFunctionLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: /// /// Gets the universally unique identifier (UUID) of an anchor entity. /// /// The bound actor of the anchor entity to get UUID for. /// Returns the UUID of the anchor entity. /// Bool: /// /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static bool PXR_GetAnchorEntityUuid(AActor* BoundActor, FPICOSpatialUUID& OutAnchorUUID,EPICOResult& OutResult); /// /// Gets the universally unique identifier (UUID) of an anchor entity. /// /// Specifies the AnchorComponent for which you want to get anchor entity Uuid information. /// Returns the UUID of the anchor entity. /// Bool: /// /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static bool PXR_GetAnchorEntityUuidByComponent(const UPICOAnchorComponent* AnchorComponent, FPICOSpatialUUID& OutAnchorUUID,EPICOResult& OutResult); /// /// Gets the information about the Bounding Box 2D for a SceneCapture. /// Before calling this method, you need to load SceneCaptures and get the SceneInfos first. The result contains the UUIDs of SceneCaptures loaded. /// /// Specifies the uuid of the SceneCapture. /// /// * `Center`: Returns the offset of the boundary's position relative to the world position. /// * `Extent`: Returns the width and height of the boundary. /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_GetSceneBoundingBox2D(const FPICOSpatialUUID& UUID, FPICOBoundingBox2D& OutBoundingBox2D); /// /// Gets the information about the polygon (irregular plane) for an anchor entity. /// Before calling this method, you need to load SceneCaptures and get the SceneInfos first. The result contains the UUIDs of SceneCaptures loaded. /// /// Specifies the uuid of the SceneCapture. /// /// * `Vertices`: The positions of the polygon's vertices on the X, Y, and Z axis. /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_GetSceneBoundingPolygon(const FPICOSpatialUUID& UUID, TArray& OutPolygonVertices); /// /// Gets the information about the Bounding Box 3D for an SceneCapture. /// Before calling this method, you need to load SceneCaptures and get the SceneInfos first. The result contains the UUIDs of SceneCaptures loaded. /// /// Specifies the uuid of the SceneCapture. /// /// * `Center`: Returns the offset of the boundary's position relative to the world position. /// * `Extent`: Returns the width, height and depth of the boundary. /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_GetSceneBoundingBox3D(const FPICOSpatialUUID& UUID, FPICOBoundingBox3D& OutBoundingBox3D); /// /// Gets the pose of an actor's anchor entit by Actor. /// /// Specifies the Actor for which you want to get anchor entity pose information. /// /// * `Location`: The location of the anchor entity. /// * `Rotation`: The rotation of the anchor entity. /// * `Scale`: The scale of the anchor entity. `1` by default. /// /// Bool: /// /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static bool PXR_GetAnchorPoseByActor(AActor* BoundActor, FTransform& OutTransform,EPICOResult& OutResult); /// /// Gets the pose of an actor's anchor entity by AnchorComponent. /// /// Specifies the AnchorComponent for which you want to get anchor entity pose information. /// /// * `Location`: The location of the anchor entity. /// * `Rotation`: The rotation of the anchor entity. /// * `Scale`: The scale of the anchor entity. `1` by default. /// /// Bool: /// /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static bool PXR_GetAnchorPoseByComponent(UPICOAnchorComponent* AnchorComponent, FTransform& OutTransform,EPICOResult& OutResult); /// /// Destroy anchor entity by AnchorComponent. /// /// Specifies the AnchorComponent for the anchor you want to destroy. /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_DestroyAnchorByComponent(UPICOAnchorComponent* AnchorComponent,EPICOResult& OutResult); /// /// Destroy anchor entity by Actor. /// /// Specifies the Actor for the anchor you want to destroy. /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_DestroyAnchorByActor(AActor* BoundActor,EPICOResult& OutResult); /// /// Checks if an Actor's anchor is valid. /// /// Specifies the Actor for the anchor you want to check. /// Bool: /// /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static bool PXR_IsAnchorValidForActor(AActor* BoundActor); /// /// Checks if an AnchorComponent's anchor is valid. /// /// Specifies the AnchorComponent for the anchor you want to check. /// Bool: /// /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static bool PXR_IsAnchorValidForComponent(UPICOAnchorComponent* AnchorComponent); /// /// Spawns an actor from the specified anchor load result. /// /// The world context in which the actor will be spawned. /// The anchor load result containing information for spawning, including the anchor's handle, UUID, and location. /// The class of the actor to be spawned. /// The spawned actor, or nullptr if spawning fails. /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR", meta = (WorldContext = "WorldContext", UnsafeDuringActorConstruction = "true")) static AActor* PXR_SpawnActorFromLoadResult(UObject* WorldContext, const FAnchorLoadResult& LoadResult, UClass* ActorClass); /// /// From AnchorHandle To FString. /// /// Specifies the AnchorHandle for which you want to convert. /// FString of AnchorHandle. /// UFUNCTION(BlueprintPure, meta = (DisplayName = "ToString (Anchor Handle)", CompactNodeTitle = "->", BlueprintAutocast), Category = "PXR|PXRMR") static FString PXR_FromAnchorToString(const FPICOSpatialHandle& AnchorHandle); /// /// From UUID To FString. /// /// Specifies the AnchorUUID for which you want to convert. /// FString of UUID. /// UFUNCTION(BlueprintPure, meta = (DisplayName = "ToString (Anchor UUID)", CompactNodeTitle = "->", BlueprintAutocast), Category = "PXR|PXRMR") static FString PXR_FromUUIDToString(const FPICOSpatialUUID& AnchorUUID); /// /// From FString To UUID. /// /// Specifies the AnchorUUIDString for which you want to convert. /// UUID. /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static FPICOSpatialUUID PXR_FromStringToUUID(const FString& AnchorUUIDString); /// /// Closes Spatial Mesh scanning. /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_CloseSpatialMeshScanning(); /// /// Closes Spatial Anchor service. /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_CloseSpatialAnchorService(); /// /// Closes Scene Capture service. /// /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_CloseSceneCaptureService(); /// /// Creates Scene Bounding Polygon. /// /// Specifies the actor bound by polygon. /// True if never create collision, false otherwise. /// True if you want to flip polygon, false otherwise. It is recommend to be ture in Floor type, otherwise the orientation is down, which may affect rendering and collision. /// True if you want to use Wireframe, false otherwise. /// The transform of polygon. /// The set of vertices. /// Default mesh material. /// Bool: /// /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_CreateSceneBoundingPolygon(AActor* BoundActor,bool bNeverCreateCollision,bool bFlipPolygon,bool UseWireframe,const FTransform& Transform,const TArray& Vertices,UMaterialInterface* DefaultMeshMaterial); /// /// Creates Scene Bounding Polygon. /// /// Specifies the actor bound by polygon. /// True if never create collision, false otherwise. /// True if you want to flip polygon, false otherwise. It is recommend to be ture in Floor type, otherwise the orientation is down, which may affect rendering and collision. /// Used to adjust the scaling/rotation/offset of the UVs. /// The transform of polygon. /// The set of vertices. /// Default mesh material. /// Bool: ///
    ///
  • `true` - success
  • ///
  • `false` - failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_CreateSceneBoundingPolygonWithUVAdjustment(AActor* BoundActor,bool bNeverCreateCollision,bool bFlipPolygon,const FPICOUVAdjustment& UVAdjustment,const FTransform& Transform,const TArray& Vertices,UMaterialInterface* DefaultMeshMaterial); /// /// Changes Spatial Mesh's Lod Setting. /// /// Specifies the Lod for which you want to set. /// Bool: ///
    ///
  • `true` - success
  • ///
  • `false` - failure
  • ///
///
UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static bool PXR_ChangeSpatialMeshLodSetting(EPICOSpatialMeshLod SpatialMeshLod); /// /// Gets Spatial Mesh Lod Setting. /// /// Spatial Mesh Lod. /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static EPICOSpatialMeshLod PXR_GetSpatialMeshLodSetting(); /// /// Gets Spatial Mesh scanning state. /// /// State of Spatial Mesh scanning: /// - Initialized: After checking the Spacial Mesh feature in ProjectSettings, the initialization will be completed during the app startup process. /// - Running: This state is set after the Spatial Mesh scanning has been successfully started. /// - Stopped: This state is set after the Spatial Mesh scanning has been successfully shut down. /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static EPICOMRState PXR_GetSpatialMeshScanningState(); /// /// Get Spatial Anchor service state. /// /// State of Spatial Anchor service: /// - Initialized: After checking the Spatial Anchor feature in ProjectSettings, the initialization will be completed during the app startup process. /// - Running: This state is set after the Spatial Anchor service has been successfully started. /// - Stopped: This state is set after the Spatial Anchor service has been successfully shut down. /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static EPICOMRState PXR_GetSpatialAnchorServiceState(); /// /// Get Scene Capture service state. /// /// State of Scene Capture service: /// - Initialized: After checking the Scene Capture feature in ProjectSettings, the initialization will be completed during the app startup process. /// - Running: This state is set after the Scene Capture service has been successfully started. /// - Stopped: This state is set after the Scene Capture service has been successfully shut down. /// UFUNCTION(BlueprintPure, Category = "PXR|PXRMR") static EPICOMRState PXR_GetSceneCaptureServiceState(); /// /// Reset Spatial Mesh Infos State. /// UFUNCTION(BlueprintCallable, Category = "PXR|PXRMR") static void PXR_ResetSpatialMeshInfosState(); };