Let’s say I have a struct A, inheriting from FDataTableRowBase. In another struct B (inheriting too from FDataTableRowBase) I want to reference rows in the datatable based on A.
So In my project I have the datatables DataA and DataB, based respectively on A and B, and B reference a row in DataA.
The simplest way to do this, is to put a FDataTableRowHandleUPROPERTY() in B. But doing so I need to specify the datatable in each new row of DataB…
I there a way to have the same dropdown I have with the rows name from a datatable, without having to specify each time the datatable ?
Not sure I’m entirely clear…
For a less abstract example, in my project I basically have two datatable, one with “enemies” and another with “enemy parties” in which I would like to be able to select directly from the enemy table. Knowing that the enemy datatable is already accessible globally through a singleton class.
Also would like to know the answer to this. Have tried extending FDataTableRowHandle and initializing the DataTable in the constructor, which works. However, in doing this, “RowName” no longer becomes a drop down and is simply and FName field.
Took me some digging but I figured out the solution to this. You can achieve this effect by creating a Customization Layout for your struct (IPropertyTYpeCustomization) and then registering it via FPropertyEditorModule::RegisterCustomPropertyTypeLayout.
In my case, I loaded the datatable asset in my customization layout class, bypassing the need to have it as a uproperty in my struct.
The doc pages linked below will give you some more info on what to do, but I recommend looking at DataTableCustomization.h for an example on this particular problem.
I want my variable to be only the row handle name of a predefined datatable and not having to pick a datable and select a raw handle. Something like exposing the datatable row list itself as a variable
There’s already a built in property editor for FDataTableRowHandle called FDataTableCustomizationLayout, so you shouldn’t need to build your own. By default it already supports the “RowType” meta tag, which allows you to narrow the asset selector to data tables of a particular class derived from FTableRowBase. I’m not going to go into the details, but it was fairly easy for me to modify FDataTableCustomizationLayout and add another meta tag that allows you to specify an asset name and have it auto-select the asset for you. Much simpler than making an entire property editor from scratch.
When subclassing FDataTableCustomizationLayout from another module, I ultimately ran into a linker error when trying to override the virtual CustomizeHeader and CustomizeChildren methods (case 3 of Unresolved External Symbols) with “DetailsCustomizations” added as a module. But I didn’t try very long, so it may be possible =)
I think there are a few ambiguities in previous answers that would probably have saved people a lot of time, so in case anyone needs to achieve the same this is how I went about it.
Create the custom data table row handle struct. Subclassing FDataTableRowHandle is not ideal as subclassed structs do not appear to be supported by blueprint (inheritance in structs?), so I ended up just copying the implementation from FDataTableRowHandle
This is where you can grab the entire implementation from FDataTableCustomizationLayout.
Register the customization in StartupModule (should be clear from above guide). If you experience linker errors make sure you have UnrealEd and PropertyEditor in your Build.cs
At this point you can test your struct by exposing it in blueprint in your game module and see that the custom data table row handle should behave identically to FDataTableRowHandle, but you now have access to alter it however you like (including specifying and loading a data table asset only exposing the row names)
Hopefully it helps someone =)