referencing attributes of other nodes in VEX

   6078   8   3
User Avatar
Member
131 posts
Joined: Sept. 2017
Online
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
mestela
Member
1460 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
131 posts
Joined: Sept. 2017
Online
Thanks, that makes sense. I'll do it like that.
User Avatar
Member
1895 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);
mestela
Member
1460 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
131 posts
Joined: Sept. 2017
Online
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
6827 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
452 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
191 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