Add Parameter based on attributes
1593 5 2- sungho1114
- Member
- 18 posts
- Joined: 1月 2016
- Offline
Hello Houdini People
I am almost done with the project, but I just wonder if it is possible to do add the parameters without touching edit operator type properties window. For my hda, it goes through boxes one by one (For each loop)and meshes(wall, ceiling, etc.) is created based on the spawn point and normal on the boxes. The only problem that I have is that all the boxes get same meshes as other boxes and I want to put different meshes on each boxes. Is there a way to add parameters (at least file geometry parameter) on the different meshes (different attributes) or is there an alternative way to put the meshes with VEX?
- krueger
- Member
- 191 posts
- Joined: 10月 2018
- Offline
How about having a folder structure that's consistent for multiple building meshes, then you can have either a slider for the user to pick which building number they want, or assign a random building mesh per box?
ie: you would have a folder like this:
Zassets/buildings/building001/building001_roof.bgeo.sc
Zassets/buildings/building001/building001_roofTrim.bgeo.sc
Zassets/buildings/building001/building001_roofTrimCap.bgeo.sc
etc…
Zassets/buildings/building002/building002_roof.bgeo.sc
Zassets/buildings/building002/building002_roofTrim.bgeo.sc
Zassets/buildings/building002/building002_roofTrimCap.bgeo.sc
etc…
And in your hda you would construct the file path filling in which building number is to be used. Then you don't need the user to input any explicit paths.
ie: you would have a folder like this:
Zassets/buildings/building001/building001_roof.bgeo.sc
Zassets/buildings/building001/building001_roofTrim.bgeo.sc
Zassets/buildings/building001/building001_roofTrimCap.bgeo.sc
etc…
Zassets/buildings/building002/building002_roof.bgeo.sc
Zassets/buildings/building002/building002_roofTrim.bgeo.sc
Zassets/buildings/building002/building002_roofTrimCap.bgeo.sc
etc…
And in your hda you would construct the file path filling in which building number is to be used. Then you don't need the user to input any explicit paths.
- sungho1114
- Member
- 18 posts
- Joined: 1月 2016
- Offline
mkps
How about having a folder structure that's consistent for multiple building meshes, then you can have either a slider for the user to pick which building number they want, or assign a random building mesh per box?
ie: you would have a folder like this:
Zassets/buildings/building001/building001_roof.bgeo.sc
Zassets/buildings/building001/building001_roofTrim.bgeo.sc
Zassets/buildings/building001/building001_roofTrimCap.bgeo.sc
etc…
Zassets/buildings/building002/building002_roof.bgeo.sc
Zassets/buildings/building002/building002_roofTrim.bgeo.sc
Zassets/buildings/building002/building002_roofTrimCap.bgeo.sc
etc…
And in your hda you would construct the file path filling in which building number is to be used. Then you don't need the user to input any explicit paths.
Ohhh I see. Thank you for teaching me an alternative way to change the meshes. I didn't think about changing a file number to change meshes. but I never done this before. how do I set this up in houdini? Do I need to use vex code or is it possible to just use file node to generate it?
- krueger
- Member
- 191 posts
- Joined: 10月 2018
- Offline
You can use regular expressions to build it. So if you have an integer parameter called “userVersion”, you can put this expression in a string parameter and then middle mouse the parameter to see it evaluated. (You might have to fix the drive colon thing if it shows up as a smiley face… )
That can be made more modular as well if you want to break parts of the expression up and reference multiple parameters. ie: have one parameter where it specifies the base folder path. Then ideally you can on different file nodes just append the model name like “roof” or “roofTrim” or whatever.
`"Z:/assets/buildings/building" + padzero(3, ch("userVersion")) + "/building" + padzero(3, ch("userVersion")) + "_roof.bgeo.sc"`
That can be made more modular as well if you want to break parts of the expression up and reference multiple parameters. ie: have one parameter where it specifies the base folder path. Then ideally you can on different file nodes just append the model name like “roof” or “roofTrim” or whatever.
- sungho1114
- Member
- 18 posts
- Joined: 1月 2016
- Offline
mkps
You can use regular expressions to build it. So if you have an integer parameter called “userVersion”, you can put this expression in a string parameter and then middle mouse the parameter to see it evaluated. (You might have to fix the drive colon thing if it shows up as a smiley face… )`"Z:/assets/buildings/building" + padzero(3, ch("userVersion")) + "/building" + padzero(3, ch("userVersion")) + "_roof.bgeo.sc"`
That can be made more modular as well if you want to break parts of the expression up and reference multiple parameters. ie: have one parameter where it specifies the base folder path. Then ideally you can on different file nodes just append the model name like “roof” or “roofTrim” or whatever.
Thank you so much for your help and the example. I will try use this expressions to build the hda.
- krueger
- Member
- 191 posts
- Joined: 10月 2018
- Offline
-
- Quick Links