sideeffects / HoudiniEngineForUnreal-v2

Houdini Engine Plugin for Unreal Engine 4 - Version 2
http://www.sidefx.com/unreal
Other
295 stars 75 forks source link

Passing data to an instanced HDA #83

Open eetumartola opened 3 years ago

eetumartola commented 3 years ago

My use case would benefit greatly from a setup where a master HDA would distribute HDAs into the world, which would then do their thing.

The problem here is that I have not yet found a way to pass any information to the instanced HDAs. I could bootstrap things with just an ID and then read other parameters from a database or file or something.

Setting the parameters with s@unreal_uproperty_paramname does not work with HDA parameters, as the parameters are only populated when the HDA cooks, and at that point it has, well, already cooked.

If the HDAs live inside a blueprint I can set a blueprint variable with the above mechanism and then set the HDA parameter in a construction script - but seems like HDAs in a certain blueprint are all instanced to be identical.

I've even stooped so low as to ponder encoding an ID to the fraction of the y-rotation of the asset (original rotation truncated to a whole degree), and then the asset could read it with hou.parent().worldTransform().extractRotates() ...

Damien here discusses a possible future solution of setting tags on the actor, and then the HDA reading them when starting cooking and setting the parameter values. This would do the trick, but I do not know how serious the comment was and how far in the future it would be. https://www.sidefx.com/forum/topic/51745/#post-327515

Have any of you folk been thinking about these problems or even gotten to a solution of some sort?

eetumartola commented 3 years ago

In fact I think the root problem here is that the parameters are not populated until the HDA has cooked.

From the outside I see no theoretical reason why the parameters could not be populated when the HDA is instanced to the world, without the HDA getting cooked. I presume there was a valid reason for it to be the way it was, but here's hoping it could work another way one of these days :)

nanocell commented 3 years ago

You're right in that theoretically it can be done, it's just a "missing feature" at this stage. It may not necessarily be via the 'uproperty' mechanism but we could implement something similar, for example: s@unreal_hdaparam_paramname = value, cache these values on the instanced HDA actors, and then use those cached values to populate the HDA parameters when they get created for the first. Or something along those lines.

@dpernuit Is there an RFE for something like this already?

dpernuit commented 3 years ago

Yes, we do. I also agree it'd be best to use a separate set of attributes than the uproperty ones for hda parameters.

As for fetching parameters without first instantiating, that was a HAPI limitation. We've added new functions for that in H18.5, but the UE4 plugin doesn't use them for now, as those functions didn't exist at the time.

eetumartola commented 3 years ago

Hey, this sounds promising!

As of now I'm holding my breath ;)