Jump to content
Sign in to follow this  
konstantin magnus

Array values to points

Recommended Posts

Posted (edited)

While trying to create a point attribute based on array values from second input, I was expecting this to work:

v@Cd = v[]@opinput1_colors[@ptnum]; // only works on point 0

I also tried getcomp(), but it seems I am missing something.

vector a = getcomp(v[]@opinput1_colors, @ptnum); // uses first array value on all points
addpointattrib(0, "Cd", a);

 

camera_to_screen.hiplc

Edited by konstantin magnus
Here is an simplified example

Share this post


Link to post
Share on other sites

im not familiar with @opinput1_"variable" syntax, but it seems like i points to the same pointnumber as itself. So since you only have one point i input number two, the only point that finds anything is point number one on your mesh.

I dont know the endgoal here, but if you want to access the "colors" array on point 0 on all your points, you can write it like this.

vector array[] = point(1,"colors",0);
@Cd = array[@ptnum];

 

  • Like 1

Share this post


Link to post
Share on other sites

Yes. I found for myself that the key F1 is most useful  key when you learn some soft.

And one tip, in case if you didn't know that yet. If you put cursor at function's name in wrangle and press F1 then pop-up Help Browser with help for this function. It works for expressions in Edit Expression window also. Very helpful sometimes.

Share this post


Link to post
Share on other sites

Well, I usually read the documentation where needed. But I ignored the attribwrangle page thinking everything is done inside VEX code.

I dont find the idea of setting "invisible" match attributes particularly elegant, either, as they dont show up in the code. But it seems to be the most straight forward way to access arrays fro other nodes in Houdini, so thank you again for the hint!

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
Sign in to follow this  

×