How to use RemoveConnections?
-
Hi,
How do I use the
GraphNode.RemoveConnections
? It gives me an error of
TypeError: unable to convert builtins.property to @net.maxon.graph.wires
Here is the illustration code:
base_color_port = list(GraphModelHelper.GetDirectSuccessors(texture_node, maxon.NODE_KIND.INPORT, None))[0] # Results the Standard Material Base Color Port base_color_port.RemoveConnections(maxon.PORT_DIR.INPUT, maxon.Wires.dependency)
I get that there is some parameters/masking but shouldn't the default be just a vanilla
RemoveConnections
? Like you have the access to inport or output and just literally remove the existing connections? -
Hi,
each connection is composed by eight wires. You are juste removing the dependency wire. You must remove all.
It is rare that you need to only deal with one wire in a connection. One of the cases is when you want to mute or unmute a connection. You need to change the inhibit wire of the connection. Like in this example where we change the value of the wire maxon.Wires.INHIBIT .Just use the maxon.WIres.All() so all wires are removed.
port.RemoveConnections(maxon.PORT_DIR.OUTPUT, maxon.Wires.All())
Note that you also have this helper function GraphModelHelper.RemoveConnection(srcPort, dstPort) where the input connection of the destination port will be removed if the port is connected with the source port.
Cheers,
Manuel -
Gotcha. Thanks for the clarification. Works as expected.