Jump to content
gerardocastellanos

vector on detail (VEX)

Recommended Posts

Hi everybody

I want to use the "detail" function as an expression in a node parameter to read a vector component.

detail("../sourceData","color.r",0)

but it does not work. I tried "color.0", same result

when I use just "color", it reads something, an average could be, anyway I just want to read one component of a vector value.

how can I do that?

thanks you.

 

Share this post


Link to post
Share on other sites

Hi Gerardo,
you should read the whole vector and then get its component.

 

Also, if the "../sourceData" is meant to be path to a node, then it is wrong. You should not use relative path to specify the geometry. Here are the methods:
https://www.sidefx.com/docs/houdini/io/op_syntax.html

Or here, read my post:

 

Then, after you fix your path ... here are two methods to get the indexed component:

vector color = detail(0, "color", 0);

@color_r = color[0];           // first method
@color_r = getcomp(color,0);   // second method

 

Edited by ikoon

Share this post


Link to post
Share on other sites
24 minutes ago, ikoon said:

 


vector color = detail(0, "color", 0);

@color_r = color[0];           // first method
@color_r = getcomp(color,0);   // second method

 

Thanks a lot for your answer

but I am working in a parameter of a node, I can not write multiple lines code.

and I am using relative paths because it is a asset, and I want to re-use it in others places and scenes.

thanks you again

 

 

Share this post


Link to post
Share on other sites

Hi, in the title of the topic, you defined it as a VEX. If you are typing into a parm, then you are using probably a Hscript Expression Language, not VEX (it could be python as well). I assume that you have an Expression and this should work:

detail("../sourceData","color",0)

 

The detail() expression has different syntax then detail() vex function, and the third argument is attrib_index (or in other words, third argument is 0 for color[0], 1 is for color[1] etc.)

https://www.sidefx.com/docs/houdini/expressions/detail.html

What I wrote in previous post is related to VEX detail(), not Hscript Expression detail().

Share this post


Link to post
Share on other sites

No problem. I hope that it works fine now.

I also want to add one thing. You can write multiple lines of code even in the parm, like this (start with RMB on the parm). Or hit Alt+E, when editing the parm:

image.png.f8a057934d1df92d4c6582bf410c1310.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×