modulus for every other prim though iteration ?

   1164   1   1
User Avatar
Member
761 posts
Joined: April 2014
Online
I want to only change the value of a variable for every other primitive but I don't have the modulus correct ?
What I've hit dead on is, if iterating using strictly the forEach sop, how do I tell the iteration metadata to only affect every other primitive ?

int chngePrim = detail(0,"iteration",0);
if(chngePrim%2==?){
    Desired_Vert_A=3;
    }
【T】【C】【S】
User Avatar
Member
359 posts
Joined: April 2017
Offline
You'd check if the iteration number is divisible by 2, so if(chngePrim%2==0). Also, chances are your metadata import node is going to be connected to a different input of your Wrangle other than input 0, so you may need to change the first argument of your detail() function to match.

That said, it'd probably be much more straightforward to group every other primitive using the standard group tools, then run your for-each over that group only by splitting or blasting out the prims you don't want beforehand.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
  • Quick Links