antsonthetree
Topic Author
Posts: 44
Joined: 09 Jan 2018, 15:56

UE4 NoesisView Blocks Actor Mouse Events

29 Jan 2018, 19:13

Hello,

It looks like the NoesisView is blocking my actor's mouse events - BeginCursorOver, EndCursorOver, OnClicked, etc. In a UMG scenario I would set the background to SelfHitTestInvisible to allow mouse events to fall thru the transparent area of the widget. Setting this on the NoesisView widget does not have the same effect. I have also tried setting the root component in my xaml user control (a Grid) to Background="Transparent" and also Background="{x:Null}".

I have put together a small demo project based on the Login sample to show what is going on.
Let me know if you need to see that.

Thanks
Jake
 
User avatar
hcpizzi
Site Admin
Posts: 320
Joined: 09 Feb 2012, 12:40

Re: UE4 NoesisView Blocks Actor Mouse Events

30 Jan 2018, 21:21

Hi Jake,

Casually I had been looking at that these last few days. I think I'm close to a solution, but I couldn't delay pushing a new version for longer, since there were some code changes in the latest SDK versions that required it.

I'll keep you posted.
 
antsonthetree
Topic Author
Posts: 44
Joined: 09 Jan 2018, 15:56

Re: UE4 NoesisView Blocks Actor Mouse Events

30 Jan 2018, 23:11

Thanks for the reply hcpizzi!
I'm glad that it is already on the radar.

Jake
 
User avatar
hcpizzi
Site Admin
Posts: 320
Joined: 09 Feb 2012, 12:40

Re: UE4 NoesisView Blocks Actor Mouse Events

09 Feb 2018, 16:32

Hi Jake,

I have an update on this. I got it working with the events getting to the player controller if the element doesn't have a background ("Transparent" is a background, it has to have no background at all).

I'm going to commit this, along with other changes, later today. I'll update this thread once you can download it.
 
User avatar
hcpizzi
Site Admin
Posts: 320
Joined: 09 Feb 2012, 12:40

Re: UE4 NoesisView Blocks Actor Mouse Events

09 Feb 2018, 18:39

And it's up. Let us know if you need further assistance.
 
User avatar
AdmiralFrijoles
Posts: 2
Joined: 11 Feb 2018, 00:57

Re: UE4 NoesisView Blocks Actor Mouse Events

11 Feb 2018, 18:59

Hello,

I am currently experiencing this issue on Unreal Engine 4.18 with Noesis SDK 2.1.0rc3.
I have tried setting a grid's background to "{x:Null}" and also just omitting the background property all together and I cannot seem to get it working.
Any help would be much appreciated.

Thanks,
Jason
 
User avatar
hcpizzi
Site Admin
Posts: 320
Joined: 09 Feb 2012, 12:40

Re: UE4 NoesisView Blocks Actor Mouse Events

12 Feb 2018, 17:35

Hi Jason,

Jake has discovered some problems with the current implementation. Certain events work, like clicks, but mouse over events don't. I'm working on a solution that I'll commit to GitHub as soon as possible.

I'll post on this thread once it's working.

Sorry for the false hopes.
 
User avatar
AdmiralFrijoles
Posts: 2
Joined: 11 Feb 2018, 00:57

Re: UE4 NoesisView Blocks Actor Mouse Events

13 Feb 2018, 02:40

Hi Jason,

Jake has discovered some problems with the current implementation. Certain events work, like clicks, but mouse over events don't. I'm working on a solution that I'll commit to GitHub as soon as possible.

I'll post on this thread once it's working.

Sorry for the false hopes.
No worries, thanks!
 
User avatar
hcpizzi
Site Admin
Posts: 320
Joined: 09 Feb 2012, 12:40

Re: UE4 NoesisView Blocks Actor Mouse Events

14 Feb 2018, 15:34

Hey guys,

I've got good and bad news.

The bad news is that a proper fix for this requires an Engine patch. I'll contact Epic with a pull request, because I think this change is necessary for anyone that wants to implement custom controls with hover over behavior and non rectangular shape.

The first bit of good news is that the change is relatively simple, so I'll attach the patch, but I've already found that buttons don't behave correctly with it. The button widget is fixed in the patch, but there may be other widgets that behave incorrectly as well. Also, this can only be done if you have the source code from GitHub, and not with Epic Games Launcher versions.

The second bit of good news is that I've exposed a workaround that you guys can implement in your PlayerController class. It involves a new function I just committed to GitHub, and all you have to do is to override the function IsInViewportClient in your player controller like this:
bool IsInViewportClient(UGameViewportClient* ViewportClient) const override
{
	return Super::IsInViewportClient(ViewportClient) || NoesisIsViewportHovered(ViewportClient);
}
It's possible the new function requires some tweaking, but hopefully this will unblock you and allow you to keep working.

Here's the Engine code patch, in case you want to try this:
diff --git a/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp b/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp
index 7646131..03906b9 100644
--- a/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp
+++ b/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp
@@ -5366,6 +5366,7 @@ bool FSlateApplication::RoutePointerMoveEvent(const FWidgetPath& WidgetsUnderPoi
 
 	bool bHandled = false;
 
+	FWidgetPath CurrentWidgetsUnderCursor;
 	FWeakWidgetPath LastWidgetsUnderCursor;
 
 	// User asked us to detect a drag.
@@ -5520,6 +5521,10 @@ bool FSlateApplication::RoutePointerMoveEvent(const FWidgetPath& WidgetsUnderPoi
 				return TempReply;
 			});
 			bHandled = Reply.IsEventHandled();
+			if (bHandled)
+			{
+				CurrentWidgetsUnderCursor = WidgetsUnderPointer.GetPathDownTo(Reply.GetHandler().ToSharedRef());
+			}
 		}
 	}
 	else
@@ -5574,6 +5579,10 @@ bool FSlateApplication::RoutePointerMoveEvent(const FWidgetPath& WidgetsUnderPoi
 		LOG_EVENT( IsDragDropping() ? EEventLog::DragOver : EEventLog::MouseMove, Reply )
 
 		bHandled = Reply.IsEventHandled();
+		if (bHandled)
+		{
+			CurrentWidgetsUnderCursor = WidgetsUnderPointer.GetPathDownTo(Reply.GetHandler().ToSharedRef());
+		}
 	}
 
 	// Give the current drag drop operation a chance to do something
@@ -5590,14 +5599,14 @@ bool FSlateApplication::RoutePointerMoveEvent(const FWidgetPath& WidgetsUnderPoi
 			DragDropContent->SetCursorOverride(EMouseCursor::None);
 		}
 #endif
-		FScopedSwitchWorldHack SwitchWorld( WidgetsUnderPointer );
+		FScopedSwitchWorldHack SwitchWorld(CurrentWidgetsUnderCursor);
 		DragDropContent->OnDragged( DragDropEvent );
 
 		// Update the window we're under for rendering the drag drop operation if
 		// it's a windowless drag drop operation.
-		if ( WidgetsUnderPointer.IsValid() )
+		if (CurrentWidgetsUnderCursor.IsValid() )
 		{
-			DragDropWindowPtr = WidgetsUnderPointer.GetWindow();
+			DragDropWindowPtr = CurrentWidgetsUnderCursor.GetWindow();
 		}
 		else
 		{
@@ -5622,7 +5631,7 @@ bool FSlateApplication::RoutePointerMoveEvent(const FWidgetPath& WidgetsUnderPoi
 		DragDropWindowPtr = nullptr;
 	}
 
-	WidgetsUnderCursorLastEvent.Add(FUserAndPointer(PointerEvent.GetUserIndex(), PointerEvent.GetPointerIndex()), FWeakWidgetPath(WidgetsUnderPointer));
+	WidgetsUnderCursorLastEvent.Add(FUserAndPointer(PointerEvent.GetUserIndex(), PointerEvent.GetPointerIndex()), FWeakWidgetPath(CurrentWidgetsUnderCursor));
 	PointerIndexLastPositionMap.Add(FUserAndPointer(PointerEvent.GetUserIndex(), PointerEvent.GetPointerIndex()), PointerEvent.GetScreenSpacePosition());
 
 	return bHandled;
diff --git a/Engine/Source/Runtime/Slate/Private/Widgets/Input/SButton.cpp b/Engine/Source/Runtime/Slate/Private/Widgets/Input/SButton.cpp
index e25f133..8c0c6ab 100644
--- a/Engine/Source/Runtime/Slate/Private/Widgets/Input/SButton.cpp
+++ b/Engine/Source/Runtime/Slate/Private/Widgets/Input/SButton.cpp
@@ -312,7 +312,7 @@ FReply SButton::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& M
 		Release();
 	}
 
-	return FReply::Unhandled();
+	return FReply::Handled();
 }
 
 void SButton::OnMouseEnter( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
As always, please let us know if you find any problems.
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: UE4 NoesisView Blocks Actor Mouse Events

02 Jun 2022, 20:08

Just updating this thread because we received lately a few questions regarding this.

To be able to use ActorBeginCursorOver, ActorEndCursorOver or ActorOnClicked events along with a Noesis widget it is necessary to create a custom PlayerController that overrides the IsViewportClient method:
UCLASS(BlueprintType, Blueprintable)
class MYGAMEMODULE_API AMyNativePlayerController : public APlayerController
{
    GENERATED_UCLASS_BODY()
	
    virtual bool IsInViewportClient(UGameViewportClient* ViewportClient) const override;
};
AMyNativePlayerController::AMyNativePlayerController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
    bEnableClickEvents = true;
    bEnableMouseOverEvents = true;
}

bool AMyNativePlayerController::IsInViewportClient(UGameViewportClient* ViewportClient) const
{
    return Super::IsInViewportClient(ViewportClient) || NoesisIsViewportHovered(ViewportClient);
}
And to clarify this is not required for other input events like LeftMouseButton, RightMouseButton, etc. that are correctly handled in the widget virtual functions (NativeOnMouseButtonDown, NativeOnMouseButtonUp, NativeOnMouseMove...).

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 9 guests