JJ FX Posted November 13, 2017 Share Posted November 13, 2017 (edited) Hi, So I have some code in a wrangle, that ends with addpoint(). Everything is nice and dandy. But now I think I want some attributes to copy onto new points. There is addattrib() function but im not sure how to make i@branch = @ptnum; if (addpoint(geoself(),pos)) { addattrib(geoself(), "point", "branch", 999 } So this ofcourse does not do what I want. It just overwrites @branch to 999 for every each point that I managed to addpoit(). And what I want is: for every new addpoint() do addattrib(). Edited November 13, 2017 by JJ FX Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted November 13, 2017 Share Posted November 13, 2017 Can you tell if your Wrangle is set on « points » or « details » ? When set to run on points, it apply whathever you have coded to each point, while in details mode, it runs once for the geometry. I don’t know what you want to do exactly, but it seems to me you should run it on « details » mode, and write your algorithm to iterate over all points through a loop, check if it’s a new point and set attribute only on those new points (using setpointattrib() maybe ?). Hope this helps you Quote Link to comment Share on other sites More sharing options...
fencer Posted November 13, 2017 Share Posted November 13, 2017 int np = addpoint(0, @P); setpointattrib(0, "id", np, 123, "set"); Quote Link to comment Share on other sites More sharing options...
acey195 Posted November 14, 2017 Share Posted November 14, 2017 (edited) 14 hours ago, fencer said: int np = addpoint(0, @P); setpointattrib(0, "id", np, 123, "set"); Also if you use: int np = addpoint(0, @ptnum); the new point will inherit all attributes (including position) and groups from the source point. Edit: also note that fencer's code will only work in Houdini 15 (or maybe 16) or later Edited November 14, 2017 by acey195 Quote Link to comment Share on other sites More sharing options...
JJ FX Posted November 14, 2017 Author Share Posted November 14, 2017 (edited) Yes yes yes exactly setpointattrib. Figured it out in the morning. But big thanks! No need for silly attr transfer sop now, so cool Edited November 14, 2017 by JJ FX 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.