Tyfx567 Posted December 1, 2016 Share Posted December 1, 2016 Hey guys, I am wanting to loop over points and take say some random attribute from 0-10 let's say on the points. I want to take that attribute and for every point store the previous attribute of the previous point it is looping through and append it to the list. example: num numarray point 0 = 2 [2] point 1 = 4 [2,4] I attempted to do this in vex and it already is looping over the points so you can't do an append as far as I am aware because you can't look at previous point. If you can please let me know With python you can, but since I am so new to python I can't even get arrays working in python I create attribute with "attribute create" node before python node so I get [] empty array on the point attribute. I call it "emptyarray". then I try this node = hou.pwd() geo = node.geometry() points = hou.Geometry.points(geo) testarray = [2,5] #test #readA = hou.Geometry.findPointAttrib(geo, "emptyarray") for i in points: hou.Point.setAttribValue(i, 'emptyarray', testarray) But it does nothing but error out Quote Link to comment Share on other sites More sharing options...
dimovfx Posted December 1, 2016 Share Posted December 1, 2016 in vex you can look at specific point number, for example to read from previous point you can use @attrib2 = if (@ptnum > 0) point(0, "attrib1", @ptnum-1); on the first point this won't work so that's the "if" statement is for. Quote Link to comment Share on other sites More sharing options...
Tyfx567 Posted December 1, 2016 Author Share Posted December 1, 2016 It doesn't work as well with arrays though. That's the problem. check out the "reorder_pieces1" node. You can't do arrays like this Vex_issue.hip Quote Link to comment Share on other sites More sharing options...
dimovfx Posted December 1, 2016 Share Posted December 1, 2016 int array[]; int @array[]; for (int i = 0; i <= @ptnum; i++) { int newNf = atoi(lstrip(point(0,"name", i), "piece")); append(array, newNf); } @array = array; I couldn't quite get what you are after, but does this helps? Quote Link to comment Share on other sites More sharing options...
Tyfx567 Posted December 1, 2016 Author Share Posted December 1, 2016 That was exactly what I am after thank you! If I have any other issues I will post them here thank you so much! Is int @array[]; how you make a blank array attribute? Because that is extremely useful. I didn't know you could do that with arrays. I thought you had to add it with addpointattrib and then setpointattrib.. Quote Link to comment Share on other sites More sharing options...
dimovfx Posted December 1, 2016 Share Posted December 1, 2016 yes, that's how you define empty variables or attributes. you just have to change your point of view. look at the wrangle from every point angle. it evaluates at every point, so for example if I'm on point number 10, what should I write to do this or that. coming from maya, It took me awhile to understand houdini ways,... 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.