Jump to content

Attribute value of the current prim in a for loop


Recommended Posts

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 by AntoineSfx
Link to comment
Share on other sites

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 by iFight4theUser
  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

5b3556e28f777_Screenshotat2018-06-2817-42-44.thumb.png.e37ec24f2311ce492132861149fc7015.png

I'm trying to get the attribute value in the float field of an operator (say, transform).

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...