bMouseAlwaysAttached

bMouseAlwaysAttached

#Overview

name: bMouseAlwaysAttached

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bMouseAlwaysAttached is to control the behavior of mouse attachment in the Pixel Streaming plugin for Unreal Engine 5. This setting variable is primarily used in the input handling system for pixel streaming applications.

Based on the details in the Callsites section, the Pixel Streaming plugin, specifically the PixelStreamingInput module, relies on this setting variable. It is used within the FPixelStreamingApplicationWrapper class, which is part of the UE::PixelStreamingInput namespace.

The value of this variable is set in the UPixelStreamingSettings class, which is derived from UDeveloperSettings. This suggests that the value can be configured through the project settings in the Unreal Engine editor.

The bMouseAlwaysAttached variable interacts with the IsMouseAttached() function of the GenericApplication class. When bMouseAlwaysAttached is true, IsMouseAttached() always returns true, regardless of the actual state of the wrapped application.

Developers must be aware that setting this variable to true will make the application behave as if the mouse is always attached, even if it’s not. This can affect input handling and cursor behavior in the pixel streaming application.

Best practices when using this variable include:

  1. Consider the implications on input handling and user experience before changing its default value.
  2. Ensure that the setting is appropriate for the target platform and use case of the pixel streaming application.
  3. Test thoroughly with different input scenarios to verify that the desired behavior is achieved when modifying this setting.
  4. Document any changes to this setting in the project documentation to inform other developers about the modified input behavior.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Plugins/Media/PixelStreaming/Config/BasePixelStreaming.ini:5, section: [/Script/PixelStreaming.PixelStreamingSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingInput/Private/ApplicationWrapper.cpp:14

Scope (from outer to inner):

file
namespace    UE::PixelStreamingInput
function     FPixelStreamingApplicationWrapper::FPixelStreamingApplicationWrapper

Source code excerpt:

		const UPixelStreamingSettings* Settings = GetDefault<UPixelStreamingSettings>();
		check(Settings);
		bMouseAlwaysAttached = Settings->bMouseAlwaysAttached;
	}

	void FPixelStreamingApplicationWrapper::SetTargetWindow(TWeakPtr<SWindow> InTargetWindow)
	{
		TargetWindow = InTargetWindow;
	}

#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingInput/Private/ApplicationWrapper.h:51

Scope (from outer to inner):

file
namespace    UE::PixelStreamingInput
class        class FPixelStreamingApplicationWrapper : public GenericApplication
function     virtual bool IsMouseAttached

Source code excerpt:

		 * Functions with overridden behavior.
		 */
		virtual bool IsMouseAttached() const { return bMouseAlwaysAttached ? true : WrappedApplication->IsMouseAttached(); }
		virtual bool IsCursorDirectlyOverSlateWindow() const { return true; }
		virtual TSharedPtr<FGenericWindow> GetWindowUnderCursor() override;

		/**
		 * Custom functions
		 */

#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingInput/Private/ApplicationWrapper.h:62

Scope (from outer to inner):

file
namespace    UE::PixelStreamingInput
class        class FPixelStreamingApplicationWrapper : public GenericApplication

Source code excerpt:

		TSharedPtr<GenericApplication> WrappedApplication;
		TWeakPtr<SWindow> TargetWindow;
		bool bMouseAlwaysAttached;
	};

	/**
	 * When reading input from a browser then the cursor position will be sent
	 * across with mouse events. We want to use this position and avoid getting the
	 * cursor position from the operating system. This is not relevant to touch

#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingInput/Public/EditorPixelStreamingSettings.h:39

Scope (from outer to inner):

file
class        class UPixelStreamingSettings : public UDeveloperSettings

Source code excerpt:

	 */
	UPROPERTY(config, EditAnywhere, Category = PixelStreaming)
	bool bMouseAlwaysAttached = true;

	// Begin UDeveloperSettings Interface
	virtual FName GetCategoryName() const override;
#if WITH_EDITOR
	virtual FText GetSectionText() const override;
#endif