- antsonthetree
- Posts: 44
- Joined:
UE4 NoesisView Blocks Actor Mouse Events
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
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
Re: UE4 NoesisView Blocks Actor Mouse Events
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.
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
- Posts: 44
- Joined:
Re: UE4 NoesisView Blocks Actor Mouse Events
Thanks for the reply hcpizzi!
I'm glad that it is already on the radar.
Jake
I'm glad that it is already on the radar.
Jake
Re: UE4 NoesisView Blocks Actor Mouse Events
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.
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.
Re: UE4 NoesisView Blocks Actor Mouse Events
And it's up. Let us know if you need further assistance.
- AdmiralFrijoles
- Posts: 2
- Joined:
Re: UE4 NoesisView Blocks Actor Mouse Events
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
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
Re: UE4 NoesisView Blocks Actor Mouse Events
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.
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.
- AdmiralFrijoles
- Posts: 2
- Joined:
Re: UE4 NoesisView Blocks Actor Mouse Events
No worries, thanks!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.
Re: UE4 NoesisView Blocks Actor Mouse Events
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:
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:
As always, please let us know if you find any problems.
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:
Code: Select all
bool IsInViewportClient(UGameViewportClient* ViewportClient) const override
{
return Super::IsInViewportClient(ViewportClient) || NoesisIsViewportHovered(ViewportClient);
}
Here's the Engine code patch, in case you want to try this:
Code: Select all
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 )
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: UE4 NoesisView Blocks Actor Mouse Events
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:
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...).
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:
Code: Select all
UCLASS(BlueprintType, Blueprintable)
class MYGAMEMODULE_API AMyNativePlayerController : public APlayerController
{
GENERATED_UCLASS_BODY()
virtual bool IsInViewportClient(UGameViewportClient* ViewportClient) const override;
};
Code: Select all
AMyNativePlayerController::AMyNativePlayerController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
bEnableClickEvents = true;
bEnableMouseOverEvents = true;
}
bool AMyNativePlayerController::IsInViewportClient(UGameViewportClient* ViewportClient) const
{
return Super::IsInViewportClient(ViewportClient) || NoesisIsViewportHovered(ViewportClient);
}
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 53 guests