Description
The main asset of the tool – WBP_ViewportRegion.
The widget works in two modes:
1. Simple selection (Crop Mode).
A user selects an area of the screen with the mouse. When the mouse is released, the dispatcher event NotifyRegionCompleted is called with the coordinates of the selected region then the widget is closed automatically.
2. Selection with editing.
The user selects a region of the screen and then changes the position and size of the region. When you click on the Close button, the dispatcher event NotifyOnClosed is called then the selection area is reset.
For each selecting tick, the widget calls the dispatcher event NotifyMaskChanged with the coordinates and size of the selected region.
Dispatcher events NotifyMaskChanged and NotifyRegionComplete return three values:
Normalized Mask (LinearColor): Offsets from sides of the UV-Canvas.
It is used in post-process materials. Also, this value is written to the MaterialParameterCollection MPC_Region. In the example post-process material M_RegionPostprocess, I use parameters from this collection.
Position (Vector2D): Coords of the upper left corner of the mask on the viewport.
Size (Vector2D): Mask size.
MPC_Region also contains some parameters for the customization appearance of the widget.
Scalar Parameters:
Vector Parameters:
In the example, I’ve shown only two cases where you can use the tool, but there are many other cases, for instance, to zoom viewport or crop some image, etc.
Write me if you have any questions. I will be happy to help you implement this tool in your project.
Technical Details
Number of Blueprints: 3
Number of Widgets: 2
UMG Materials: 2
Material Functions: 1
Material Parameter Collections: 1
Input: Mouse
Network Replicated: No
Supported Development Platforms:
Windows: Yes
Supported Engine Versions
5.0 – 5.3