How to access Parameter Iteration for disabling conditions

   834   4   0
User Avatar
Member
55 posts
Joined: Nov. 2019
Offline
Hello community!

I am trying to dynamically disable parameters based on their iteration number, but I haven´t been able to find how to access those values, # is clearly not working

Does anyone know how can access the iteration number of the parameter created on the list?

Thanks

Attachments:
snip.png (36.4 KB)
snip2.png (4.1 KB)

User Avatar
Member
8525 posts
Joined: July 2007
Offline
Cicuta
# is clearly not working
# does work, but it has to resolve to valid parameter name
to fit the syntax described in docs [www.sidefx.com]
{ parm_name [operator] value ...} ...

I'm confused by your usage, what exactly are you expecting ?
if it worked the way your screenshot suggests, then all but the first multiparm element would always be disabled, with no way to enable them, is that what you are after?

here is an example of working # within the conditional, may not be what you are after, but shows the usage
Edited by tamte - June 15, 2022 17:41:30

Attachments:
ts_multiparm_disable_by_index.hipnc (86.0 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
55 posts
Joined: Nov. 2019
Offline
Hello Tomas! Thank you for your reply!

I meant that '#' wasn't working on its own, isolated, so that I could access the number of iteration without having to assign it to a parameter. After some research I discovered the syntax' limitations that you mentioned and found out that that context only works with existing parameters, as well as the left/right side limitations (https://www.sidefx.com/docs/houdini/ref/windows/optype.html#conditions):
You can’t use expression functions in the rule string. However, a workaround is to create an invisible parameter containing an expression that calculates what you need, and then reference it in a comparison.

And I did exactly that (it would be cool to have a more straight forward way to do it). Thanks for the file! But the interaction I was looking for is a bit more complex (Sorry if my explanation wasn´t too clear): Based on a the value of a integer channel, being able to dynamically disable parameters in another node.

For anyone that might be interested I will briefly explain the workaround I did in the attached file so that you don´t miss some of the hidden lines of code inside the parameter interface:
As you can see in the code in the file, I bring the values of that integer channel, the total number of elements in the multiparm list, and then run them through a for loop to create an attribute (@active) that will have value 1 or 0 depending on the equivalence of the number of the iteration of the parameter and the number of the integer channel of the beginning. That @active then is assigned to the default value of a toggle parameter (when setting this value with detail(), be mindful of calling 'active'+#, to call the attribute based on the iteration) and finally the rule for the multi parameters is set to { active# != 1 }. This is the only way I could think of to have dynamic control of the disabling option.

I hope this workaround is useful to someone. If there is any other more straight forward way of doing this let me know
Edited by Cicuta - June 16, 2022 10:22:13

Attachments:
ts_multiparm_disable_dynamic.hipnc (106.2 KB)
snip01.png (31.4 KB)

User Avatar
Member
8525 posts
Joined: July 2007
Offline
you don't need any wrangle for this
just use this in the enable# parameter expreion ch("control")==#then it will be controlled by matching value by default

Attachments:
ts_multiparm_disable_dynamic_alt.hipnc (88.3 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
55 posts
Joined: Nov. 2019
Offline
This was exactly what I was looking for, to get the value of '#' somehow. I was so focused on the other way I didn't even think of trying your way. Thank you very much! <3
  • Quick Links