Skip to content

Commit

Permalink
Merge branch '5.1' into 5.2_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlicekdominik committed Oct 18, 2023
2 parents c4ab1b5 + 04a24c1 commit b18187e
Show file tree
Hide file tree
Showing 11 changed files with 200 additions and 29 deletions.
10 changes: 6 additions & 4 deletions ActorInteractionPlugin.uplugin
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "3.0.1.7",
"Version": 3,
"VersionName": "3.0.1.8",
"FriendlyName": "Mountea Interaction System",
"Description": "Mountea Interaction System (formerly `Actor Interaction Plugin`) is an Open-source Mountea Framework components-based simple framework providing utilities for smart Actor Interaction with other Actors. Developed with Game Developers in mind to allow as easy as possible implementation while maintaining high scalability and diverse options to tweak everything.",
"Description": "Mountea Interaction System is an Open-source Mountea Framework components-based simple framework providing utilities for smart Actor Interaction with other Actors. Developed with Game Developers in mind to allow as easy as possible implementation while maintaining high scalability and diverse options to tweak everything.",
"Category": "Mountea Framework",
"CreatedBy": "Dominik Pavlicek",
"CreatedByURL": "https://github.com/Mountea-Framework",
"DocsURL": "https://github.com/Mountea-Framework/ActorInteractionPlugin/wiki",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/ca842c00ec0d4db0b3aad17701e1637b",
"SupportURL": "https://bit.ly/DominikPavlicek_SupportServer",
"EngineVersion": "5.2.0",
"EngineVersion": "5.1.0",
"CanContainContent": true,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
"Installed": true,
"Modules": [
{
Expand Down
Binary file not shown.
Binary file modified Content/Materials/OverlayMaterial/M_OverlayMaterial.uasset
Binary file not shown.
Binary file added Content/Textures/Noise/T_Voronoi.uasset
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ UActorInteractableComponentBase::UActorInteractableComponentBase()

bInteractionHighlight = true;
StencilID = 133;
bInteractionHighlight = true;
HighlightType = EHighlightType::EHT_OverlayMaterial;
StencilID = 133;

LifecycleMode = EInteractableLifecycle::EIL_Cycled;
LifecycleCount = -1;
Expand Down Expand Up @@ -120,6 +123,10 @@ void UActorInteractableComponentBase::BeginPlay()

// Widget
OnWidgetUpdated.AddUniqueDynamic(this, &UActorInteractableComponentBase::OnWidgetUpdatedEvent);

// Highlight
OnHighlightTypeChanged.AddUniqueDynamic(this, &UActorInteractableComponentBase::OnHighlightTypeChangedEvent);
OnHighlightMaterialChanged.AddUniqueDynamic(this, &UActorInteractableComponentBase::OnHighlightMaterialChangedEvent);

// Dependency
InteractableDependencyStarted.AddUniqueDynamic(this, &UActorInteractableComponentBase::InteractableDependencyStartedCallback);
Expand Down Expand Up @@ -627,20 +634,51 @@ void UActorInteractableComponentBase::SetState(const EInteractableStateV2 NewSta
void UActorInteractableComponentBase::StartHighlight()
{
SetHiddenInGame(false, true);
for (const auto& Itr : HighlightableComponents)
switch (HighlightType)
{
Itr->SetRenderCustomDepth(bInteractionHighlight);
Itr->SetCustomDepthStencilValue(StencilID);
case EHighlightType::EHT_PostProcessing:
{
for (const auto Itr : HighlightableComponents)
{
Itr->SetRenderCustomDepth(bInteractionHighlight);
Itr->SetCustomDepthStencilValue(StencilID);
}
}
break;
case EHighlightType::EHT_OverlayMaterial:
{
for (const auto Itr : HighlightableComponents)
{
Itr->SetOverlayMaterial(HighlightMaterial);
}
}
case EHighlightType::EHT_Default:
default: break;
}
}

void UActorInteractableComponentBase::StopHighlight()
{
SetHiddenInGame(true, true);
for (const auto& Itr : HighlightableComponents)
switch (HighlightType)
{
//Itr->SetRenderCustomDepth(false);
Itr->SetCustomDepthStencilValue(0);
case EHighlightType::EHT_PostProcessing:
{
for (const auto Itr : HighlightableComponents)
{
Itr->SetCustomDepthStencilValue(0);
}
}
break;
case EHighlightType::EHT_OverlayMaterial:
{
for (const auto Itr : HighlightableComponents)
{
Itr->SetOverlayMaterial(nullptr);
}
}
case EHighlightType::EHT_Default:
default: break;
}
}

Expand Down Expand Up @@ -1157,6 +1195,26 @@ void UActorInteractableComponentBase::SetInteractableName(const FText& NewName)
InteractableName = NewName;
}

EHighlightType UActorInteractableComponentBase::GetHighlightType() const
{ return HighlightType; }

void UActorInteractableComponentBase::SetHighlightType(const EHighlightType NewHighlightType)
{
HighlightType = NewHighlightType;

OnHighlightTypeChanged.Broadcast(NewHighlightType);
}

UMaterialInterface* UActorInteractableComponentBase::GetHighlightMaterial() const
{ return HighlightMaterial; }

void UActorInteractableComponentBase::SetHighlightMaterial(UMaterialInterface* NewHighlightMaterial)
{
HighlightMaterial = NewHighlightMaterial;

OnHighlightMaterialChanged.Broadcast(NewHighlightMaterial);
}

ETimingComparison UActorInteractableComponentBase::GetComparisonMethod() const
{ return ComparisonMethod; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractableComponentAutomatic : public U
virtual void InteractionStarted(const float& TimeStarted, const FKey& PressedKey, const TScriptInterface<IActorInteractorInterface>& CausingInteractor) override;
virtual void InteractionStopped(const float& TimeStarted, const FKey& PressedKey, const TScriptInterface<IActorInteractorInterface>& CausingInteractor) override;

public:

virtual FInteractionStarted& GetOnInteractionStartedHandle() override;
virtual FInteractionStopped& GetOnInteractionStoppedHandle() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,31 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractableComponentBase : public UWidge
UFUNCTION(BlueprintCallable, Category="Interaction")
virtual void SetInteractableName(const FText& NewName) override;

/**
* Return Highlightable Type of this Interactable Component.
*/
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Interaction")
virtual EHighlightType GetHighlightType() const override;
/**
* Tries to set new Highlight Type.
*
* @param NewHighlightType Value of Highlight type.
*/
UFUNCTION(BlueprintCallable, Category="Interaction")
virtual void SetHighlightType(const EHighlightType NewHighlightType) override;
/**
* Returns Highlight Material if any specified.
*/
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Interaction")
virtual UMaterialInterface* GetHighlightMaterial() const override;
/**
* Tries to set new Highlight Material.
*
* @param NewHighlightMaterial Material Instance to be used as new HighlightMaterial.
*/
UFUNCTION(BlueprintCallable, Category="Interaction")
virtual void SetHighlightMaterial(UMaterialInterface* NewHighlightMaterial) override;

/**
* Returns value of Comparison Method.
*/
Expand Down Expand Up @@ -704,6 +729,18 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractableComponentBase : public UWidge
UFUNCTION(BlueprintImplementableEvent, Category="Interaction")
void OnWidgetUpdatedEvent();

/**
* Event called once Highlight Type has changed.
*/
UFUNCTION(BlueprintImplementableEvent, Category="Interaction")
void OnHighlightTypeChangedEvent(const EHighlightType& NewHighlightType);

/**
* Event called once Highlight Material has changed.
*/
UFUNCTION(BlueprintImplementableEvent, Category="Interaction")
void OnHighlightMaterialChangedEvent(const UMaterialInterface* NewHighlightMaterial);

UFUNCTION()
void OnInteractionProgressExpired(const float ExpirationTime, const FKey UsedKey, const TScriptInterface<IActorInteractorInterface>& CausingInteractor);
#pragma endregion
Expand Down Expand Up @@ -1180,6 +1217,18 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractableComponentBase : public UWidge
UPROPERTY(BlueprintAssignable, Category="Interaction")
FInteractorChanged OnInteractorChanged;

/**
* Event called once HighlightType has changed.
*/
UPROPERTY(BlueprintAssignable, Category="Interaction")
FHighlightTypeChanged OnHighlightTypeChanged;

/**
* Event called once HighlightMaterial has changed.
*/
UPROPERTY(BlueprintAssignable, Category="Interaction")
FHighlightMaterialChanged OnHighlightMaterialChanged;

FInteractableDependencyStarted InteractableDependencyStarted;

FInteractableDependencyStopped InteractableDependencyStopped;
Expand All @@ -1188,6 +1237,8 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractableComponentBase : public UWidge

#pragma region Handles

public:

virtual FOnInteractableSelected& GetOnInteractableSelectedHandle() override
{ return OnInteractableSelected; };
virtual FInteractorFound& GetOnInteractorFoundHandle() override
Expand All @@ -1212,6 +1263,10 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractableComponentBase : public UWidge
{ return OnInteractionCanceled; };
virtual FInteractableDependencyChanged& GetInteractableDependencyChangedHandle() override
{ return OnInteractableDependencyChanged; };
virtual FHighlightTypeChanged& GetHighlightTypeChanged() override
{ return OnHighlightTypeChanged; };
virtual FHighlightMaterialChanged& GetHighlightMaterialChanged() override
{ return OnHighlightMaterialChanged; };
virtual FInteractableDependencyStarted& GetInteractableDependencyStarted() override
{ return InteractableDependencyStarted; };
virtual FInteractableDependencyStopped& GetInteractableDependencyStopped() override
Expand All @@ -1229,7 +1284,7 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractableComponentBase : public UWidge
#pragma endregion

#pragma region Widget

/**
* Event called any time any value of 'UserInterfaceSettings' has changed.
*/
Expand Down Expand Up @@ -1394,6 +1449,14 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractableComponentBase : public UWidge
UPROPERTY(SaveGame, EditAnywhere, BlueprintReadOnly, Category="Interaction|Optional", meta=(EditCondition="bInteractionHighlight == true", UIMin=0, ClampMin=0, UIMax=255, ClampMax=255))
int32 StencilID;

/**
* Defines what Highlight Type is used.
*/
UPROPERTY(SaveGame, EditAnywhere, BlueprintReadOnly, Category="Interaction|Optional")
EHighlightType HighlightType;
UPROPERTY(SaveGame, EditAnywhere, BlueprintReadOnly, Category="Interaction|Optional", meta=(EditCondition="bInteractionHighlight == true && HighlightType==EHighlightType::EHT_OverlayMaterial"))
UMaterialInterface* HighlightMaterial = nullptr;

/**
* List of Interaction Keys for each platform.
* There is no validation for Keys validation! Nothing stops you from setting Keyboard keys for Consoles. Please, be careful with this variable!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@

#include "CoreMinimal.h"
#include "Engine/DeveloperSettings.h"
#include "Materials/MaterialInterface.h"
#include "ActorInteractionPluginSettings.generated.h"

class UDataTable;
class UMaterialInterface;
class UUserWidget;

/**
* Actor Interaction Plugin global settings.
* Mountea Interaction System global settings.
*/
UCLASS(config = MounteaSettings, meta = (DisplayName = "Actor Interaction Plugin Settings"))
UCLASS(config = MounteaSettings, meta = (DisplayName = "Mountea Interaction System Settings"))
class ACTORINTERACTIONPLUGIN_API UActorInteractionPluginSettings : public UDeveloperSettings
{

Expand All @@ -21,29 +23,35 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractionPluginSettings : public UDevel
UActorInteractionPluginSettings()
{
CategoryName = TEXT("Mountea Framework");
SectionName = TEXT("Actor Interaction Plugin");
SectionName = TEXT("Mountea Interaction System");

bEditorDebugEnabled = 0;
}

/* Defines whether in-editor debug is enabled. */
UPROPERTY(config, EditAnywhere, Category="Editor")
uint8 bEditorDebugEnabled : 1;

/* Defines how often is the Interaction widget updated per second.*/
UPROPERTY(config, EditAnywhere, Category = "Widgets", meta=(Units="s", UIMin=0.001, ClampMin=0.001, ConfigRestartRequired = true))
UPROPERTY(config, EditAnywhere, Category = "Widgets", meta=(Units="s", UIMin=0.001, ClampMin=0.001))
float WidgetUpdateFrequency = 0.05f;

/* Defines default Interactable Widget class.*/
UPROPERTY(config, EditAnywhere, Category = "Widgets", meta=(AllowedClasses="UserWidget", MustImplement="/Script/ActorInteractionPlugin.ActorInteractionWidget", ConfigRestartRequired = true))
UPROPERTY(config, EditAnywhere, Category = "Widgets", meta=(AllowedClasses="/Script/UMG.UserWidget", MustImplement="/Script/ActorInteractionPlugin.ActorInteractionWidget"))
TSoftClassPtr<UUserWidget>InteractableDefaultWidgetClass;

/* Defines default DataTable which contains Interactable data values.*/
UPROPERTY(config, EditAnywhere, Category = "Interaction Data", meta=(AllowedClasses = "DataTable", ConfigRestartRequired = true))
UPROPERTY(config, EditAnywhere, Category = "Interaction Data", meta=(AllowedClasses = "/Script/Engine.DataTable"))
TSoftObjectPtr<UDataTable> InteractableDefaultDataTable;

/* Defines default DataTable which contains Interactable data values.*/
UPROPERTY(config, EditAnywhere, Category = "Interaction Data")
TSoftObjectPtr<UMaterialInterface> InteractableDefaultHighlightMaterial;

#if WITH_EDITOR
virtual FText GetSectionText() const override
{
return NSLOCTEXT("ActorInteractionPlugin", "MounteaSettingsDescription", "Actor Interaction Plugin");
return NSLOCTEXT("ActorInteractionPlugin", "MounteaSettingsDescription", "Mountea Interaction System");
}

virtual FText GetSectionDescription() const override
Expand All @@ -70,4 +78,7 @@ class ACTORINTERACTIONPLUGIN_API UActorInteractionPluginSettings : public UDevel

TSoftClassPtr<UUserWidget> GetInteractableDefaultWidgetClass() const
{ return InteractableDefaultWidgetClass; };

UMaterialInterface* GetDefaultHighlightMaterial() const
{ return InteractableDefaultHighlightMaterial.LoadSynchronous(); };
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
#include "Engine/EngineTypes.h"
#include "InteractionHelpers.generated.h"

#define INTERACTOR_TAG_NAME TEXT("Interactor")
#define INTERACTABLE_TAG_NAME TEXT("Interactable")

/**
* Type of Interactable Actor Component.
*
* Defines how is interaction processed with Interactable Actor.
*/
UENUM(BlueprintType, meta=(DisplayName="DEPRECATED_InteractableType", Deprecated))
UENUM(BlueprintType, meta=(DisplayName="DEPRECATED_InteractableType", Deprecated, ScriptName="DEPRECATED_InteractableType"))
enum class EInteractableType : uint8
{
EIT_Hold UMETA(DisplayName = "Hold", Tooltip = "Press and hold the button."),
Expand All @@ -32,7 +29,7 @@ enum class EInteractableType : uint8
*
* Machine States of the Interactable Actor Component.
*/
UENUM(BlueprintType, meta=(DisplayName="DEPRECATED_InteractableState", Deprecated))
UENUM(BlueprintType, meta=(DisplayName="DEPRECATED_InteractableState", Deprecated, ScriptName="DEPRECATED_InteractableState"))
enum class EInteractableState : uint8
{
EIS_Standby UMETA(DisplayName = "StandBy", ToolTip = "Interactable is enabled"),
Expand Down Expand Up @@ -64,7 +61,7 @@ enum class EInteractableLifecycle : uint8
*
* Defines how Interactor Actor Component does process interaction.
*/
UENUM(BlueprintType, meta=(DisplayName="DEPRECATED_InteractorType", Deprecated))
UENUM(BlueprintType, meta=(DisplayName="DEPRECATED_InteractorType", Deprecated, ScriptName="DEPRECATED_InteractorType"))
enum class EInteractorType : uint8
{
EIT_Active UMETA(DisplayName = "Active", ToolTip = "Interaction is allowed only if the tracing is colliding with collision box of the Interactable Actor Component."),
Expand All @@ -79,7 +76,7 @@ enum class EInteractorType : uint8
*
* Machine States of the Interactor Actor Component.
*/
UENUM(BlueprintType, meta=(DisplayName="DEPRECATED_InteractorState", Deprecated))
UENUM(BlueprintType, meta=(DisplayName="DEPRECATED_InteractorState", Deprecated, ScriptName="DEPRECATED_InteractorState"))
enum class EInteractorState : uint8
{
EIS_Disabled UMETA(DisplayName = "Disabled", Tooltip = "Interactor is disabled"),
Expand Down
Loading

0 comments on commit b18187e

Please sign in to comment.