Attribute to match across inputs






Houdini 19.0

1 Example 1

The attribute wrangle can match common attributes from other inputs using the @opinput virtual bindings. Usually this is done based upon identical point numbers. However, there is also a match attribute parameter hidden under the second tab of the attribute wrangle that can be used for matching corresponding IDs. You can find a simple example for both cases in the download section (opinput.hip).

2 Example 2

In this example (match_id.hip) we are going to store a random color array on a single point and assign its values to the points of a grid. But first we bind an ID attribute to all points of the grid.

i@id = 1;

We also bind an identical attribute with the same integer value to the single point. Also we create an array with as many random colors as we have points on the grid attached to the second input npoints(1).

i@id = 1;

v[]@colors = {};
resize(@colors, npoints(1));

foreach(int i; vector clr; @colors){
    v@colors[i] = rand(i);

Lastly, we assign all vector values from the array to their corresponding points on the grid using @opinput1 and choose their index based on i@ptnum. This only works when the match attribute (which is hidden under the second tab on the attribute wrangle) is set to id and the IDs are identical. Now either of these lines will work.

//v@Cd = getcomp(v[]@opinput1_colors, i@ptnum);
v@Cd = v[]@opinput1_colors[i@ptnum];