Hey all,
I'm setting up an asset and need to pick between different map directories based on user selection.
So for example…
On the asset I'm creating an integer parameter that contains the selection
>body
>ears
>blah
if I then create a parameter that has 5 strings (all different directory locations for a map )
How would I set it up so the integer parameter controls which string is actually used?
So inside my asset I just query that string parameter.
The reason I want to us an integer as my master control is because this integer value will also control switches inside my asset.
Am I approaching this the right way?
Cheers
selecting a string in a spare channel
3603 3 2- pgrochola
- Member
- 36 posts
- Joined: Feb. 2009
- Offline
- Antoine Durr
- Member
- 321 posts
- Joined: July 2005
- Offline
pgrocholaThere are a couple of options. 1) make 5 string parms, e.g. path0, path1.. path4, and then use `chs(“path” + chs(“part”))`, where ‘part’ is your integer param; or 2) set the path to /foo/bar/`ifs(ch(“part”)==0,“head”,ifs(ch(“part”)==1,“tail”, “neck”)))`.rat
Hey all,
I'm setting up an asset and need to pick between different map directories based on user selection.
So for example…
On the asset I'm creating an integer parameter that contains the selection
>body
>ears
>blah
if I then create a parameter that has 5 strings (all different directory locations for a map )
How would I set it up so the integer parameter controls which string is actually used?
So inside my asset I just query that string parameter.
The reason I want to us an integer as my master control is because this integer value will also control switches inside my asset.
Am I approaching this the right way?
Cheers
i.s. just make a honkin' ifs() string.
– Antoine
- pgrochola
- Member
- 36 posts
- Joined: Feb. 2009
- Offline
- Antoine Durr
- Member
- 321 posts
- Joined: July 2005
- Offline
pgrocholaThere is (as always) a third option, one that I actually like better than the original two, but takes a bit more setup. The part that I've never liked with an integer setup is that there are two places where you have to keep a list of words, i.e. you have to keep your switch SOPs in sync with what the UI is doing.
That's exact what I was after.
Good stuff. Thanks Antoine!
An approach I've used is to make a fancier switch() function, one which takes a string as a parameter. Thus you make a string param in the UI that has the actual word, “head”, “neck”, “shoulders”, etc., and then you write this switch() function that does a for/next loop on the inputs of the SOP, comparing each one with the word from the parameter. Thus, if the inputs to the switch SOP were prep_head, prep_neck, and prep_shoulders, the for loop would go from 0 to opninputs(“.”), and do an strcmp() or an rindex() of the opname() with the word from the parameter in the UI. Thus selecting ‘neck’ in the UI would set that param to ‘neck’, not to 2, and then the fancy switch() would check, "hmm, which of my inputs ends in ‘neck’, and return the input number that matches, and then the switch SOP works as expected.
– Antoine
-
- Quick Links