run a python script in Unreal after HDA cooks VAT assets

   1251   1   0
User Avatar
43 posts
Joined: May 2013
Is there an easy way to run a python script in Unreal after an HDA is finished cooking? I see options from the Houdini side, but I want to automate the Unreal setup after the VAT ROP is run in an HDA - import the pos and rot textures, import the fbx, set up the material instance, etc. I know that VAT 2.1 has some scripts, and I'm using the materials that have been provided, but I want to run the setup from a python script, since it's basically the same steps every time.
User Avatar
6 posts
Joined: Dec. 2018
I have done this before by using unreal's remote control api. This allows you to control unreal from a web request. []

The method I have done is to have a houdini pyhton node at the end that makes a request (request module) that unreal is listening for. And I specifically target the pyhton interp in unreal. Here is a little example of what that could look like from hoduini.

payload = {
            "objectPath": "/Script/PythonScriptPlugin.Default__PythonScriptLibrary",
            "functionName": "ExecutePythonCommandEx",
                    "PythonCommand": "import my_module\nmy_module.func('{0}')".format(string_arg)

        result = requests.put(UNREAL_ENDPOINT, json=payload)

its a little hacky but has worked well for us
Edited by adam_perin - March 31, 2021 14:25:48
  • Quick Links