Jump to content

point wrangle to multiply radius of clothCapture


Doum

Recommended Posts

Hello,

I'm a newby with VEX code and I need to use the point wrangle sop to do the operation that I need.

I would like to multiply the attribute created by the clothcapture sop "clothCapture. It's a point attribute and the problem I encounter is that it's a array of float for each point. I'm trying to get this array and multiply each value with an attribute that I will paint on the geometry.

The idea look simple, but I don't know where to start and how to get that array attribute inside VEX?

Maybe there is another way to do that, I'm open to any solution.

thanks

Doum

Link to comment
Share on other sites

You can use something like this, as I've yet to find how to import attribute types other than the ones listed in the documentation.


//Create array to hold the attribute values in and get it from the first input
float attributeValues[];
getattribute(@OpInput1, attributeValues, "point", "pointAttribute", @ptnum, 0);
//Iterate over values, multiplying them
foreach(int i; float number; attributeValues) {
attributeValues[i] *= @Cd.x;
}
//Finally place the multiplied array back
addattribute("pointAttribute", attributeValues, arraylength(attributeValues));
[/CODE]

[b]Edit[/b]: getattribute had a @id instead of a @ptnum, fixed it.

[b]Edit2[/b]: Cd.x = red. So the color you paint should be red :)

Edited by WesleyE
  • Like 3
Link to comment
Share on other sites

  • 4 months later...

Thank you so much Pezetko!!! Your comments inside the .hipc file were soooo helpful!! :)

I didn't even know that I can make attribute be an array by setting the size.. :blush: . Although it seems strange that if I set the size lets say to 6 there's no interface to set the values after the fourth component...Anyway..

Thanks again!!!

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...