Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dineyin

Pages: [1]
1
Colin,
Thank you very much for your response, I've finally had some time to get back to this. the challenge I have is that I don't always know what kind of node is going to be connected to the Base Color output node of the substance. In the example I posted it's a "baseMaterial", but I'm doing this as a batch process on a bunch of substances, and I have no guarantees of the type of the node connected. It could looks like this:



But it could also look something like this:



and I need to be able to programmatically inject some nodes in between those two.

The answer you gave me at least pointed me in a direction to try out a few other things, so I'm posting the solution I came up with for anyone who might run into a similar problem:

"rightNode" is the node who's input I need to modify, in the pictures above it's the "Base Color" output node of the substance:

Code: [Select]
# First get the left node
leftNode =aGraph.getNode(rightNode.getConnectedNodesUID()[0])

# Get an ordered list of all the UIDs for the output pins of the leftNode
listOfOutputIDs = []
for eachPin in leftNode.mCompOutputs :
    listOfOutputIDs.append(eachPin.mUID)

# Get the UID of the connection to the right node
UIDConnectedToRightNode = rightNode.getConnections()[0].mConnRefOutput

# Get index of the matching UID on the leftNode from the ordered list we built
indexOfLeftOutputPin = listOfOutputIDs.index(UIDConnectedToRightNode )

# Get the identifier for the output pin of the leftnode so we can connect to it
leftPinIdentifier = leftNode.getDefinition().getAllOutputs()[indexOfLeftOutputPin ].mIdentifier

# Actually do the connections to inject newNode in between leftNode and rightNode
aGraph.connectNodes(aLeftNode = leftNode, aRightNode = newNode, aLeftNodeOutput = leftPinIdentifier)
aGraph.connectNodes(aLeftNode = newNode, aRightNode = rightNode)


This works for me now, but currently it assumes the rightNode only has one input connection. If the rightNode had multiple input connections, this could get a lot more annoying. If there's a cleaner way to achieve the same result I'd love to hear about it. Thanks!


2
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?

3
I don't know if this is a feature request or if I'm just missing something, but is there a way to assign custom thumbnails for materials? For our project we have a bunch of materials that are being created internally, and we want some way to visually differentiate them from materials that someone might have just downloaded from the internet.

I would love to be able to put a little icon on the thumbnail for "Approved" materials for people to use on our project.

I know it is possible to insert custom thumbnails in Substance Designer, but even if I publish with the material with the "enable Icon" option, the thumbnail doesn't show up in substance Painter?


Pages: [1]