magneto Posted April 11, 2012 Share Posted April 11, 2012 I have Font SOPs copied via the Copy SOP. I know I can do this with stamping but after the Copy SOP, I want to use a Foreach SOP to iterate over each group created by the Copy SOP. Inside the foreach, how can I copy each group with a different color? Using the Color SOP with primitives, detail, points doesn't work. Is there a way to stamp the group name being iterated? Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted April 11, 2012 Share Posted April 11, 2012 I think the group name will be in one of the values of the Each SOP. Quote Link to comment Share on other sites More sharing options...
magneto Posted April 11, 2012 Author Share Posted April 11, 2012 Thanks Hopbin, I tried accessing it using: `chs("../each1/group")` but it didn't work. I get the same result, where each character is randomly colored, not each Font SOP instance. Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted April 11, 2012 Share Posted April 11, 2012 I got it to work, but I had to put a "*" in the Group Mask on the ForEach SOP. Don't know why, and I'm wondering if this has changed in H12? See attached, I output the group name to a prim attribute. Look in the details view. untitled1.hip 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted April 12, 2012 Author Share Posted April 12, 2012 Thanks Hopbin, I see what you mean. I tried copy*, it still worked though in H11. The problem is trying to generate different colors for the whole group but I think it requires storing the copy index too so you can randomize based on this. Color SOP still uses each primitive when you specify a group. Quote Link to comment Share on other sites More sharing options...
Annon Posted April 12, 2012 Share Posted April 12, 2012 Why aren't you just using copy stamping? If it's just to get used to using the forEachSOP then fair enough, but I would think it would be more economical to do this in the copySOP... Quote Link to comment Share on other sites More sharing options...
magneto Posted April 12, 2012 Author Share Posted April 12, 2012 Yeah this works with stamping. I just want to try this because I am wondering if I could access the whole group inside Foreach. Also would be useful if the geometry wasn't created with a Copy SOP, but had groups per object in the geometry. Quote Link to comment Share on other sites More sharing options...
Annon Posted April 12, 2012 Share Posted April 12, 2012 Ok well if you hadn't created the geo through a copy node (I have in the attached example, but ignore that fact), you can use a connectivitySOP to create an attribute per object, in this case "class" and then a partition sop to split the geo up into groups based on that attribute, in this case "box_*". From there you can either use the $CLASS variable to colour each node differently, or use the groups in a for each... Explanation of For Loop Expression: rand(opdigits(stamps("..", "FORVALUE","")) * 523) opdigits gets the number on the end of the string, so box_22 will return 22. stamps(...FORVALUE...) will get you the current stamp name. Hope this helps Christian colorByPartition.hip 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted April 12, 2012 Author Share Posted April 12, 2012 Thanks Christian, this method should also work with the basic foreach groups then. I was looking for something like opdigits, so great that it exists 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.