Unreal remote control python wrapper

Hi folks !

I’ve wanted to have a nice way to use the unreal http remote control api plugin using python.
So I’ve been working on a simple wrapper around that.

I thought I could share it here if anyone wanted to give a try, still quite a lot in progress, but I’ve got some results.

You can access (Remotly)UObject, Blueprint or remote preset easily. Access properties as normal python properties ( get / set ), and run functions from either UObject/Blueprint or a remote preset.

Here is a quick example:

# Import the Unreal PYthon Remote Control wrapper
import upyrc

# Init the connection
conn = upyrc.URConnection()

# Get Remote UObject by path
chair_path = "/Game/Maps/TestMap.TestMap:PersistentLevel.StaticMeshActor_2"
robj_chair = conn.get_uobject(chair_path)

# Access property directly on URemoteObject object:
auto_lod_generation = robj_chair.bEnableAutoLODGeneration

# Set property the same way:
robj_chair.bEnableAutoLODGeneration = True

# You can also do it by name with RUObject.get_property(name), or RUObject.set_property(name, value)

# Run a function from RUObject
folder_path = robj_chair.run_function("GetFolderPath")

# You can also load a blueprint
blueprint_path = "/Game/Maps/TestMap.TestMap:PersistentLevel.BUA_TestBlueprint_C_1"
blueprint = conn.get_uobject(blueprint_path)

# You can run a, editor function from the blueprint.
blueprint.run_function("SimpleTestFunc")

# And a function with argument(s) as kwargs too, and a return value:
function_result = blueprint.run_function("SimpleTestFuncArgs", MyString="Hello from python !")

# Get an preset object, by name.
preset_name = "RCP_TestPreset"
preset = conn.get_preset(preset_name)

# Get a preset exposed property:
preset_property = preset.get_property("Relative Location (SM_Lamp_Ceiling)")

# To get the value
preset_property.eval()

# Set a property value
preset_property.set(Z=10.0) # could've bet set to X=10, Y=10, Z=10, ...

You can download and test it from github here: UnrealRemoteControlWrapper

Check the readme, the test_uremote.py file and the wiki for more infos !

Feel free to contact me here or at contact-at-cgtoolbox.com if needed :slight_smile:

1 Like