referencing attributes of other nodes in VEX

   9997   8   3
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Hi,

this seems weird, since I could have sworn I used to do this a lot and it always worked, but I was having trouble referencing Attributes of other nodes the other day.
for example, inside a Wrangle node, I'd write:

i@attribute = detail(“../counter”, “numiterations”, 0);

where I renamed the meta import node of a foreach loop to counter. I tried it with the 0 argument at the end and without, nothing seems to work, even autocomplete doesn't show me a list of nodes on the ../ level. It all work in Channel expressions as expected though.
What am I doing wrong?

Cheers,
Ivan
User Avatar
Member
1798 posts
Joined: May 2006
Offline
I don't think you can do relative references like that in a vex call. Connect the usual way and use the 0,1,2,3 syntax, or create a spare input, put the relative or absolute reference in there and use -1 as the geometry reference instead.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Thanks, that makes sense. I'll do it like that.
User Avatar
Member
2127 posts
Joined: Sept. 2015
Offline
You can do what you want. You just need to use the op: reference.

i@attribute = detail("op:../counter”, “numiterations”, 0);
User Avatar
Member
1798 posts
Joined: May 2006
Offline
All that typing though.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
BabaJ
You can do what you want. You just need to use the op: reference.

i@attribute = detail("op:../counter”, “numiterations”, 0);
Works like a charm! Thanks a lot!
User Avatar
Member
8785 posts
Joined: July 2007
Offline
use spare inputs, it will track dependencies and work in compiled networks
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
A wrangle already has multiple inputs and they have no predefined function. Just plug in the second input from the left and use i@iterations =detail(1,“numiterations”,0);
User Avatar
Member
192 posts
Joined: April 2015
Offline
How to do this in a Snippet VOP?

P.s. I know you can use Parameter VOP, but I kinda ask this in relation to my comment right here :$ : https://www.sidefx.com/forum/topic/73545/?page=1#post-310869 [www.sidefx.com]
I'm in COPs so no real possibility to use a direct Wrangle.

Attachments:
vop string parms.gif (4.2 MB)

  • Quick Links