Same as the title, is it possible to somehow use the commonUI input action datatable as a decorator class? or is there some other technique.
Itâs possible and something that CommonUI should support by default. I created a ticket for it here: Unreal Engine Issues and Bug Tracker (UE-185017)
In the meantime. What you can do is as you described use decorators to do this. Specifically:
- Use a âFWidgetDecoratorâ and bind âFWidgetDecorator::Createâ to a âFWidgetDecorator::FCreateWidget::CreateUObjectâ callback on your class.
- In your callback say âUMyRichTextBlock::OnCreateBoundActionWidgetââŚ
- Create a new instance of a custom UWidget designed to display your widget, a good starting place here might be using CommonActionWidget.
- Use payload the FTextRunInfo from the rich text block to get the desired the action
- If using enhanced input, the name of the action itself should be sufficient, use the player controller / IEnhancedInputSubsystemInterface to get the input action from the text
- If using plain CommonUI datatables, then you could either make the entire datatable row a property on the rich text subclass so CommonUI icon info can be looked up via methods like âCommonUI::GetInputActionDataâ, or you can make the datatable a reference and allow the text to specify row lookup within that datatable.
- Either way by setting the relevant action info on your custom Widget / Custom Widgetâs CommonActionWidget, you should be able to construct a widget that previews the relevant action, then return that widget via âFSlateWidgetRun::FWidgetRunInfoâ to view in your rich text.
1 Like