vex code to break a linked channel (relationship?)

   1441   2   1
User Avatar
Member
31 posts
Joined: June 2016
Offline
Hi,

I am looking for a way to break the linked channel on a (redshift) primitive (see screenshot).

It's clear to me how to modify the value of diffuse_color with vex, however the renderer will ignore this value and instead use the linked output. But I can't find a command for breaking/removing this (this parameter doesn't even have a name as it belongs to diffuse_color). The only one sounding somewhat fitting is "removerelationship" - but I'm not sure how to apply it here; the documentation unfortunately isn't very helpful there.

Thanks!

Attachments:
houAAC.png (27.3 KB)

User Avatar
Staff
4177 posts
Joined: Sept. 2007
Online
Although these look like relationships, they are actually inputs, a characteristic of UsdShade prims. Afaik there aren't yet any VEX bindings to handle UsdShade inputs yet. You could do something in a Python LOP in the meantime though:

from pxr import UsdShade

node = hou.pwd()
stage = node.editableStage()

shader_path = "/testgeometry_rubbertoy1/materials/ToyShader/ToyShader_preview_texture_diffuseColor"
shader = UsdShade.Shader(stage.GetPrimAtPath(shader_path))
shader.GetInput('st').DisconnectSource()

Alternatively, you may have luck with Edit Material LOP; I've had some luck with relatively straightforward, non-Karma materials. It's still getting worked on, though seems to be getting better and better over time.
I'm o.d.d.
User Avatar
Member
31 posts
Joined: June 2016
Offline
Hui, Christmas came early this year! Thanks so much!

I used a python node and it worked fine. An Edit Material LOP doesn't work for me because it needs to be automated - otherwise I would need to create one per shader when the user presses a button and that's not as nice as the dynamic workflow.

Cheers!
  • Quick Links