Hi! hope you are fine.
Im trying to use the Houdini Python API inside Unreal Engine to set up and cook a number of HDA's. The idea is that from a selection of static meshes i assign one of those static meshes to each HDA. This is part of the code that does the work:
===============
def run():
api = unreal.HoudiniPublicAPIBlueprintLib.get_api()
global _g_wrapper
global obj
selected_assets = get_geo_asset_path()
for i in range(len(selected_assets)):
obj = unreal.load_object(None, selected_assets.get_path_name())
_g_wrapper = api.instantiate_asset(get_test_hda(), unreal.Transform())
_g_wrapper.on_post_instantiation_delegate.add_callable(set_inputs)
_g_wrapper = None
===============
The code (which is basically taken from the examples):
Gets selected assets into a list.
Calls the Houdini API.
Instantiate those assets in a for loop based on the list.
Set inputs in post instantiation to those HDA's.
The problem is that because post instantiation occurs as a whole process after instantiation then only the last object in the list of selection is assigned, that is, all the HDA's end up with the same object assigned to them (the last one).
I have tried everything, mostly based on the idea of creating a list of HDA's to try to set up the input in later loop but the result is always the same.
Im a bit stuck here.
Any suggestions?
Thanks!
Different geo inputs to a group of HDA's EU Python
2307 0 0- lobachevscki
- Member
- 10 posts
- Joined: Oct. 2014
- Offline
-
- Quick Links