Access attribute from a node input

   2027   3   0
User Avatar
Member
141 posts
Joined: 3月 2016
オフライン
Hello -

I have a primative attribute that varies between primatives.
Now let's say I wanted to use this as the value in a subsiquent node's input.
So i can use:
prim('../createPrimAttrib', 0, 'myAttrib', 0)
to grab it for a specified prim number but how do I go from a hard coded prim number (second argument - currently = 0) to use whatever the prim num is? @primnum wont work in this situation.
Love Houdini
User Avatar
Member
2658 posts
Joined: 6月 2008
オフライン
If you're talking about hScript, not Vex (and the functions are nearly the same) then you have to loop over all the primitives and use the iteration of the loop as the @primnum value.
However, this may not work on all nodes because the node itself might be looping over the primitives internally.

Which node and parameter do you want to drive with your primitive attribute?
Edited by Enivob - 2021年6月8日 09:07:22
Using Houdini Indie 20.5
Windows 11 64GB Ryzen 16 core.
nVidia 3060RTX 12BG RAM.
User Avatar
Member
141 posts
Joined: 3月 2016
オフライン
Thanks yes hScript not the vex function.
Ah right! so would you do this using a foreach loop node? (not used them before so will have to investigate)

I was originally wanting to use it on the polyextrude node but ive just realised, on this node you can use the 'local attribute'
but actually im pretty sure this will be useful to know how to do for other nodes at some point too.
Love Houdini
User Avatar
Member
141 posts
Joined: 3月 2016
オフライン
prim('../createPointAttrib', detail('../foreach_begin1_metadata1/','iteration',0), 'myAttrib', 0)
Great! yes that worked using a foreach primitive loop
Thank you
Love Houdini
  • Quick Links