The Datasmith FBX importer for Deltagen and VRED adds a new instance of one of the following classes to your Level:
- For Deltagen, BP_VariantSelector.
- For VRED, VREDVariantsSelector
This variant selector Actor is set up automatically with a reference to your variant Data Table, so that it can access all of the variant data that Datasmith imported from your source file. It also has a reference to a root Actor that is placed at the top of your imported scene hierarchy, immediately under the Datasmith Scene Actor, so that it can find the scene elements that it needs to modify when you swap between different variants. You'll find these settings in the Deltagen or VRED section of the Details panel:
If your scene has camera variants, you can also give the variant selector a reference to a Camera Actor in your Level. Any time you select a new camera variant, the 3D transform of the camera Actor you set here will be updated.
The variant selector class is pre-set with several Blueprint functions. You can call these functions at runtime to select which variants should be shown in your Level.
If you edit the variant selector Actor, you can find these functions in the functions list in the My Blueprint panel, and drag them into the Event Graph to call them in response to custom events you create:
To find these Blueprint nodes in a different Blueprint class or a UMG widget that you create:
- Create a new variable, and set its type to be an Object Reference to the BP_VariantSelector or VREDVariantsSelector class.
Set this variable to point to the variant selector object you've placed in your Level.
- Add a Get node for that variable to your Event Graph, and drag from its output pin to create a new node.
- Look in the Deltagen or VRED category to find the functions for controlling your variants:
Click for full image.
Once you can see the list of nodes:
- Use one of the Select Variant nodes to specify the name of a specific variant that you want to activate.
- Use the Get nodes to read the names and types of your variants and variant sets from the data contained in the Data Table. This can be very useful if you want to create a UI programmatically based on the names of the actual variants that are available in your scene, instead of hard-coding specific variant names into your UI.
The following image shows how these Blueprint API functions could be used within a UMG UI widget. The variant nodes are highlighted.
Click for full image.