logix1390 Posted October 13, 2018 Share Posted October 13, 2018 hello, I am currently studying findattribval vex function and I am trying to do the second example in the help docs here: http://www.sidefx.com/docs/houdini/vex/functions/findattribval.html I am trying to find point 10 with the id attribute and move it on the y axis by 2 and set the color of that point to red. I am getting an error... I will attach my scene for anyone that wants to take a look. Thank you. findattribval.hipnc Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted October 14, 2018 Share Posted October 14, 2018 (edited) Hi, Which version of Houdini are you running ? Seems from the doc that H17 allows findattribval to return an array, but from my doc in H16 or H16.5, the signature of that vex fiunction is only int. So in my opinion, your Wrangle is getting an error because your for loop needs to iterate over an array, while you are feeding it with an integer... In this case, I would recommend to work with findattribvalcount and then iterate with findattribval(0,"point","id",10, count). See their 3rd example :-) Edited October 14, 2018 by StepbyStepVFX Quote Link to comment Share on other sites More sharing options...
logix1390 Posted October 14, 2018 Author Share Posted October 14, 2018 Hi Step, thank you for reply. I am currrently using h16 . I might be a little confused on how to get this working. Is there an example you can show me with find attribbval function? Even with the third example I can't get it working properly. I am trying to make point 10 turn red and move it up on Y. int count = findattribvalcount(0, "point", "id", 10); int point_num; for (int i = 0; i < count; i++) { point_num = findattribval(0, "point", "id", 10, i); @Cd=set(1,0,0); @P.y+=3; } This ends up doing it to all the points instead of point 10 only. Thank you. Quote Link to comment Share on other sites More sharing options...
Noobini Posted October 14, 2018 Share Posted October 14, 2018 I tested 16.0 and 16.5....errors H17 works fine. For your last effort, try this: int count = findattribvalcount(0, "point", "id", 10); int point_num; vector newpos; for (int i = 0; i < count; i++) { point_num = findattribval(0, "point", "id", 10, i); setpointattrib(0, "Cd", point_num, {1,0,0}, "set"); newpos = point(0, "P", point_num) + {0,3,0}; setpointattrib(0, "P", point_num, newpos, "set"); //@Cd=set(1,0,0); //@P.y+=3; } (note: even tho H17 works without errors...logically it is still wrong as it affects EVERYTHING......instead of just one point, hence it needs same logic as my solution above) Quote Link to comment Share on other sites More sharing options...
logix1390 Posted October 15, 2018 Author Share Posted October 15, 2018 Thank you Noobini , this works. This is the first time I am using this function. Is it possible to get the second example in the help docs to work in 16.5 ? Help docs example: for (int point_num : findattribval(0, "point", "age", 10)) { // ...do something with the point... } I guess I am just trying to simplify this as much as possible for a better understanding. Thank you for the help Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted October 15, 2018 Share Posted October 15, 2018 No, the findattribval of 16 and 16.5 returns integers, and not arrays therefore the for loop cannot work properly (it does not know on what to iterate). If you want to learn to learn VEX on Houdini version 16 and/or 16.5, refer to the docs of those versions, do not use the docs of H17 :-) Quote Link to comment Share on other sites More sharing options...
logix1390 Posted October 15, 2018 Author Share Posted October 15, 2018 Ok. makes sense. Thank you ! 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.