Go to: Synopsis. Return value. Related. Flags. Python examples.

Synopsis

vnnNode( [dg container] [/node name] , [addMetaData=[string, string]], [clearMetaData=string], [connected=boolean], [connectedTo=string], [createInputPort=[string, string]], [createOutputPort=[string, string]], [deletePort=string], [inputPort=boolean], [listConnectedNodes=boolean], [listPortChildren=string], [listPorts=boolean], [outputPort=boolean], [portFlags=uint], [portOptions=string[]], [portValues=string], [queryAcceptablePortDataTypes=string], [queryIsUnresolved=boolean], [queryMetaData=string], [queryMetaDataAsString=boolean], [queryMetaDatas=boolean], [queryPortDataType=string], [queryPortDefaultValues=string], [queryPortMetaDataValue=[string, string]], [queryTypeName=boolean], [removeMetaData=[string, string]], [resetPortDefaultValues=string], [setMetaData=[string, string[]]], [setMetaDataFromString=string], [setPortDataType=[string, string]], [setPortDefaultValues=[string, string[]]], [setPortMetaDataValue=[string, string, string]], [setStateFlag=[string, boolean]])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

vnnNode is undoable, NOT queryable, and NOT editable.

The vnnNode command 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.

Return value

stringThe result of the operation

Related

vnn, vnnCompound, vnnConnect

Flags

addMetaData, clearMetaData, connected, connectedTo, createInputPort, createOutputPort, deletePort, inputPort, listConnectedNodes, listPortChildren, listPorts, outputPort, portFlags, portOptions, portValues, queryAcceptablePortDataTypes, queryIsUnresolved, queryMetaData, queryMetaDataAsString, queryMetaDatas, queryPortDataType, queryPortDefaultValues, queryPortMetaDataValue, queryTypeName, removeMetaData, resetPortDefaultValues, setMetaData, setMetaDataFromString, setPortDataType, setPortDefaultValues, setPortMetaDataValue, setStateFlag
Long name (short name) Argument types Properties
addMetaData(amd) [string, string] create
Add a value to a metatada. The arguments are, in order, metadata name, metadata value to be added.
clearMetaData(cmd) string create
Remove all the values of a metatada. The argument is the metadata name.
connected(c) boolean create
Used with "listPorts" to query the connected or unconnected ports.
connectedTo(ct) string createmultiuse
Used with "listConnectedNodes" to query the nodes that are connected to the specified ports.
createInputPort(cip) [string, string] create
Add a new port to a node that can support any number of input ports.
createOutputPort(cop) [string, string] create
Add a new port to a node that can support any number of output ports.
deletePort(dp) string create
Remove a port from a node that can support any number of input/output ports.
inputPort(ip) boolean create
Used with "listPorts" to query all internal ports which connect to any input ports in the compound.
listConnectedNodes(lcn) boolean create
Used to list nodes which are connected to the specified node. The returned result is a list of node names.
listPortChildren(lpc) string create
List the children of specified port.
listPorts(lp) boolean create
List ports on the specified node. Can be used with flags "inputPort", "outputPort" and "connected" to narrow the query.
outputPort(op) boolean create
Used with "listPorts" to query all nodes which connect to any output ports in the compound.
portFlags(cpf) uint create
Used with "createInputPort" or "createOutputPort" to specify the flags on the port. See vnnPort command.
portOptions(cpo) string[] create
Used with "createInputPort" or "createOutputPort" to specify a list of options on the created port.
portValues(cpv) string create
Used with "createInputPort" or "createOutputPort" to specify the default value of a new port
queryAcceptablePortDataTypes(qat) string create
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) boolean create
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) string create
Query the value(s) of a metadata.
queryMetaDataAsString(mas) boolean create
Gets all metadata as a string. The format is documented with the setMetaDataFromString flag
queryMetaDatas(qms) boolean create
Query all the available metadatas.
queryPortDataType(qpt) string create
Query the data type of a specified port. This is normally used with the vnnNode command, even when the node is a compounds. When used with the vnnCompound command, the ports modified are the internal ones.
queryPortDefaultValues(qpv) string create
Get the default value of a port when it is not connected. For ports with scalar data types (e.g., float or string), this will return a single string value. For ports with structure data types (e.g., a vector or matrix of floats like float3 or float3x3), this will return an array of string values. This command is typically used with the vnnNode command, even when the node is a compound. When used with the vnnCompound command, it applies to the internal ports.
queryPortMetaDataValue(qpm) [string, string] create
Query the metadata value of a specified port. The first argument is the port to query, the second is the type of metadata to query. This is normally used with the vnnNode command, even when the node is a compounds. When used with the vnnCompound command, the ports modified are the internal ones.
queryTypeName(qtn) boolean create
Used to query the fundamental type of a node such as "runtimeName,libraryName,typeName"
removeMetaData(rmd) [string, string] create
Remove a value from a metatada. The arguments are, in order, metadata name, metadata value to be removed.
resetPortDefaultValues(rpv) string create
Not currently implemented by Bifrost. Resets the default value(s) of a compound port The port cannot be connected. The argument is the port name. This is normally used with the vnnNode command, even when the node is a compounds. When used with the vnnCompound command, the ports modified are the internal ones.
setMetaData(smd) [string, string[]] create
Set the value of a metatada. The arguments are, in order, metadata name, metadata values to be set.
setMetaDataFromString(mfs) string create
Set metadata using a string. This allows creating hierarchies of metadata. The values of keys that already exist will be replaced with the new values. The format is key=values separated by semi-colons, and braces to define a sub-list of key/value pairs. Quotes are optional, but strings using spaces or separators must be quoted. Quotes and backslashes can be escaped with a backslash. Python-style single quotes are not accepted. Example of format: "house=red;car="blue and green" "house=red,blue,yellow;hat={color=yellow;height="high"};cake={flavor="choco";topping="plenty"}
setPortDataType(spt) [string, string] create
Set the data type of a specified compound port. This is normally used with the vnnNode command, even when the node is a compounds. When used with the vnnCompound command, the ports modified are the internal ones.
setPortDefaultValues(spv) [string, string[]] create
Set the value of a port when it is not connected. The arguments are the port name and the corresponding value(s). The value argument is an array of strings that must contain the correct number of elements based on the data type of the port (e.g., three elements for a float3 data type). For scalar data types (e.g., float or string), a single string value can be used. This command is typically used with the vnnNode command, even when the node is a compound. When used with the vnnCompound command, the ports that are modified are the internal ones.
setPortMetaDataValue(spm) [string, string, string] create
Set the metadata value of a specified compound port. The arguments are, in order, port name, metadata name, metadata value to be set. This is normally used with the vnnNode command, even when the node is a compounds. When used with the vnnCompound command, it refers to the internal ports.
setStateFlag(ssf) [string, boolean] create
Set whether or not the node state flag with the specified mnemonic is active.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

import maya.mel as mel

cmds.file(f=1, new=1)
mel.eval("createNewBifrostGraphCmd()")
cmds.vnnCompound("bifrostGraphShape1", "/", addNode="BifrostGraph,Core::String,string_to_array")

print("All ports :")
print(cmds.vnnNode("bifrostGraphShape1", "/string_to_array/string_strip_whitespace", listPorts=1))


print("Connected ports :")
print(cmds.vnnNode("bifrostGraphShape1", "/string_to_array/string_strip_whitespace", listPorts=1, connected=True))


print("Unconnected ports :")
print(cmds.vnnNode("bifrostGraphShape1", "/string_to_array/string_strip_whitespace", listPorts=1, connected=False))


print("Connected input and output ports :")
print(cmds.vnnNode("bifrostGraphShape1", "/string_to_array/string_strip_whitespace", listPorts=1, connected=True, inputPort=1))
print(cmds.vnnNode("bifrostGraphShape1", "/string_to_array/string_strip_whitespace", listPorts=1, connected=True, outputPort=1))


print("All connected nodes :")
print(cmds.vnnNode("bifrostGraphShape1", "/string_to_array/string_strip_whitespace", listConnectedNodes=1))


print("Nodes connected to the stripped port :")
print(cmds.vnnNode("bifrostGraphShape1", "/string_to_array/string_strip_whitespace", listConnectedNodes=1, connectedTo="stripped"))


print("Separator is :'" + cmds.vnnNode("bifrostGraphShape1", "/string_to_array/split_string", queryPortDefaultValues="separator") + "'")
# Result: ','  // 


# query port type
print("Port Type is " + cmds.vnnNode("bifrostGraphShape1", "/string_to_array/split_string", queryPortDataType="separator"))
# Result: string  // 


# query node type
cmds.vnnCompound("bifrostGraphShape1", "/", addNode="BifrostGraph,Core::Math,euler_to_quaternion")
print("Node Type is " + cmds.vnnNode("bifrostGraphShape1", "/euler_to_quaternion/if4", queryTypeName=1))
# Result: BifrostGraph,Core::Logic,if  // 


# create port and connect
cmds.vnnCompound("bifrostGraphShape1", "/", addNode="BifrostGraph,Core::Math,add")
cmds.vnnCompound("bifrostGraphShape1", "/", addNode="BifrostGraph,Core::Math,subtract")
cmds.vnnNode("bifrostGraphShape1", "/subtract", createInputPort=["input", "auto"])
cmds.vnnConnect("bifrostGraphShape1", "/add.output", "/subtract.input")

# port meta-data
cmds.file(f=1, new=1)
mel.eval("createNewBifrostGraphCmd()")
cmds.vnnCompound("bifrostGraphShape1", "/", addNode="BifrostGraph,File::Geometry,read_Alembic")
cmds.vnnNode("bifrostGraphShape1", "/read_Alembic", setPortMetaDataValue=["filename", "UIWidget", "FileBrowserWidget"])
print("UIWidget is : " + cmds.vnnNode("bifrostGraphShape1", "/read_Alembic", queryPortMetaDataValue=["filename", "UIWidget"]) + "")

# create a value node of type array<float3> and set its value and size
cmds.vnnCompound("bifrostGraphShape1", "/", addNode="BifrostGraph,Core::Constants,array<Math::float3>")
cmds.vnnNode("bifrostGraphShape1", "/value", setPortDefaultValues=["value", "{10, 20, 30}'"])
cmds.vnnNode("bifrostGraphShape1", "/value", setMetaData=["valuenode_size", "3"])
# the array will be assigned 3 float3 elements, each of values (10, 20, 30)
# alternatively
cmds.vnnNode("bifrostGraphShape1", "/value", setPortDefaultValues=["value", "{'{10, 20, 30, 40, 50, 60}'}'"])
# or
cmds.vnnNode("bifrostGraphShape1", "/value", setPortDefaultValues=["value", "{10, 20, 30, 40, 50, 60}'"])
# the array will be assigned 2 float3 elements, (10, 20, 30) and (40, 50, 60)

# create a value node of type array<array<float3>> and set its values
cmds.vnnCompound("bifrostGraphShape1", "/", addNode="BifrostGraph,Core::Constants,array<array<Math::float3>>")
cmds.vnnNode("bifrostGraphShape1", "/value", setPortDefaultValues=["value", "{'{'{1, 2, 3, 4, 5, 6}', '{7, 8, 9, 0, 1, 2, 3, 4, 5}', '{6, 7, 8}'}'}'"])
# value contains 3 elements :
#  #0 : array<float3> with 2 elements (1, 2, 3) and (4, 5, 6)
#  #1 : array<float3> with 3 elements (7, 8, 9), (0, 1, 2) and (3, 4, 5)
#  #2 : array<float3> with a single element (6, 7, 8)

# create a value node of user-structured type and set its values
# struct User::MyStruct {
#    float          force
#    float3         direction
#    array<int>     indices
#    array<float3>  points
#    string         name
#}
# this example assumes that the "User::MyStruct" type was declared by the user in a Bifrost json file
cmds.vnnCompound("bifrostGraphShape1", "/", addNode="BifrostGraph,Core::Constants,User::MyStruct")
cmds.vnnNode("bifrostGraphShape1", "/value", setPortDefaultValues=["value", "{5.2, 1.2, -0.3, 4.5, '{0, 1, 2, 0, 2, 1}', '{1, 2, 3, 4, 5, 6, 7, 8, 9}', myString}'"])
# value.force     = 5.2
# value.direction = 1.2, -0.3, 4.5
# value.indices   = {0, 1, 2, 0, 2, 1}
# value.points    = {1, 2, 3, 4, 5, 6, 7, 8, 9}
# value.name      = 'myString'