Attribute Wrangle Check if input is connected?

   1240   1   1
User Avatar
Member
2 posts
Joined: 12月 2022
Offline
Hi! I'm trying to write an attribute wrangle that changes its behaviour slightly based on whether an input is connected to the second pin or not. The wrangle node is in an HDA, and the second pin can be optional, with a default value specified.

A little context for what I'm trying to do. I wrote an HDA that allows me to specify a curve as the first input, and a separate piece of geometry as the second input. The operation will return a region of the curve centered on the closest point to the midpoint of that second input geometry (it's essentially used as a gizmo to select a point on my curve). If the second input is not specified though, I want my selected region to just be centered around the midpoint of the curve (essentially just returning a region from the center of the curve). Is this possible?
User Avatar
Member
8822 posts
Joined: 7月 2007
Offline
yes, inside your HDA you can use Switch If SOP and connect to it Curve and your second input geo
set parameters to:
Test Input: Second Input
Test Type: Input Wired

and after the Switch If do Extract Centroid to extract your point
and plug it into second input of your Wrangle (or plug it in directly and use getbbox_center() if you are ok with just bbox center )

that way your wrangle 2nd input will receive center point of the geo if HDA's 2nd input is connected or center point of the curve if not
Edited by tamte - 2022年12月30日 23:51:37
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links