multiparm "#" symbol? how it works?

   6995   4   0
User Avatar
Member
9417 posts
Joined: 7月 2007
オフライン
i have created a new multiparm folder
inside i have 2 parameters
toggle get_path#
string path#
i have set default value for the second parameter:

`ifs(ch(“./get_path#”),opsubpath(“./obj#”),“”)`

i expected to get this after adding 1st instance of parameters:
`ifs(ch(“./get_path1”),opsubpath(“./obj1”),“”)`
second
`ifs(ch(“./get_path2”),opsubpath(“./obj2”),“”)`


however i got this
`ifs(ch(“./get_path#”),opsubpath(“./obj1”),“”)`

no matter how many “#” symbols i used in my expression, only the last one is evaluated as an instance number
any help?
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
9417 posts
Joined: 7月 2007
オフライン
please, anyone?

can you at least tell me if it should work that way?
can this be considered as a bug?
or am I doing it wrong?
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
941 posts
Joined: 7月 2005
オフライン
tamte
please, anyone?

can you at least tell me if it should work that way?
can this be considered as a bug?
or am I doing it wrong?

It sure looks like bug to me. (please report it).

As a possible workaround in the meantime, you could try an inline function instead of the `ifs()` expression… something like:

`{ id = #; string out = “”; if(id) out = opsubpath(“./obj”+id); return out; }`

Although it looks to me like that call to opsubpath() will always give you what you already know, namely: “obj#”…. and if that's true, then you could just turn it into:

`{ id = #; string out = “”; if(id) out = “obj”+id; return out; }`

But maybe there's more going on that I'm missing.

HTH.
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
スタッフ
5295 posts
Joined: 7月 2005
オフライン
Each # in the expression refers to the instance index in a different nesting level of the multiparm. Since you don't appear to have any mutliparm nesting going on, only the last # will be affected. Mario's solution is likely the only way you can get this to work.
User Avatar
Member
9417 posts
Joined: 7月 2007
オフライン
Thank you Mario and twod !!!

inline function is working great!
i didn't know something like this is possible
I can't find it in documentation
can i call For loop from inline function?

i tried For loop in python, but it seems to me that i can't set multiline expression as a default value of a parameter


ps: opsubpath() returns more than an object name, because i am calling it from an asset and i do not know its name, or name of other parent assets which all i get by opsubpath()
i am using the return string as an reflection mask
but anyways it works, thanks a lot
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links