Limiting nodes within an material shader hda

   1220   1   0
User Avatar
9 posts
Joined: Dec. 2009
Is it possible to limit the nodes that can be added within a matnet context hda? Pixar has done it with their pxrmaterialbuilder hda. It will only show pxr nodes and user osl nodes. I'd like to replicate this behaviour in a custom templated hda.
User Avatar
1452 posts
Joined: July 2005
There are some mechanisms for filtering nodes inside a parent node. For VOPs, the standard way to achieve it is thru their "render mask" and "vopnet mask". Render mask roughly corresponds to the shader language (eg, RIS vs. VEX), while vopnet mask allows further filtering within the same language (eg, "surface" vs "displacement" vs "cvex" kind of shader networks).

The VOPs "render mask" is used in conjunction with settings in Edit > Preferences > Rendering, but I don't think that's what you are enquiring about, so won't pursue it here.

On the other hand, Pixar's "pxrmaterialbuilder" is implemented in C++ HDK, and most likely uses vopnet mask to filter the VOPs. In HDK, you can use `OP_OperatorFilter` class to filter VOPs. There is an example in `$HFS/toolkit/samples/VOP/VOP_CustomContext.C` that illustrates this. In your `allowOperatorAsChild()` you can do something like this

```VOP_OperatorInfo *info = dynamic_cast<VOP_OperatorInfo *>(op->getOpSpecificData());
return info->getVopnetMask() = "my_special_keyword";```
  • Quick Links