Jump to content

Problem accessing attributes inside For Each Loop


Recommended Posts

uhm... Im trying to avoid using copy stamp as suggested in H16 and use a For Each loop instead... but I cant seem to make sense out of it! (I watched a few videos and checked the help - but they seem pretty useless / over-complicated).

I simply want to copy some geometry (eg. circles) onto some points (eg. on a line) + each point has an attribute --> I scale each geometry based on the point attribute. Seems like a perfect iterative loop over points task!

When I put my copy to point(s) node inside the for each loop everything works fine (the copy node only receives one point which is fed iteratively from the the for loop).

HOWEVER when I apply the transform node and I use vex (@attribute_name) to try to access the attribute value associated to that point to scale my geometry it doesnt work (I get 0).

If I try to access the same attribute using a wrangle node it works.

Maybe Im doing something silly wrong with the transform node... but what I do seems intuitively right (type the vex attrib name in the scale 

 

Thanks!

Screenshot 2017-05-31 12.23.00.png

Link to comment
Share on other sites

Hello. I assume you are just experimenting, but you do not need copy stamp or for each node for this task. If the points on the line have a pscale attribute on them, the copy to points node will automatically use that to determine the scale of the copy. 

As for the transform node not picking up geometry attributes, I've also had this problem. I'm not sure what the rule is as to when I can just reference attributes in channels and when I can't.

When it doesn't work, you can always use a point expression to acess the attribute. I.e

point("../foreach_begin1", 0, "scaler", 0)

That will pull the point attribute scale off of point number 0 from the node foreach_begin1. 

I hope to see the regular @ notation working across all nodes soon!

Link to comment
Share on other sites

For things like the Transform SOP - how would it know which value it should use? You could potentially transform some geometry with thousands of points, with each point having a unique attribute value. Simply using @myattribute should return exactly what, then?

So yes, it won't work with point/primitive attributes - you'd have to use Point SOPs or Primitive SOPs in that case since those work on those individual levels. The Transform SOP works on the detail of the geometry - so what happens if we promote our attribute to detail then? Spoiler, it works just fine using @myattribute in the transform sop when the attribute is a detail attribute.

  • Like 2
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...