Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • vr-vis/VR-Group/unreal-development/plugins/rwth-vr-toolkit
  • daniel.rupp/rwth-vr-toolkit
2 results
Show changes
Commits on Source (3)
No preview for this file type
No preview for this file type
......@@ -6,6 +6,7 @@
#include "Kismet/KismetSystemLibrary.h"
#include "Misc/MessageDialog.h"
#include "Pawn/IntenSelectComponent.h"
#include "Utility/RWTHVRUtilities.h"
UIntenSelectable::UIntenSelectable() { PrimaryComponentTick.bCanEverTick = true; }
......@@ -45,8 +46,9 @@ void UIntenSelectable::BeginPlay()
{
if (ScoringBehaviours.Num() == 0)
{
ShowErrorAndQuit(
"Please assign the Scoring Behaviour manually when using more than one IntenSelectable Component!");
URWTHVRUtilities::ShowErrorAndQuit(
"Please assign the Scoring Behaviour manually when using more than one IntenSelectable Component!",
false, this);
}
}
else
......@@ -57,36 +59,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 +116,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
......@@ -20,10 +20,7 @@
DEFINE_LOG_CATEGORY(Toolkit);
bool URWTHVRUtilities::IsDesktopMode()
{
return !IsRoomMountedMode() && !IsHeadMountedMode();
}
bool URWTHVRUtilities::IsDesktopMode() { return !IsRoomMountedMode() && !IsHeadMountedMode(); }
bool URWTHVRUtilities::IsRoomMountedMode()
{
......@@ -48,8 +45,8 @@ bool URWTHVRUtilities::IsCave()
return false;
const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig();
return ClusterConfig->CustomParameters.Contains("Hardware_Platform")
&& ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("aixcave", ESearchCase::IgnoreCase);
return ClusterConfig->CustomParameters.Contains("Hardware_Platform") &&
ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("aixcave", ESearchCase::IgnoreCase);
#else
return false;
#endif
......@@ -62,8 +59,8 @@ bool URWTHVRUtilities::IsRolv()
return false;
const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig();
return ClusterConfig->CustomParameters.Contains("Hardware_Platform")
&& ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("ROLV", ESearchCase::IgnoreCase);
return ClusterConfig->CustomParameters.Contains("Hardware_Platform") &&
ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("ROLV", ESearchCase::IgnoreCase);
#else
return false;
#endif
......@@ -84,14 +81,11 @@ bool URWTHVRUtilities::IsPrimaryNode()
}
return Manager->IsPrimary() || !Manager->IsSecondary();
#else
return true;
return true;
#endif
}
bool URWTHVRUtilities::IsSecondaryNode()
{
return !IsPrimaryNode();
}
bool URWTHVRUtilities::IsSecondaryNode() { return !IsPrimaryNode(); }
FString URWTHVRUtilities::GetNodeName()
{
......@@ -114,7 +108,7 @@ float URWTHVRUtilities::GetEyeDistance()
const ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor();
return (RootActor) ? RootActor->GetDefaultCamera()->GetInterpupillaryDistance() : 0.0f;
#else
return 0.0f;
return 0.0f;
#endif
}
}
......@@ -123,13 +117,23 @@ EEyeStereoOffset URWTHVRUtilities::GetNodeEyeType()
{
#if PLATFORM_SUPPORTS_NDISPLAY
const ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor();
return static_cast<EEyeStereoOffset>((RootActor)
? RootActor->GetDefaultCamera()->GetStereoOffset()
: EDisplayClusterEyeStereoOffset::None);
return static_cast<EEyeStereoOffset>((RootActor) ? RootActor->GetDefaultCamera()->GetStereoOffset()
: EDisplayClusterEyeStereoOffset::None);
#else
return EDisplayClusterEyeStereoOffset::None;
#endif
}
void URWTHVRUtilities::ShowErrorAndQuit(const FString& Message, bool ShouldQuit, const UObject* WorldContext)
{
UE_LOG(LogTemp, Error, TEXT("%s"), *Message)
#if WITH_EDITOR
FMessageDialog::Open(EAppMsgType::Ok, FText::FromString(Message));
#endif
if (ShouldQuit)
{
UKismetSystemLibrary::QuitGame(WorldContext, nullptr, EQuitPreference::Quit, false);
}
}
USceneComponent* URWTHVRUtilities::GetClusterComponent(const FString& Name)
{
......
......@@ -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;
};
......@@ -70,7 +70,9 @@ public:
UFUNCTION(BlueprintPure, Category = "DisplayCluster")
static EEyeStereoOffset GetNodeEyeType();
//Get Component of Display Cluster by it's name, which is specified in the nDisplay config
static void ShowErrorAndQuit(const FString& Message, bool ShouldQuit, const UObject* WorldContext);
// Get Component of Display Cluster by it's name, which is specified in the nDisplay config
UE_DEPRECATED(5.4, "GetClusterComponent has been removed because it is obsolete.")
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster", meta = (DeprecatedFunction))
static USceneComponent* GetClusterComponent(const FString& Name);
......