Documentation for the Unreal C++ Plugin
Loading...
Searching...
No Matches
HighlightComponent.h
Go to the documentation of this file.
1// Copyright(c) Pixo Group. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Components/ActorComponent.h"
7#include "HighlightComponent.generated.h"
8
9UENUM()
10enum class EHighlightColor : uint8
11{
12 None = 0,
13 Orange = 249,
14 White = 250,
15 Blue = 251,
16 Green = 252,
17 Yellow = 253,
18 Red = 254,
19 Pink = 255
20};
21
22DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnHighlightValueChanged);
23DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnHighlightChanged);
28UCLASS(Blueprintable, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
29class PIXOCORE_API UHighlightComponent : public UActorComponent
30{
31 GENERATED_BODY()
32
33public:
35
36protected:
37 virtual void BeginPlay() override;
38
39public:
44 UFUNCTION(BlueprintCallable)
45 void UpdateHighlightValue(EHighlightColor HighlightColor);
50 UFUNCTION(BlueprintCallable)
51 void ActivatePulseHighlight(bool Activate);
57 UFUNCTION(BlueprintCallable, Category = "Highlight Functionality")
58 void ManuallyActivatePulseHighlight(bool Activate, TArray<UMeshComponent*> TargetComponent);
59
66 UFUNCTION(BlueprintCallable, Category = "Highlight Functionality")
67 void ManuallyActivatePulseHighlightOnSpecificMaterials(bool Activate, TArray<UMeshComponent*> TargetComponent, TArray<int> TargetMaterialIndexes);
68
69 UPROPERTY()
70 EHighlightColor CurrentHighlight = EHighlightColor::None;
71 UPROPERTY()
72 bool IsShowHighlight = true;
73 UPROPERTY(BlueprintReadWrite)
74 FTimerHandle PulseHighlightTimerHandle;
75
76 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Highlight")
77 bool AlwaysEmissiveHighlight = false;
78
79 UPROPERTY(BlueprintAssignable)
80 FOnHighlightValueChanged OnHighlightValueChanged;
81
82 UPROPERTY(BlueprintAssignable)
83 FOnHighlightChanged OnHighlightChanged;
84
85 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Highlight")
86 bool UseIsObjectActiveInsteadOfActiveSteps = false;
87
88 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Highlight")
89 TArray<FText> HighlightActiveOnSteps;
90
91 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Highlight")
92 bool ActivateHighlightOnEachStep = false;
94 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Highlight")
95 bool DeactivateHighlightOnEachInactiveStep = true;
96
97 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Highlight")
98 TArray<UStaticMeshComponent*> DeactivatedMeshes;
99
100private:
101 UFUNCTION()
102 void PerformPulseHighlight();
103 void ChangeHighlightMaterialColor(const TFunctionRef<FVector()> Color, TArray<TWeakObjectPtr<UMeshComponent>> TargetMeshes);
104 void ChangeHighlightSpecificMaterialColor(const TFunctionRef<FVector()> Color, TArray<TWeakObjectPtr<UMeshComponent>> TargetMeshes, TArray<int> MaterialIndexes);
105 void UpdatedOwnerMeshComponents();
106
107 TArray<int> AffectedMaterialIndexes;
108
109 TMap<EHighlightColor, FLinearColor> ColorMap;
110 float HighlightTime = 0.0f;
111 float PulseDirection = 0.0f;
112 bool BlockPulsing = false;
113 TArray<TWeakObjectPtr<UMeshComponent>> OwnerMeshComponents;
114};
EHighlightColor
UENUM()
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnHighlightValueChanged)
Component responsible for managing object highlighting.
TMap< EHighlightColor, FLinearColor > ColorMap
TArray< FText > HighlightActiveOnSteps
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Highlight")
TArray< TWeakObjectPtr< UMeshComponent > > OwnerMeshComponents
TArray< int > AffectedMaterialIndexes
FOnHighlightChanged OnHighlightChanged
UPROPERTY(BlueprintAssignable)
TArray< UStaticMeshComponent * > DeactivatedMeshes
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Highlight")
FTimerHandle PulseHighlightTimerHandle
UPROPERTY(BlueprintReadWrite)
FOnHighlightValueChanged OnHighlightValueChanged
UPROPERTY(BlueprintAssignable)