parameter from an operator path

   3511   11   1
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
working in an asset.
I use an Operator Path.

I want to read parameters from the node of the operator path is connect to.

if I use this vex code in a wrangler, it works:

f@parameter = ch("../"+ch("../node")+"/parameter");

“../node” is my operator path where I connect the node, and “parameter” the parameter I want to read.

but when I use that code into a node parameter, as a vex expression it does not work.

I mean "ch(“../”+ch(“../node”)+“/parameter”)"

thanks
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
7758 posts
Joined: 9月 2011
Online
did you mean ...+chs("../node")+...?
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
I tried chs and ch. but it does not work.
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
ops.. it works… maybe I put it wrong first time.
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
jsmack
did you mean ...+chs("../node")+...?
thanks for makes me check it.
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
8539 posts
Joined: 7月 2007
Online
in Hscript expressions you better use chsop() instead of chs() it will handle conversion to absolute path for you automatically so you just need to add parm name

so for getting the numerical parm using expression it would be something like:
ch(chsop("../node")+"/parameter");
Edited by tamte - 2020年5月11日 18:13:43
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
tamte
in Hscript expressions you better use chsop() instead of chs() it will handle conversion to absolute path for you automatically so you just need to add parm name

so for getting the numerical parm using expression it would be something like:
ch(chsop("../node")+"/parameter");

Thanks you tamte for this tip.. I will do it.
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
I have another question
How can I get a ramp with an expression? include all its points or colors?

thanks for your support
Edited by Gerardo Castellanos - 2020年5月11日 21:12:53
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
8539 posts
Joined: 7月 2007
Online
Gerardo Castellanos
How can I get a ramp with an expression?
hard to say what the actual question is
In Hscript
- if you actually want ramp to link to another ramp dynamically by providing operator path I don't think you can do that
- if you just want to link 2 ramps, the easiest is to RMB on ramp label/copy parameter and on another ramp RMB/Paste Relative References
- if you just want to sample the ramp at certain position you can use chramp() [www.sidefx.com]

In VEX:
- there is chramp( [www.sidefx.com]) too, which can sample ramp at certain position
- if you need more control chi() will give you number of keys then, you can also iterate over all keys and build array yourself, then use spline() function for example to interpolate or ehatever

in Python:
- you can use hou.Parm.evalAsRamp() to get hou.Ramp object and do whatever you need, whether it's a lookup or other stuff
Edited by tamte - 2020年5月11日 21:29:56
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
43 posts
Joined: 3月 2016
Offline
tamte
hard to say what the actual question is

thanks @tamte

I want to do same I did before. I have an operator path and want to copy a ramp parameter of that node in another node using expressions.
Gerardo Castellanos
www.gerardocastellanos.com
User Avatar
Member
8539 posts
Joined: 7月 2007
Online
Gerardo Castellanos
I want to do same I did before. I have an operator path and want to copy a ramp parameter of that node in another node using expressions.
so to summarize previous answer, not as a dynamic link between 2 ramps based on operator path, but you still have plenty of options to lookup any value from a ramp parameter based on operator path
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
192 posts
Joined: 12月 2016
Online
I think i want to do the same thing.

What i`d need is something like this but actually working

ch("../attribwrangle3/Divisions" + "(detail("../foreach_count1/","iteration",0)+1)" +"pos")"

To get
ch("../attribwrangle3/Divisions1pos")

At iteration 0

Mine of for use in a regular expression not in a wrangle or anything like that

Id also like to change a group name according to the iteration.
Edited by NicTanghe - 2021年4月21日 07:54:21

Attachments:
Basilica.hipnc (115.2 KB)

  • Quick Links