pymel.core.general.vnnNode¶
- vnnNode(*args, **kwargs)¶
The vnnNodecommand is used to operate vnnNode and query its port and connections. The first argument is the full name of the DG node that the VNN node is in. The second argument is the name of the full path of the VNN node.
Flags:
Long Name / Short Name Argument Types Properties addMetaData / amd unicode, unicode
Add a value to a metatada. The arguments are, in order, metadata name, metadata value to be added. clearMetaData / cmd unicode
Remove all the values of a metatada. The argument is the metadata name. connected / c bool
Used with listPortsto query the connected or unconnected ports. connectedTo / ct unicode
Used with listConnectedNodesto query the nodes that are connected to the specified ports. createInputPort / cip unicode, unicode
Add a new port to a node that can support any number of input ports. listConnectedNodes / lcn bool
Used to list nodes which are connected to the specified node. The returned result is a list of node names. listPortChildren / lpc unicode
List the children of specified port. listPorts / lp bool
List ports on the specified node. Can be used with connectedto determine if the returned ports have connections. queryAcceptablePortDataTypes / qat unicode
Get the list of acceptable types for the given port of an unresolved node. The acceptable types are based on the overloads that match the currently defined ports of the node. queryIsUnresolved / qiu bool
Query if the node is unresolved. A node is considered unresolved if it is part of an overload set, and has at least one port that is both unconnected and has an undefined type. queryMetaData / qmd unicode
Query the value(s) of a metadata. queryMetaDatas / qms bool
Query all the available metadatas. queryPortDataType / qpt unicode
Query the data type of a specified port. queryPortDefaultValues / qpv unicode
Query the default value(s) of a node port. For ports of scalar data type (ie. float or string), this will return a single string value, For ports of structure data type (ie. vector or matrix of floats - float3/float3x3), this will return an array of string values. queryTypeName / qtn bool
Used to query the fundamental type of a node such as runtimeName,libraryName,typeName removeInputPort / rip unicode
Remove a multi-in port from a node that can support any number of input ports. removeMetaData / rmd unicode, unicode
Remove a value from a metatada. The arguments are, in order, metadata name, metadata value to be removed. setMetaData / smd unicode, unicode
Set the value of a metatada. The arguments are, in order, metadata name, metadata values to be set. setPortDataType / spt unicode, unicode
Set the data type of a specified port. setPortDefaultValues / spv unicode, unicode
Set the default value(s) to a node port The port cannot be connected. The arguments are, in order, the port name and the value(s). The value argument is an array of string that must contain the proper number of element depending of the data type of the port (ie. 3 elements for a float3 data type). For scalar data types ((ie. float or string) a single string value can be used. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.vnnNode
Example:
- ::
import pymel.core as pm
# create a bifrost liquid node # to operate VNN graph of the bifrost container import maya.cmds as cmds pm.file(f=True, new=True) pm.polyPlane() pm.CreateBifrostLiquid()
# List all ports on the node pm.vnnNode(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid.postSimulationStep.if”, listPorts=True)
# List the ports on the node which has connections pm.vnnNode(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid.postSimulationStep.if”, listPorts=True, connected=True)
# List the ports on the node which has no connections pm.vnnNode(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid.postSimulationStep.if”, listPorts=True, connected=False)
# List all connected nodes pm.vnnNode(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid.postSimulationStep.if”, listConnectedNodes=True)
# List the connected nodes which are connected to the port “trueCase” pm.vnnNode(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid.postSimulationStep.if”, listConnectedNodes=True, connectedTo=”trueCase”)
# # Example of setting and querying the default value of a port #
# Init scene and VNN objects pm.bifrost(g=”vnnNodeCmdTest”) pm.vnnCompound(“|bifrostVnnNodeCmdTest1|bifrostVnnNodeCmdTestContainer1”, “vnnNodeCmdTest”, addNode=”Bifrost,Core,if”) pm.vnnCompound(“|bifrostVnnNodeCmdTest1|bifrostVnnNodeCmdTestContainer1”, “vnnNodeCmdTest”, addNode=”Bifrost,Bifrost::Nodes::Math,valueInt”)
# Set the port default value for an integer data type pm.vnnNode(“|bifrostVnnNodeCmdTest1|bifrostVnnNodeCmdTestContainer1”, “vnnNodeCmdTest.node”, setPortDefaultValues=[“in_int”, “233”]) # Set the port default values for a float3 data type pm.vnnNode(“|bifrostVnnNodeCmdTest1|bifrostVnnNodeCmdTestContainer1”, “vnnNodeCmdTest.node”, setPortDefaultValues=[“in_float3”, [“1.5”, “1.2”, “1.3”]])
# Get the port default value for an integer data type portValue = pm.vnnNode(“|bifrostVnnNodeCmdTest1|bifrostVnnNodeCmdTestContainer1”, “vnnNodeCmdTest.node”, queryPortDefaultValues=”in_int”) print portValue # [u‘233’] # Get the port default value for a float3 data type portValue = pm.vnnNode(“|bifrostVnnNodeCmdTest1|bifrostVnnNodeCmdTestContainer1”, “vnnNodeCmdTest.node”, queryPortDefaultValues=”in_float3”) print portValue # [u‘1.5’, u‘1.2’, u‘1.3’]
# query the data type of a specified port pm.vnnNode(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid.postSimulationStep.if”, queryPortDataType=”outputValue”)
# query the type name of a node pm.vnnNode(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid.postSimulationStep.if”, queryTypeName=”True”) # [u’Bifrost,Amino,If’]
# query the children of a specified port pm.vnnNode(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listPortChildren=”portName”)