To do this, you’ll need to write two classes: a URichTextBlockDecorator and an FRichTextDecorator. While we do provide the RichTextBlockImageDecorator class as an example, the best part about the Rich Text Block is that you can now define your own custom decorators that leverage the full power of Slate, enabling you to add anything you want in line with your your text. Like the built-in stylings of the Rich Text Style Row, the Rich Image Row struct defines all the images we would want to support with in line text. To get you started, we’ve included an example RichTextBlockImageDecorator class that can be used to add an image to a Rich Text Block using a Decorator class. These markup tags let us use Slate to render anything we want seamlessly within our text. Keep in mind that this style tag does not require any prefix or postfix, such as RichText.* to work, and it is not case-sensitive.Īt this point, we’re now able to apply different styles to text within the Rich Text Block but what if we wanted to inject something other text? We can use Decorators to do that by setting up our own markup tags. In doing so, the text now inherits the properties we set, in this case, orange text with a black outline. In this example, we wrapped the text we want to inherit the style in our tag that is used in our Data Table Asset for this row using R ich. You can go ahead and create a new Data Table by selecting this assignment dropdown and selecting Data Table or by using the Content Browser and selecting Add New > Miscellaneous > Data Table. This asset assignment slot lets us pass in a data table of styles that defines both our Text Style and any number of additional styles we may wish to use. With the Rich Text Block selected, use the Details panel to locate the Text Styles Set. The RichTextBlockImageDecorator class example provides you with a starting point to create your own markup text that can be replaced with whatever Slate content you want, including things such as images, hyperlinks, and even entire widgets! Data Tables can hold any type of data and be set up in the Editor through a Data Table Asset.įirst of all, we’ll need to create a new Widget Blueprint and use the Palette to drag a Rich Text Block onto the Canvas. With it, like the Text Style Row struct, you'll be able to define properties for in-line images such as size scaling, tint, alignment, and more. The Image Row is part of the provided RichTextBlockImageDecorator example class that enables you to specify any Decorator classes in the Rich Text Block widget. Text Style Row structs are part of the built-in stylings provided with Rich Text Block that enables you to define the font type, whether it is outlined, what type of color and size it should be, and much more. When you create a Data Table, you'll notice there are two provided: Text Style Row and Image Row. The Data Table Asset you create is used to store any type of data based on any user-defined struct. The Rich Text Block widget enables you to customize the contents of your block using text styles and decorators using Data Table Assets or your own Decorator classes. Before diving right into adding your own customizations, it may be helpful to familiarize yourself with the newly exposed Rich Text Block functionality in UMG. I’ll explain how you can extend it with additional functionality using Decorator classes. In this blog post, I’ll go over both how to work with the new Rich Text Block widget in UMG as a UI designer and as a programmer. You’ll find that a single Decorator class has been provided as an example for setting up your own decorators with RichTextBlockImageDecorator.cpp. As part of this polishing phase, rather than attempt to support every possible customization a developer may need, we’ve set the Rich Text Block up to accept Decorator classes, enabling you to define the markup behavior you need for your project. Much of this has already been possible with the experimental Rich Text Block widget through code.įor the 4.20 release, the widget was made available to UMG and in the process it’s workflow polished to be more flexible and extensible than before. However, many developers have found the need for more flexible text that supports markup for things like style changes, inline images, hyperlinks, and much more. By Cody Albert When working with game UI, the typical UMG Text block offers a healthy variety of style options and customizations.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |