Doum Posted June 7, 2013 Share Posted June 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
WesleyE Posted June 7, 2013 Share Posted June 7, 2013 (edited) 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 inputfloat attributeValues[];getattribute(@OpInput1, attributeValues, "point", "pointAttribute", @ptnum, 0);//Iterate over values, multiplying themforeach(int i; float number; attributeValues) { attributeValues[i] *= @Cd.x;}//Finally place the multiplied array backaddattribute("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 June 7, 2013 by WesleyE 3 Quote Link to comment Share on other sites More sharing options...
Doum Posted June 7, 2013 Author Share Posted June 7, 2013 Thx a lot wesleyE, I'll give this a try on monday! Have a nice weekend! Doum Quote Link to comment Share on other sites More sharing options...
dpap Posted October 13, 2013 Share Posted October 13, 2013 (edited) Thanks WesleyE! That was usefull info! But how can I see at point number 8 for example, what's the value of "pointAttribute"? I tried float temp=attributeValues[8]; f@out=@temp; but no luck.. ARRAY TESTS upload.hipnc Edited October 13, 2013 by dpap Quote Link to comment Share on other sites More sharing options...
pezetko Posted October 13, 2013 Share Posted October 13, 2013 I'm not sure if it's best approach but you can use import or getattribute and specify exact point number. If you want to access array value on different array index you need array and access it directly. Look at hipfile. Hope it helps. ARRAY TESTS upload-2.hipnc 2 Quote Link to comment Share on other sites More sharing options...
dpap Posted October 14, 2013 Share Posted October 14, 2013 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.. . 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!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.