pymel.core.general.vnnCompound¶
- vnnCompound(*args, **kwargs)¶
The vnnCompoundcommand is used to operate compound and its VNN graph. The first parameter is the full name of the DG node that contains the VNN graph. The second parameter is the name of the compound.
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. addNode / an unicode Add a node into the compound. addStatePorts / asp unicode, unicode, unicode Add new input and output ports, linked together. The arguments are, in order, the input port name, the output port name and the data type to assign to both ports. canResetToFactory / crf unicode Query if the specified compound can be reset to its initial status. clearMetaData / cmd unicode Remove all the values of a metatada. The argument is the metadata name. connected / cn bool Used with listNodesor listPortsto query the nodes or internal ports that have connections when the argument is true. If the arguments is false, return all nodes which have no connection. The other side of the connection could be another node or port. connectedTo / ct unicode Used with listNodesto query all nodes that connect to the specified ports. connectedToInput / cti bool Used with listNodesto query all nodes which connect to any input ports. connectedToOutput / cto bool Used with listNodesto query all nodes that connect to any output ports. create / c unicode Create a sub compound in the specified compound. The name of the created sub compound cannot be used before in the specified compound. createInputPort / cip unicode, unicode Create an input port in the compound. The first argument is the name of the port. The second argument is the data type of the port. createOutputPort / cop unicode, unicode Create an output port in the compound. The first argument is the name of the port. The second argument is the data type of the port. deletePort / dp unicode Delete a input or output port from the compound. explode / ec unicode Explode a specified compound and move the nodes from it to its parent. hidePort / hp unicode, bool Hide or display an input port of a compound inputPort / ip bool Used with listPortsto query all internal ports which connect to any input ports in the compound. listNodes / ln bool List all nodes in the compound. Can be used with other flags, such as dataType, connectedToInputto query some specified nodes. The returned result is a list of node names. listPortChildren / lpc unicode List the children of specified port. listPorts / lp bool List all internal ports in the compound, including input and output ports. Can be used with other flags, such as output, connectedto query some specified ports. moveNodeIn / mi unicode Move the specified node into the compound. movePort / mp unicode, int Move a port to the specified index in the compound nodeType / nt unicode Used with listNodesto query all nodes which are specified node type in the compound. outputPort / op bool Used with listPortsto query all nodes which connect to any output ports in the compound. portOptions / cpo unicode Used with createInputPortor createOutputPortto specify a list of options on the created port. publish / pub unicode, unicode, unicode, bool Used to publish the compound. The arguments are, in order, the file path where to save, the namespace where to store the compound, the name to use for the nodedef and whether or not the compound should be referenced upon publishing. queryIsImported / qii bool Query if the compound is imported. queryIsReferenced / qir bool Query if the compound is referenced. 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 specified 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. queryPortMetaDataValue / qpm unicode, unicode 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. removeMetaData / rmd unicode, unicode Remove a value from a metatada. The arguments are, in order, metadata name, metadata value to be removed. removeNode / rmn unicode Remove the specified node from the compound. renameNode / rn unicode, unicode Rename a node in the compound. The first argument is the old name of the node. The second argument is the new name. renamePort / rp unicode, unicode Rename a port of the compound. The first argument is the old name of the port. The second argument is the new name. resetToFactory / rtf unicode Reset the specified compound to its initial status. The specified compound must be able to be reset. saveAs / sa unicode Used to export Compound in the Compound menu of the Node Editor. The argument is the file path to save. setIsReferenced / sir bool Change the referenced status of the compound. If -sir/setIsReferencedis true, the compound will be made public, else the compound will be made private to its parent compound. 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 compound port. setPortDefaultValues / spv unicode, unicode Set the default value(s) to a specified 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. setPortMetaDataValue / spm unicode, unicode, unicode Set the metadata value of a specified compound port. The arguments are, in order, port name, metadata name, metadata value to be set. specializedTypeName / stn bool Used to query the specialized implementation class names such as Bifrost_DoWhile, or Compoundfor a normal compound Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.vnnCompound
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() # please open bifrost liquid container in node editor
# Create a sub-compound in the graph pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, create=”subCompound”)
# Explode a sub-compound pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, explode=”subCompound”)
# Create an output port in the compound pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, createOutputPort=[“newOutput”,”Bifrost::Types::ObjectDescriptor”])
# Create an input port in the compound pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, createInputPort=[“newInput”,”Bifrost::Types::ObjectDescriptor”])
# Rename a port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, renamePort=[“newOutput”,”outputValue”])
# Move a port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, movePort=[“newInput”, 0])
# Delete a port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, deletePort=”newInput”)
# set the type of a internal port of the compound pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, setPortDataType=[“outputValue”,”string”])
# query the data type of a specified port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, queryPortDataType=”outputValue”)
# set the default value of specified port for an integer data type pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, setPortDefaultValues=[“newInput”,”18”]) # set the default value of specified port for a float3 data type pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, setPortDefaultValues=[“newInput2”,[“1.5”, “1.2”, “1.3”]])
# query the default value of specified port for an integer data type pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, queryPortDefaultValues”newInput”) # [u‘18’] # query the default value of specified port for a float3 data type pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, queryPortDefaultValues”newInput2”) # [u‘1.5’, u‘1.2’, u‘1.3’]
# set the state value of specified port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, setPortMetaDataValue=[“portName”,”metaDataName”,”value”])
# query the current state value of specified port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, queryPortMetaDataValue=[“portName”,”metaDataName”])
# query the children of a specified port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listPortChildren=”portName”)
# Add a new node into VNN graph of the bifrost container pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, addNode=”Bifrost,Bifrost::Nodes::Math,add”)
# Rename a node pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, renameNode=[“add”,”plus”])
# Remove the node pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, removeNode=”plus”)
# Create two state ports of type float pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, addStatePorts=[“in_name”, “out_name”, “float”])
# Query the specialized type name pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, specializedTypeName=True)
# Query if the compound is referenced pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, queryIsReferenced=True)
# Query if the compound is imported pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, queryIsImported=True)
# Make the compound private pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, setIsReferenced=False)
# List all child nodes in the specified compound pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listNodes=True)
# List the nodes in the specified compound which are of a specific type pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listNodes=True, nodeType=”Math”)
# List all the nodes in the specified compound which have no connections pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listNodes=True, connected=False)
# List nodes in the specified compound which are connected to the parent’s internal input pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listNodes=True, connectedToInput=True)
# List nodes in the specified compound which are connected to the parent’s internal output pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listNodes=True, connectedToOutput=True)
# List nodes in the specified compound which are connected to both the parent’s internal input and output port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listNodes=True, connectedToInput=True, connectedToOutput=True)
# Query the name of the node that is connected to a specified port # It could be either an input port or an output port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listNodes=True, connectedTo=”Solid”) SetDescriptorFromObject1.value
# List the names of all compound’s internal ports pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listPorts=True)
# List the names of the compound’s internal input ports pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listPorts=True, inputPort=True)
# List the names of the compound’s internal output ports pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listPorts=True, outputPort=True)
# List all the compound’s internal unconnected input and output port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listPorts=True, connected=False)
# List all the compound’s internal connected input and output port pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, listPorts=True, connected=True)
# Query if the specified compound can be reset to factory pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, canResetToFactory=”CompoundName”)
# Reset the specified compound to factory pm.vnnCompound(“|bifrostLiquid1|bifrostLiquidContainer1”, “liquid”, resetToFactory=”CompoundName”)