AntoineSfx Posted June 28, 2018 Share Posted June 28, 2018 (edited) What is the syntax to read an attribute on the current prim from inside a for-each-primitive loop ? I'm not sure what the foor loop context allows me to do in terms of closure and stuffs.. Just to be clear, I'm talking about this kind of loop: http://www.sidefx.com/docs/houdini16.5/model/looping.html Block begin / Block end Edited June 28, 2018 by AntoineSfx Quote Link to comment Share on other sites More sharing options...
iFight4theUser Posted June 28, 2018 Share Posted June 28, 2018 (edited) If you are iterating per primitive, then a simple prim(0,"[your attribute]",@primnum) or prim(0,"[your attribute]",0) should work. The @primnum doesn't need to be specified since there should only be 1 inside the for each loop anyway. Does this answer your question? Edited June 28, 2018 by iFight4theUser 1 Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted June 28, 2018 Author Share Posted June 28, 2018 7 minutes ago, iFight4theUser said: If you are iterating per primitive, then a simple prim(0,"[your attribute]",@primnum) or prim(0,"[your attribute]",0) should work. The @primnum doesn't need to be specified since there should only be 1 inside the for each loop anyway. Does this answer your question? No it does not. The context is a Block Begin / Block End loop, the one in Utility / For-Each primitive Quote Link to comment Share on other sites More sharing options...
iFight4theUser Posted June 28, 2018 Share Posted June 28, 2018 (edited) I've tried a test. Let me know if I still do not understand the context. Both trees yield the same result. Just depends on if the wrangle is set to primitives or points. Edited June 28, 2018 by iFight4theUser Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted June 28, 2018 Author Share Posted June 28, 2018 5 minutes ago, iFight4theUser said: I've tried a test. Let me know if I still do not understand the context. Both trees yield the same result. Just depends on if the wrangle is set to primitives or points. I'm trying to get the attribute value in the float field of an operator (say, transform). Quote Link to comment Share on other sites More sharing options...
iFight4theUser Posted June 28, 2018 Share Posted June 28, 2018 Maybe the problem is that you need to grab the opinput()? It will trigger an infinite recursion otherwise. Although, it does that outside of a for each loop as well. 1 1 Quote Link to comment Share on other sites More sharing options...
PixelNinja Posted June 28, 2018 Share Posted June 28, 2018 Since it's a foreach primitive there should only be one prim, so I would just use: prim(0, "attribute", 0) 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.