How do I return the connected port from the input port?
-
Hi ~
I want to get which port the node's input port connects to. and I try to use gvport.getdestination () in the Python SDK, but I find that the port has to be the output port to return properly, and if the port is the input port, it returns an empty list.
Does anyone know how to return the connected port from the input port?Cheers~
-
Hello,
In C++ you would use GetIncomingSource but it's not implemented in python.
So the only way is to check for each node in the same Xgroup if any of it's outgoing port is linked to your node.
really not the best thing but that's the only workaround.
Cheers,
Manuel. -
All right. Thanks for your reply.
Cheers~ -
Hello,
without feedback, i'll consider this thread as solved.
Cheers,
Manuel -
Is this still a limitation or is there now a better workfaround for this?
-
-
Hi I just implemented GetIncomingSource and GetIncomingDestination, they will be available in the next update of Cinema 4D.
Cheers,
Maxime. -
Hi @bentraje,
For a temp solution. it maybe stupid but can worked right now, it works with renderEngine libs, but you can easily custom with maxon and c4d api.It also has some similar cousin:
- GetConnectedPortsAfter
- GetConnectedPortsBefore
- GetPreNodePorts
- GetNextNodePorts
- GetAllConnectedPorts
Hope it can helps.
Cheers~
DunHou.Codes:
import c4d from renderEngine import node_helper as nodeHelper def main() -> None: material = doc.GetActiveMaterial() helper = nodeHelper.NodeGraghHelper(material) act_node: maxon.GraphNode = helper.GetActiveNodes() if act_node: for port in helper.GetConnectedPortsAfter(act_node): print(port) if __name__ == '__main__': main()
The Material and select the Standard BRDF
Return
standardmaterial@TUGeQqzyIx5ijJlA7el82W>com.redshift3d.redshift4c4d.nodes.core.standardmaterial.outcolor output@P0Ey0yEAFJror7c4Oew95V<com.redshift3d.redshift4c4d.node.output.surface
-
Hi @Dunhou in thsi case we are speaking about xpresso and not the new node, which already have this features with maxon.GraphModelHelper.GetDirectPredecessors.
But thanks a lot, this indeed looks useful !
Cheers,
Maxime. -