Author Topic: Connecting specific output pin from PBR base material node  (Read 184 times)

I'm trying to insert a compnode into an existing SBS between a PBR base material node and an output node (in this case a base color output node), but I'm having a really hard time figuring out the exact syntax to connect a node to the "Base Color" output pin on the PBR base material node. I can see from the docs that I need to set the "aLeftNodeOutput" parameter on the "ConnectNodes" function, but I can't figure out exactly what to put there.

Code: [Select]
aGraph.connectNodes(aLeftNode = PBRNode, aRightNode = myNewInsertedNode, aLeftNodeOutput = ??? )



the docs say that I should be using the "Identifier of the output of the left node", but I'm not sure how to get that. I've tried going through the list of "mCompOutputs" of the PBR node, but uisng the mUID values of those outputs didn't work

anyone have any luck trying to do this?

Hello,

Yes, get the correct identifier of output can be cumbersome.
 
Here the various solutions:
- you did the graph (or instance node) so you know the correct identifier name (but here it's not the case =]).

- you can do right-click on the instance node (Base Material) > Open reference > and find the output you want and get the identifier value (the first attributes).

- you can use PySBS to get a list of output identifiers, several way can be use to do that but I think the simplest is:
Code: [Select]
your_node.getDefinition().getAllParameterIdentifiers()
- you can try to "guess" the correct syntax from the label name, We try as much as possible for future substance nodes to keep always the same syntax for identifiers: lowercase without spaces or special chars (ambientocclusion).
But for old ones, usually (for substance nodes) identifier is lower and spaces replaced by nothing or with underscores or camelCase. So for Base Color > basecolor, Specular > specular, Ambient Occlusion > ambientOcclusion.

Hope this can help you.

Cheers.


Colin.
Last Edit: April 09, 2021, 09:39:14 am