run a python script in Unreal after HDA cooks VAT assets
1106 1 0-
- johnLIC
- Member
- 43 posts
- Joined: May 2013
- Offline
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.
-
- adam_perin
- Member
- 6 posts
- Joined: Dec. 2018
- Offline
I have done this before by using unreal's remote control api. This allows you to control unreal from a web request.
https://docs.unrealengine.com/en-US/ProductionPipelines/ScriptingAndAutomation/WebControl/QuickStart/index.html [docs.unrealengine.com]
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.
its a little hacky but has worked well for us
https://docs.unrealengine.com/en-US/ProductionPipelines/ScriptingAndAutomation/WebControl/QuickStart/index.html [docs.unrealengine.com]
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", "parameters": { "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