diff --git a/Content/Examples/ContentExamples/ToolkitExamples.umap b/Content/Examples/ContentExamples/ToolkitExamples.umap index becc22e16a8f4a7412a13fa83557f30a2b99af6c..a06be8deb09551c44e5a20209bb91bedffd98f8b 100644 Binary files a/Content/Examples/ContentExamples/ToolkitExamples.umap and b/Content/Examples/ContentExamples/ToolkitExamples.umap differ diff --git a/Content/Input/Default_IMC/IMC_MovementLeftHand.uasset b/Content/Input/Default_IMC/IMC_MovementLeftHand.uasset index 1be9e555bfd0713434a650308d6892ad2e0b7204..61a3048f2f7d7470bcc88dd398b06a5cbd825939 100644 Binary files a/Content/Input/Default_IMC/IMC_MovementLeftHand.uasset and b/Content/Input/Default_IMC/IMC_MovementLeftHand.uasset differ diff --git a/Content/Input/Default_IMC/IMC_MovementRightHand.uasset b/Content/Input/Default_IMC/IMC_MovementRightHand.uasset index 4b8151454c391850d9a45ed68fce7babc360c10d..fd7e3cd5dd01591ed98c06be64b54ca17221f8c0 100644 Binary files a/Content/Input/Default_IMC/IMC_MovementRightHand.uasset and b/Content/Input/Default_IMC/IMC_MovementRightHand.uasset differ diff --git a/Source/RWTHVRToolkit/Private/Interaction/Interactables/IntenSelect/IntenSelectable.cpp b/Source/RWTHVRToolkit/Private/Interaction/Interactables/IntenSelect/IntenSelectable.cpp index 9352bc3f8e0c1e734579c94bf7326175af7089f3..f99b7d65df959a5725996eebaab3ec8bc2fd89e9 100644 --- a/Source/RWTHVRToolkit/Private/Interaction/Interactables/IntenSelect/IntenSelectable.cpp +++ b/Source/RWTHVRToolkit/Private/Interaction/Interactables/IntenSelect/IntenSelectable.cpp @@ -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 diff --git a/Source/RWTHVRToolkit/Private/Utility/RWTHVRUtilities.cpp b/Source/RWTHVRToolkit/Private/Utility/RWTHVRUtilities.cpp index f43fc658f2d5ce7b6ca66c409d9b30583bbcc99e..1a57b331df01f70bf330c8e9c4826d309fa616a8 100644 --- a/Source/RWTHVRToolkit/Private/Utility/RWTHVRUtilities.cpp +++ b/Source/RWTHVRToolkit/Private/Utility/RWTHVRUtilities.cpp @@ -14,10 +14,7 @@ DEFINE_LOG_CATEGORY(Toolkit); -bool URWTHVRUtilities::IsDesktopMode() -{ - return !IsRoomMountedMode() && !IsHeadMountedMode(); -} +bool URWTHVRUtilities::IsDesktopMode() { return !IsRoomMountedMode() && !IsHeadMountedMode(); } bool URWTHVRUtilities::IsHeadMountedMode() { diff --git a/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectable.h b/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectable.h index 45e6a7726227e26c299399ba733a143909ae32b7..892a478ea50ec84ae7966759577738fec88d34a7 100644 --- a/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectable.h +++ b/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectable.h @@ -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; };