Expression to check whether input contains a specific volume?

   2747   2   1
User Avatar
Member
29 posts
Joined: 10月 2015
Offline
Hi, is there an expression that tests whether a volume exists? hasprim sounds like it does that but it requires a group, and the third parameter is a prim index, and I'd like to check by name.

To give some context, I'm trying to determine whether the node wired into an input on my asset contains a volume, and use a switch to either pass that volume directly to a volume wrangle, or convert it to a volume and then pass that into the volume wrangle.

Attachments:
has_volume_switch.png (97.2 KB)
has_volume_switch.hiplc (33.7 KB)

User Avatar
Member
8619 posts
Joined: 7月 2007
Offline
you can for example use:
argc(listbyvals(opinputpath(".",0), D_PRIMITIVE, "name", "surface"))==0
that would switch if it doesn't find any primitive with name attribute “surface”, however would not ensure it is a volume primitive

you can as well in separate stream delete all nonvolume primitives and blast everything except your desired name, then just check if there is anything left in that geo from your switch
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
29 posts
Joined: 10月 2015
Offline
Thanks! Both worked nicely.
  • Quick Links