Jump to content
Sign in to follow this  
FR3D

Metadata in wrangle not working

Recommended Posts

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.

 

 

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites
Posted (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 by FR3D

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites
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));

 

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites
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.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×