Python - Blender/Maya to UE4 using Remote Execution

Poking around the “” file I was able to create this rough test. The test basically returns an array of ue4 asset paths from ue4 back to the application running python.

To run the test you need to first, enable the python scripting plugin and turn on “Enable Remote Execution” under “Project settings” => Plugins => Python =>Python Remote Execution

Then in UE4, select a few assets in the asset browser and then run the below code in the python script editor in blender, maya, or whatever python terminal you got.

There are a lot of possibilities here!!

…Also I am looking forward to the release of “Blender - Send to UE4”

import sys
sys.path.append(r'C:\Program Files\Epic Games\UE_4.24\Engine\Plugins\Experimental\PythonScriptPlugin\Content\Python')
import remote_execution as remote

def executeCommand(command):
    remote_exec = remote.RemoteExecution()
    exec_mode = 'EvaluateStatement'
    rec = remote_exec.run_command(command, exec_mode=exec_mode)
    if rec'success'] == True:
        return rec'result']
    return None

#Based on the selected assets in the ue4 asset browser, return an array with asset paths
#'StaticMesh"/Game/art/Meshes/ST_gourd01.ST_gourd01"', 'StaticMesh"/Game/art/Meshes/ST_gourd02.ST_gourd02"']
def getSelectedAssetPaths():
    assetPaths = ]
    command = "str(unreal.GlobalEditorUtilityBase.get_default_object().get_selected_assets())"
    result = executeCommand(command)
    if result != None:
        string = result[2:-2]
        for e in string.split():
            path =  e.replace("\\'","").replace(",","")
    return assetPaths