Download

UMG Compatibility - Code Changes: SceneViewport.cpp to 4.7

My UMG UI on use the setInputmethod GAMEUI or UI to get focus to a Widget it starts to display the cursor again (It’s set on PlayerController to EMouseCursor::None).

The issue is being caused because the mouse cursor is being set by the OS Cursor Settings (trough the method ViewportClient->GetCursor( )) without any query to the settings on the PlayerController. on the method FSceneViewport::OnCursorQuery( const FGeometry& MyGeometry, const FPointerEvent& CursorEvent )

When I forced the cursor back to ::None after pass trough ViewportClient->GetCursor( ) (near the line 332), the UMG widget stopped on get the OS cursor overlay.

Would be cool get some method to easily set the OS cursor to none or at least check what was assigned on PlayerController by us before “defaultize” the cursor.

If was already solved, disregard the info. :wink:

Best Wishes.

creasso

How I’ve implemented

Did this way, luckily from ViewportClient it’s easy to check if we have a PlayerController asking to hide the mouse cursor.

Worked on 4.6.1, the cursor shows on Editor.



FCursorReply FSceneViewport::OnCursorQuery( const FGeometry& MyGeometry, const FPointerEvent& CursorEvent )
{
	// Kills any other check if we have a PlayerController and he's hidding the mouse
	if (ViewportClient && ViewportClient->GetWorld()->GetFirstPlayerController() != NULL)
	{
		if (!ViewportClient->GetWorld()->GetFirstPlayerController()->bShowMouseCursor)
			return FCursorReply::Cursor(EMouseCursor::None);
	}

	if (bCursorHiddenDueToCapture)
	{
		return FCursorReply::Cursor(EMouseCursor::None);
	}

	EMouseCursor::Type MouseCursorToUse = EMouseCursor::Default;

	// If the cursor should be hidden, use EMouseCursor::None,
	// only when in the foreground, or we'll hide the mouse in the window/program above us.
	if( ViewportClient && GetSizeXY() != FIntPoint::ZeroValue  )
	{
		MouseCursorToUse = ViewportClient->GetCursor( this, GetMouseX(), GetMouseY() );		
	}	
	
	// Use the default cursor if there is no viewport client or we dont have focus
	return FCursorReply::Cursor(MouseCursorToUse);
}