# This scripts describes the process of capturing an managing properties with a little more
# detail than test_variant_manager.py

import unreal

# Create all assets and objects we'll use
lvs = unreal.VariantManagerLibrary.create_level_variant_sets_asset(
    "LVS", "/Game/")
lvs_actor = unreal.VariantManagerLibrary.create_level_variant_sets_actor(lvs)
if lvs is None or lvs_actor is None:
    print "Failed to spawn either the LevelVariantSets asset or the LevelVariantSetsActor!"
    quit()

var_set1 = unreal.VariantSet()
var_set1.set_display_text("My VariantSet")

var1 = unreal.Variant()
var1.set_display_text("Variant 1")

# Adds the objects to the correct parents
lvs.add_variant_set(var_set1)
var_set1.add_variant(var1)

# Spawn a simple cube static mesh actor
cube = unreal.EditorAssetLibrary.load_asset(
    "StaticMesh'/Engine/BasicShapes/Cube.Cube'")
spawned_actor = None
if cube:
    location = unreal.Vector()
    rotation = unreal.Rotator()
    spawned_actor = unreal.EditorLevelLibrary.spawn_actor_from_object(
예제 #2
0
                                           'LevelVariantSets.LevelVariantSets')

# loop through all variants in the var file
for variant_switch in rttDocument.findall(
        './ProductAspects/AspectContainer/Aspect/VariantSwitch'):
    proto_id = variant_switch.find('PrototypeID')

    # process only look variants
    if proto_id.text != 'LOOK_SHADER_VARIANT_ID':
        continue

    variant_set_name = variant_switch.find('Name').text
    print("processing look variant : " + variant_set_name)

    # create a new Variant Set to manage look variants
    variant_set = unreal.VariantSet()
    variant_set.set_display_text(variant_set_name)
    # add the empty Variant Set to the Level Variant Sets Asset.
    unreal.VariantManagerLibrary.add_variant_set(lvs, variant_set)

    target_lists = variant_switch.find('TargetLists')
    if target_lists is None:
        print("target list is empty for variant set name:" + variant_set_name)
        continue
    target_description = target_lists.find('TargetDescription')
    if target_description is None:
        print("target description is empty for variant set name:" +
              variant_set_name)
        continue
    if target_description.find('name') is None:
        print("target description Name is empty for variant set name:" +
예제 #3
0
# This script shows how to setup dependencies between variants when using the Variant Manager Python API

import unreal

lvs = unreal.VariantManagerLibrary.create_level_variant_sets_asset(
    "LVS", "/Game/")
if lvs is None:
    print(
        "Failed to spawn either the LevelVariantSets asset or the LevelVariantSetsActor!"
    )
    quit()

var_set_colors = unreal.VariantSet()
var_set_colors.set_display_text("Colors")

var_set_letters = unreal.VariantSet()
var_set_letters.set_display_text("Letters")

var_set_fruits = unreal.VariantSet()
var_set_fruits.set_display_text("Fruits")

var_red = unreal.Variant()
var_red.set_display_text("Red")

var_green = unreal.Variant()
var_green.set_display_text("Green")

var_blue = unreal.Variant()
var_blue.set_display_text("Blue")

var_a = unreal.Variant()