Jump to content

vector on detail (VEX)


gerardocastellanos

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.

 

Link to comment
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
Link to comment
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

 

 

Link to comment
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().

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...