Ends Today: Save up to 95% on the Time Travel Mega Bundle!

Example Video

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:

  • DashLength - Set the length of the dashes on the region frame.
  • PostprocessMaskWeight - Enable/Disable Region mask in the post-process material.
  • DashWeight - Enable/Disable dashes on the region frame material

Vector Parameters:

  • RegionMask - Offsets from sides of the UV-Canvas.
  • RegionOutColor
  • RegionInnerColor


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

Features:

  • Selecting viewport region
  • Moving and resizing the viewport region

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

AS
Aleksandr Sidorov
All Assets by Author
10.54 
Platforms Windows 64-bit, Windows 32-bit
UE Versions 5.0 - 5.1
Tags CROP, SELECTION BOX, BLUEPRINTS, WIDGET, POSTPROCESS, VIEWPORT
Release date 03.09.2022

Similar products

Image
Sign In
Image
Sign Up
Image
Recovery