Passing parameter inside a loop

   1961   4   1
User Avatar
Member
46 posts
Joined: Oct. 2019
Offline
Hi,
How can you pass parameter inside a loop? For some reason the parameter exists inside the loop but doesn't affect the geometry.
thx

Attachments:
capture 01.JPG (141.0 KB)
capture 02.JPG (140.5 KB)
ForLoopParam.hiplc (121.6 KB)

User Avatar
Member
46 posts
Joined: Oct. 2019
Offline
anyone?
User Avatar
Member
7762 posts
Joined: Sept. 2011
Offline
You can't do that with a transform sop. Referencing a local variable/attribute in that way would mean that the node evaluates differently per element, which the transform sop does not.

To apply a different transform per point use a point wrangle/vop/expression node. To vary it per primitive use a primitive sop. Alternatively, use one of those nodes, or other nodes to create a transform attribute, (one of matrix, matrix3, quaternion, vector,) and use the transform by attribute sop to apply a varying transformation across multiple points.

For global (detail) attributes, use the detail() expression in the parameter of the transform sop.
User Avatar
Member
46 posts
Joined: Oct. 2019
Offline
ok thanks for the clarification!
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
If you want to use the Transform SOP as is, and you have no desire to make this into a compile block, the easier thing is to just replace the trivial @PR with:

prim("../transform2", 0, "PR", 0)
or
prim(opinputpath("."), 0, "PR", 0)
for tagging the input SOP generically.

The prim() expression is an old school method to fetch an attribute based on a specific index. Since all the prims have the same value inside the subnet you can use 0 or the first primitive value.

To make it compile safe, use an attrib wrangle as jsmack indicated above.
Edited by old_school - Nov. 23, 2020 13:29:55
There's at least one school like the old school!
  • Quick Links