// 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 "Components/SkeletalMeshComponent.h" #include "PXR_MorphTargetsManager.h" #include "PXR_MotionTrackingTypes.h" #include "PXR_FaceTrackingComponent.generated.h" UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent, DisplayName = "PICO Face Tracking Component"), ClassGroup = PXRHMD) class PICOXRMOTIONTRACKING_API UPXR_FaceTrackingComponent : public UActorComponent { GENERATED_BODY() public: UPXR_FaceTrackingComponent(); virtual void BeginPlay() override; virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; UFUNCTION(BlueprintCallable, Category = "Components|FaceTracking", meta = (UnsafeDuringActorConstruction = "true")) void SetBlendShapeValue(EPXRFaceBlendShape BlendShape, float Value); UFUNCTION(BlueprintCallable, Category = "Components|FaceTracking") float GetBlendShapeValue(EPXRFaceBlendShape BlendShape) const; UFUNCTION(BlueprintCallable, Category = "Components|FaceTracking") void ClearBlendShapeValues(); UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PXR|FaceTracking") FName FTTargetMeshComponentName; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PXR|FaceTracking") float InvalidFaceDataResetTime; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PXR|FaceTracking") TMap BlendShapeNameMapping; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PXR|FaceTracking") bool bUpdateFaceTracking; private: bool InitializeFaceTracking(); UPROPERTY() USkinnedMeshComponent* FTTargetMeshComponent; TStaticArray(EPXRFaceBlendShape::COUNT)> ValidBlendShape; FPXRMorphTargetsManager MorphTargetsManager; FPXRFaceTrackingData FaceData; float InvalidFaceDataTimer; static int FTComponentCount; bool IsTracking; FPXRFaceTrackingState TrackingState; };