ifs in expression for file output

   1956   3   0
User Avatar
Member
143 posts
Joined: March 2014
Offline
Hello,

Can someone give me a hint on how to conditionally return a string within an expression? I've tried several different syntax but can't seem to get it right. The “ifs” never resolves when I middle-click to see the value (shown in “resolved.png”). It resolves both paths correctly, but doesn't return just one. I'm sure I'm missing some single quotes somewhere or something…any help is really appreciated.

Thanks,
Caesar

Attachments:
script.PNG (27.1 KB)
resolved.PNG (39.1 KB)

User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Because it is a string parameter your ifs() needs to be wrapped in `` to cause it to evaluate as an expression. This also then requires you to modify the string formatting of everything else since they aren't being treated as actual strings, expression-wise. The following should evaluate as you expect:
`ifs(1==1, “$HIP/render/” + opname(“../..”) + “/$OS.$F4.png”, “$HIP/render/” + opname(“../..”) + “/$OS.png”)`

Also in your specific example, you could make the ifs() less complex and only handle the addition of the $F4 to the path:
$HIP/render/`opname(“../..”)`/$OS`ifs(1==1, “.$F4”, “”)`.png
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
143 posts
Joined: March 2014
Offline
graham,

Thank you so much, I was struggling with this for quite a while - really you saved me a great deal of trouble!!!

Thanks again,
Caesar
User Avatar
Member
143 posts
Joined: March 2014
Offline
Is there a way to put these expressions in a file such that it doesn't have to be pasted to every textbox that it is used in? So that I can only change it once and have it applied to all (without creating a digital asset)?
  • Quick Links