Fyre Posted March 16, 2017 Share Posted March 16, 2017 Trying to use an attribute to drive random values in a carve. Works in subnet foreach but not new for each. forLoopCarveProblem.hip As far as I'm aware the carve can't use $PR etc directly so I'm using the prim function in a forEach loop. Just a bit confused as to whats going on. If I create the setup in a "new" foreach loop I'm getting the same U value for each curve, but If I create the carve and use the prim attribute in a subnet for each loop it works fine. Now I'm guessing theres something different in how these two operate. AforLoopCarveProblem.hips I can't use PR I'm using 0 in the loop, and the subnet (as far as I can tell) culls each primitive into its own geometry?? So this works? But the new foreach loop will just take the value of primitive 0 and apply it to every iteration? Or am I way of base here, Confused. Quote Link to comment Share on other sites More sharing options...
Sepu Posted March 16, 2017 Share Posted March 16, 2017 (edited) You gotta use the Create Meta Import Node and use the iteration number. Then you can use this on your carve rand(detail("../foreach_begin1_metadata1/", "iteration", 0)) Edited March 16, 2017 by Sepu Quote Link to comment Share on other sites More sharing options...
Fyre Posted March 17, 2017 Author Share Posted March 17, 2017 Thanks very much, I got it to work per your advice, however its all contained within the carve now. This is using iteration as the attribute for each primitive, which is fine, but what if I wanted this value to be driven by 'dist' attribute, created outside the for loop and call it in? Like in my example scene? i.e. for each 'iteration' use 'dist' cheers Quote Link to comment Share on other sites More sharing options...
Skybar Posted March 17, 2017 Share Posted March 17, 2017 You don't have to use foreach at all. See post here by Mawi: Quote Link to comment Share on other sites More sharing options...
Sepu Posted March 17, 2017 Share Posted March 17, 2017 As David mention you do not have to use for each for this, but if you want to know You can also do this on the carve then you will get the same as your old for each. fit01(rand(detail("../foreach_begin1_metadata1/", "iteration", 0)),0,.5) or you could also do it with a couple of wrangle to get control, like in the hipnc forLoopCarveProblem02.hipnc 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.