Skip to content
Snippets Groups Projects
Commit b9bb8062 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

Merge remote-tracking branch 'remotes/upstream/dev/5.3' into refactor/plugin_separation

# Conflicts:
#	Source/RWTHVRToolkit/Private/Utility/RWTHVRUtilities.cpp
#	Source/RWTHVRToolkit/Public/Utility/RWTHVRUtilities.h
parents f7f383e3 53c84a3f
No related branches found
No related tags found
2 merge requests!85UE5.3-2023.1-rc3,!79Plugin Separation: Move the RWTHVRCluster Module into its own Plugin with respective content. Removes Toolkit dependency to nDisplay
This commit is part of merge request !79. Comments created here will be created in the context of that merge request.
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -4,8 +4,10 @@
#include "Interaction/Interactables/IntenSelect/IntenSelectableScoring.h"
#include "Interaction/Interactables/IntenSelect/IntenSelectableSinglePointScoring.h"
#include "Kismet/KismetSystemLibrary.h"
#include "Logging/StructuredLog.h"
#include "Misc/MessageDialog.h"
#include "Pawn/IntenSelectComponent.h"
#include "Utility/RWTHVRUtilities.h"
UIntenSelectable::UIntenSelectable() { PrimaryComponentTick.bCanEverTick = true; }
......@@ -45,7 +47,8 @@ void UIntenSelectable::BeginPlay()
{
if (ScoringBehaviours.Num() == 0)
{
ShowErrorAndQuit(
UE_LOGFMT(
Toolkit, Error,
"Please assign the Scoring Behaviour manually when using more than one IntenSelectable Component!");
}
}
......@@ -57,36 +60,36 @@ void UIntenSelectable::BeginPlay()
void UIntenSelectable::HandleOnSelectStartEvents(const UIntenSelectComponent* IntenSelect, const FHitResult& HitResult)
{
for (const UHoverBehaviour* b : OnSelectBehaviours)
for (const UHoverBehaviour* CurrentHoverBehaviour : OnHoverBehaviours)
{
b->OnHoverStartEvent.Broadcast(IntenSelect, HitResult);
CurrentHoverBehaviour->OnHoverStartEvent.Broadcast(IntenSelect, HitResult);
}
}
void UIntenSelectable::HandleOnSelectEndEvents(const UIntenSelectComponent* IntenSelect)
{
for (const UHoverBehaviour* b : OnSelectBehaviours)
for (const UHoverBehaviour* CurrentHoverBehaviour : OnHoverBehaviours)
{
b->OnHoverEndEvent.Broadcast(IntenSelect);
CurrentHoverBehaviour->OnHoverEndEvent.Broadcast(IntenSelect);
}
}
void UIntenSelectable::HandleOnClickStartEvents(UIntenSelectComponent* IntenSelect)
{
for (const UActionBehaviour* b : OnClickBehaviours)
for (const UActionBehaviour* CurrentActionBehaviour : OnActionBehaviours)
{
FInputActionValue v{};
const UInputAction* a{};
b->OnActionBeginEvent.Broadcast(IntenSelect, a, v);
FInputActionValue EmptyInputActionValue{};
const UInputAction* EmptyInputAction{};
CurrentActionBehaviour->OnActionBeginEvent.Broadcast(IntenSelect, EmptyInputAction, EmptyInputActionValue);
}
}
void UIntenSelectable::HandleOnClickEndEvents(UIntenSelectComponent* IntenSelect, FInputActionValue& InputValue)
{
for (const UActionBehaviour* b : OnClickBehaviours)
for (const UActionBehaviour* CurrentActionBehaviour : OnActionBehaviours)
{
const UInputAction* a{};
b->OnActionEndEvent.Broadcast(IntenSelect, a, InputValue);
const UInputAction* EmptyInputActionValue{};
CurrentActionBehaviour->OnActionEndEvent.Broadcast(IntenSelect, EmptyInputActionValue, InputValue);
}
}
......@@ -114,23 +117,14 @@ void UIntenSelectable::InitDefaultBehaviourReferences()
}
// Selecting
TInlineComponentArray<UHoverBehaviour*> AttachedSelectionBehaviours;
GetOwner()->GetComponents(AttachedSelectionBehaviours, true);
TInlineComponentArray<UHoverBehaviour*> AttachedHoverBehaviours;
GetOwner()->GetComponents(AttachedHoverBehaviours, true);
this->OnSelectBehaviours = AttachedSelectionBehaviours;
OnHoverBehaviours = AttachedHoverBehaviours;
// Clicking
TInlineComponentArray<UActionBehaviour*> AttachedClickBehaviours;
GetOwner()->GetComponents(AttachedClickBehaviours, true);
this->OnClickBehaviours = AttachedClickBehaviours;
}
void UIntenSelectable::ShowErrorAndQuit(const FString& Message) const
{
UE_LOG(LogTemp, Error, TEXT("%s"), *Message)
#if WITH_EDITOR
FMessageDialog::Open(EAppMsgType::Ok, FText::FromString(FString("RUNTIME ERROR")));
#endif
UKismetSystemLibrary::QuitGame(this, nullptr, EQuitPreference::Quit, false);
OnActionBehaviours = AttachedClickBehaviours;
}
\ No newline at end of file
......@@ -14,10 +14,7 @@
DEFINE_LOG_CATEGORY(Toolkit);
bool URWTHVRUtilities::IsDesktopMode()
{
return !IsRoomMountedMode() && !IsHeadMountedMode();
}
bool URWTHVRUtilities::IsDesktopMode() { return !IsRoomMountedMode() && !IsHeadMountedMode(); }
bool URWTHVRUtilities::IsHeadMountedMode()
{
......
......@@ -28,10 +28,10 @@ public:
TArray<UIntenSelectableScoring*> ScoringBehaviours;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<UHoverBehaviour*> OnSelectBehaviours;
TArray<UHoverBehaviour*> OnHoverBehaviours;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<UActionBehaviour*> OnClickBehaviours;
TArray<UActionBehaviour*> OnActionBehaviours;
public:
......@@ -48,8 +48,6 @@ public:
void InitDefaultBehaviourReferences();
void ShowErrorAndQuit(const FString& Message) const;
protected:
virtual void BeginPlay() override;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment