JeremyR
Moderator
Registered:1278836466 Posts: 1,050
Posted 1498262662
Reply with quote
#1
I want to lay out some instances row by row so object one occupies vert IDs 1-20, 41-60, 81-100 etc and object 2 occupies the other verts in between. The obvious logic would be to use else if statements but if there are hundreds of rows this could take some time to write. Is there a better way to do this?

pshipkov
SOuP Jedi
Registered:1288636266 Posts: 4,711
Posted 1498285797
Reply with quote
#2
If the point order fallows some pattern then we should be able to come up with math formula that produces the desired results. Otherwise we can try to transfer attributes from ordered geometry onto the "messy" one before doing the math formula thing.

JeremyR
Moderator
Registered:1278836466 Posts: 1,050
Posted 1498289371
· Edited
Reply with quote
#3
The point order follows a pattern - default polyplane. Attribute transfer is something I haven't done before, though I dont need that right now.

ZC
Cooking networks
Registered:1485440021 Posts: 142
Posted 1498353497
Reply with quote
#4
for ($i=1;$i<21;$i++){ for($n=0;$n<100;$n++){

if(id == $i+40*n) return 1;

}

} You need to loop, I do not know it is wrong, hope can give you inspiration

JeremyR
Moderator
Registered:1278836466 Posts: 1,050
Posted 1498446746
Reply with quote
#5
Thanks! Ill try it out and get back to you.

rolfcoppter
Wanting the recipes
Registered:1445961602 Posts: 63
Posted 1500961353
Reply with quote
#6
Hey, I also have a different way of doing this using a mod function in mel. I ran into this problem a while ago and I found this way a bit easier to understand and use. The mod function (%) basically just counts up on the vert ids from 0 then when it hits vert ID 40 it goes back to 0. Mathematically it just returns the remainder of the division of two numbers. If $ID is 1 then it's 1/40 = 0 with a remainder of 1 so it returns 1, and if the $ID is 41 then it also returns 1 because 41/40 = 1 with a remainder of 1. float $modID = $ID % 40; if ($modID <=19){ $instanceID = 0; } else{ $instanceID = 1; } I normally use this in the Point Node and then pipe the out WeightPP into the copier node index array. But there are many ways to do it as there is with anything. hope this helped and sorry for the late reply to this old thread. thanks, Jordan