Custom script UI "showIF" for multiple values?

Ines Hilz
Ines Hilz Posts: 38 🔥
edited May 2022 in Programming #1

Hi all! :)

what i am looking for is a way to show a field if value 1 OR 2 OR 3 is true.

I already tried

{"showIf":"Options_amount", "showIfValue":"3Options" , "4Options" , "5Options"}


{"showIf":"Options_amount", "showIfValue":"3Options" || "4Options" || "5Options"}

Both without any success.. is it possible?


a further example:
//@input string Options_amount = "3Options" {"widget":"combobox", "values":[{"label":"3 Options", "value":"3Options"}, {"label":"4 Options", "value":"4Options"}, {"label":"5 Options", "value":"5Options"}]}

//i want to show this when option 3, 4 OR 5 are selected:
//@input Asset.Texture myOption3 {"showIf":"Options_amount", "showIfValue":"3Options"} 

//i only want to show this if Option 3 OR 4 are selected
//@input Asset.Texture myOption4 {"showIf":"Options_amount", "showIfValue":"4Options"} 

//this i only want to show if Option 5 is selected, so this works fine for me:
//@input Asset.Texture myOption5{"showIf":"Options_amount", "showIfValue":"5Options"} 

Hope it's understandable,

Cheers, Ines


  • Max
    Max Posts: 26 🔥

    +1 for this! I'm afraid that's currently not possible 🤔

    I was trying to do something similar - having one parameter only show when two other parameters were a certain value. For example (warning: this code does not work)

    //@input bool option1
    //@input bool option2
    //@input bool option3 {"showIf":"option1 && option2"} // only show this bool if both others are true

    This would help make assets more intuitive! :)

  • Bennyp3333
    Bennyp3333 Posts: 2
    edited December 2022 #3

    You can create groups for an and gate workaround. Although creating groups inside of groups is not the most clean solution.

    //@input bool option1
    //@input bool option2
    //@ui {"widget":"group_start", "showIf":"option2"}
    //@input bool option3 {"showIf":"option1"}
    //@ui {"widget":"group_end"}