How to input an attribute in an HDA parameter?

   595   5   1
User Avatar
Member
141 posts
Joined: June 2013
Online
Scene file attached with a example case(Normal Displacement)where the problem is presented in 3 columns:
left: Just HDA with single input value driving all points.
center: Attempt to use a random value attribute @foo to drive each point. Failing.
right: HDA exploded with @foo driving each point. Working as intended.

I inputing @foo and `point(0, “foo”, @ptnum)` in the HDA parameter but it didn't work.

So what's the best way to set up HDA parameters to also be driven by a per point attribute?

Thanks



should look like this with the random value point attribute.

Edited by probiner - Dec. 28, 2017 19:56:05

Attachments:
AttribDriveParameter.hiplc (86.2 KB)

User Avatar
Member
2532 posts
Joined: Sept. 2007
Online
I think parameters can do that only via HDK (but I'd love to be proven wrong!), but you can use a string parm to pass in an attribute name:

vector norm = point(1, "N", @ptnum) ;
@P += norm * point(0, chs("myattr"), @ptnum);

This would let you specify an incoming point attribute to use; you could modify your HDA to allow the user to use a parameter value, an attribute, or even multiply them together.

Hope that helps!
I'm o.d.d.
User Avatar
Member
3169 posts
Joined: July 2007
Offline
just use Bindings tab on wrangle to bind your specified attrib to any VEX @ variable name
that way you don't need to use any code insertions

Attachments:
AttribDriveParameter_fix.hiplc (82.8 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
141 posts
Joined: June 2013
Online
Thanks for the hints guys. I wasn't aware about the Bindings!
But both solutions seem to require duplication of parameters (one for single values, one to be name the attribute) and my mindset about this is more like what we do in VOPs, where we set an exposed parameter which can then be overridden by wiring something to it, so at SOP level I was expecting to do the same with an expression instead.
Let me know if having 2 parameters per actual parameter is the only way to go about it. Thanks.

[streamable.com]
Edited by probiner - Jan. 8, 2018 06:45:00
User Avatar
Member
141 posts
Joined: June 2013
Online
Well then two/tree parameters per parameter it is then…

1 - Slider
2 - Attribute name
3 - How they are mixed

I wouldn't mind just a replacement like one connects something to a VOP nodes but with vex import functions…
Edited by probiner - Jan. 12, 2018 17:35:35
User Avatar
Member
141 posts
Joined: June 2013
Online
Ok, here's the how I went about it to avoid burdening the UI. In a wrangle inside the Asset I check if the attribute exists with the same name as the parameter in the UI, and if not I create it with the UI value:

float attrib = ch(“attrib”) ; // UI value variable from a spare input in the wrangle SOP.

if(! hasprimattrib(0, “hda_attrib”)) f@hda_attrib = attrib ; // If the attribute doesn't exist, it's created and the UI value assigned to it.

or if I just need the variable:

float attrib = ch(“attrib”) ;

if( hasprimattrib(0, “hda_attrib”)) attrib = prim(0, “hda_attrib”, @primnum ) ;


Might not be very pretty to create/rename/copy attributes before the HDA, but since they share the UI parameter name it's straight forward enough, while allowing neat extra control.

Cheers
Edited by probiner - Jan. 22, 2018 13:48:26
  • Quick Links