Wideeagle Posted February 16, 2021 Share Posted February 16, 2021 (edited) Hi everyone I am encoutering an issue with a VEX code. I want to offset a lot of uv island correctly on different UDIMS. So here’s the idea. I have a wrangle inside a for each loop. For the y offset its ok I do: ———————————- //getting current iteration of the for loop int iteration = int(detail(1,"iteration"); @yiter = iteration%chi(‘scale’); ———————————- So if scale is equal to 5 my y offset will be like that: @yiter=1 for island 1 @yiter=2 for island 2 [...] @yiter=5 for island 5 @yiter=1 for island 6 [...] @yter=5 for island 10 etc.... the value reinitializes itself each n iterations. (n defined by my chi(‘scale’) Now for the x, I want it to be incrementing like that: each time @yiter = 10 xiter = xiter + 1 So it gives yiter=1 xiter=1 for island 1 yiter=2 xiter =1 for island 2 [...] yiter=5 xiter=2 for island 5 [...] yiter = 10 xiter = 3 for island 10 so xiter counts how many times yter is reaching chi(‘scale’) and it needs to work for any given scale. Here is what I tried: On input 1 I have my metaimport node. —————————- int Scale = chi('Scale'); int nbloop = int(detail(1,"numiterations")); //total num of iterations for each island i@xiter = 0; //init xiter for (int i=0; i < nbloop;i++) { if(i%Scale == Scale-1) { i@xiter += 1; } } —————————— the thing is that in the end it gives me the total number of 10 iterations ( if I iterate 100 times then xiter=10 but I cant acces xiter each time it does the loop only after it looped nbloop times. Do you have any idea how can I get xiter at each incrementation? Tell me if you need me to be clearer. Thanks a lot ! Edited February 16, 2021 by Wideeagle Quote Link to comment Share on other sites More sharing options...
anim Posted February 16, 2021 Share Posted February 16, 2021 you don't need any loops to move uv isands to specific UDIMs https://forums.odforce.net/topic/45875-udims/?do=findComment&comment=214920 Quote Link to comment Share on other sites More sharing options...
Wideeagle Posted February 16, 2021 Author Share Posted February 16, 2021 but I have a huge number of pieces and I want to organize them on specific udims (lets say for example 10 pieces on 10 udims) thats why I need to iterate Quote Link to comment Share on other sites More sharing options...
anim Posted February 16, 2021 Share Posted February 16, 2021 6 hours ago, Wideeagle said: but I have a huge number of pieces and I want to organize them on specific udims (lets say for example 10 pieces on 10 udims) thats why I need to iterate you can assign different i@udim prim attribute value to each of them based on the island index (what are you curently iterate over? class attribute? name? ) do you have some simple hip showing your issue? 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.