Attribute Wrangle in LOPs

   455   4   1
User Avatar
Member
13 posts
Joined: March 2022
Offline
Hey, I'm exploring using Attribute Wrangle in LOPs. My goal is to implement different logic based on the input Light Type. I'm using this VEX code to determine the light type:
string type = usd_attrib("opinput:0", @primpath, "light:shaderId");
s@type = type;

Now, I'm wondering how to access this attribute in the Select Input Parameter of a Switch node. In Attribute Wrangle for LOPs, there isn't a "Run Over" option, so I'm unsure how to retrieve the @type attribute from the Attribute Wrangle node in another node.
User Avatar
Member
209 posts
Joined: Jan. 2013
Offline
You can use Pattern Matching for Switch LOP, and it already allows usd_* expressions.
User Avatar
Member
13 posts
Joined: March 2022
Offline
@alexwheezy, thanks for your response. Unfortunately, it appears that the solution isn't working for me; it seems like I might be making a mistake somewhere. In the documentation provided [www.sidefx.com], there's this statement:

You can encapsulate VEX code within curly braces { } that evaluates to 1 for a match or 0 for no match. In this example, @primpath matches the path of the current primitive being considered. You can also use @<attr_name> to access attribute values on the current primitive.

I've tried utilizing it within the Switch LOP node, but it doesn't seem to be evaluating as expected.
`{usd_attrib("opinput:0", @primpath, "light:shaderId")}`
Edited by timurproko - May 3, 2024 12:30:13

Attachments:
2024-05-03_19-26-25.PNG (62.6 KB)

User Avatar
Member
17 posts
Joined: March 2019
Offline
Hi

Switch node doesn't work with Primitive Pattern Expressions it doesn't read prims from the stage.
It is meant for Context Options and matching names of input nodes using those patterns: https://www.sidefx.com/docs/houdini/network/patterns.html [www.sidefx.com]

Cheers!

Attachments:
Switch_pattern_matching_inputNameJPG.JPG (64.4 KB)
Switch_pattern_matching_CO.JPG (94.9 KB)

User Avatar
Member
13 posts
Joined: March 2022
Offline
@daveborck thanks for your reply, this does help.
  • Quick Links