FR3D Posted June 26, 2020 Share Posted June 26, 2020 recursive_division.hip I am trying to randomise a for each using vex and metadata.i only get 0 as a return. I made it work in another scenarios, but i am unable to find why it doesn't work in that specific case. I used all the different script without success: int i = detail("op:../meta","iteration"); or plugged-in int i = detail(1,"iteration"); See the file attached Thanks for the help. Quote Link to comment Share on other sites More sharing options...
anim Posted June 26, 2020 Share Posted June 26, 2020 it works, but you are not using i to compute anything and the current primitive that you are assigning the value to (using i@print = i;) you end up deleting in the same wrangle (using removeprim(0,@primnum,1);) the 2 primitives you are creating will have just default value of print attribute wich is 0 1 Quote Link to comment Share on other sites More sharing options...
FR3D Posted June 26, 2020 Author Share Posted June 26, 2020 (edited) 50 minutes ago, anim said: it works, but you are not using i to compute anything and the current primitive that you are assigning the value to (using i@print = i;) you end up deleting in the same wrangle (using removeprim(0,@primnum,1);) the 2 primitives you are creating will have just default value of print attribute wich is 0 Yes before computing anything i need to be able to bring it in I also realised the issue was because i was deleting the original poly. So i have to rethink the whole thing, i ll try to find a way to store thee value before deleting the poly Thank you anim for answering Edited June 26, 2020 by FR3D Quote Link to comment Share on other sites More sharing options...
anim Posted June 26, 2020 Share Posted June 26, 2020 I mean you have the value in i variable, you can use it to randomize your pos if that's what you want to do 1 Quote Link to comment Share on other sites More sharing options...
FR3D Posted June 26, 2020 Author Share Posted June 26, 2020 2 minutes ago, anim said: I mean you have the value in i variable, you can use it to randomize your pos if that's what you want to do yes the issue is that only the value zero is returned, so the random will not happen differently at each iteeration. I just want to use it to randomise the lerp function, so i can animate the cut in different direction(-1,1) with something like that. direction = floor(fit01(rand(@i),-1,2)); Quote Link to comment Share on other sites More sharing options...
anim Posted June 26, 2020 Share Posted June 26, 2020 the values i contains are correct iteration values the 0 you were observing as explained was due to the default value of your attribute being 0 and the actual iteration value not surviving past the wrangle as you were not storing it as an attribute on any primitive, but inside of that wrangle i has correct value of the iteration just add this to after your 2nd line to have it cactually print to console to see it contains expected values: printf("iteration = %d\n", i); just don't forget to delete this line once you are convinced its working as you don't want it to be printing to console constantly 1 Quote Link to comment Share on other sites More sharing options...
FR3D Posted June 28, 2020 Author Share Posted June 28, 2020 On 26/06/2020 at 12:26 PM, anim said: the values i contains are correct iteration values the 0 you were observing as explained was due to the default value of your attribute being 0 and the actual iteration value not surviving past the wrangle as you were not storing it as an attribute on any primitive, but inside of that wrangle i has correct value of the iteration just add this to after your 2nd line to have it cactually print to console to see it contains expected values: printf("iteration = %d\n", i); just don't forget to delete this line once you are convinced its working as you don't want it to be printing to console constantly Thanks a lot for your help. I managed to make it work, but it didn't give a good result, so i ended up using noise, like in Matt Taylor tutorial. Cheers. 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.