Output an Asset's Parameter List and the Parameters' Data

   1866   2   2
User Avatar
Member
5 posts
Joined: Jan. 2019
Offline
Hello,

I'm looking at accessing a Houdini asset's parameters in Unity through a C# script. So I would like to output a complete list of the Asset Parameters I can see in the HEU_Houdini Asset Root component. I would like to be able to get both their name, the value they are set to and the min/max value of the scale.

The way I've solved it now doesn't feel very optimized. I use the HEU_ParameterData and get the parameters it contains until it runs out of parameters.

List<HEU_ParameterData> allParams = new List<HEU_ParameterData>();
int count = 0;
while (true)
{

HEU_ParameterData test = wantToDuplicate.Parameters.GetParameter(count);


Then the second problem comes where I can't see what type each parameter is so I have to check each case with HAPI_ParmType.HAPI_PARMTYPE for int, float, string, color etc. in order to be able to get what type of value they have using HEU_ParameterUtility.GetInt() for example.


Is there a better way or a function I am not aware of that would solve this problem in a smoother way?


Thank you!
User Avatar
Member
571 posts
Joined: May 2017
Offline
There isn't a better way yet, but I'll add in the following function soon:
public List<HEU_ParameterData> GetParameters()
{
    return _parameterList;
}

For now, you can just add that locally to HEU_Parameters.cs. Then remove it once the plugin has it.
User Avatar
Member
5 posts
Joined: Jan. 2019
Offline
Great, thank you for the help!
  • Quick Links