mgear.rigbits.weightNode_io

import weightNode_io

# Find all the weight Nodes weightDrivers = pm.ls(type=”weightDriver”)

# any filePath testPath = r”C:Users afaelDocumentscorescripts estWeightNodes.json”

# Export listed weightDrivers weightNode_io.exportNodes(testPath, weightDrivers)

# import all weight drivers from filePath weightNode_io.importNodes(testPath)

mgear.rigbits.weightNode_io.CTL_SUFFIX

str – ctl suffix shared from rbf_io

mgear.rigbits.weightNode_io.DRIVEN_SUFFIX

str – suffix shared from rbf_io

mgear.rigbits.weightNode_io.ENVELOPE_ATTR

str – name of the attr that disables rbf node(non enum)

mgear.rigbits.weightNode_io.RBF_TYPE

str – core/plugin node type

mgear.rigbits.weightNode_io.WD_SUFFIX

str – name of the suffix for this rbf node type

mgear.rigbits.weightNode_io.WNODE_DRIVERPOSE_ATTRS

dict – attrs and their type for querying/setting

mgear.rigbits.weightNode_io.WNODE_SHAPE_ATTRS

list – of attrs to query for re-setting on create

mgear.rigbits.weightNode_io.WNODE_TRANSFORM_ATTRS

list – of transform attrs to record

__author__ = “Rafael Villar” __email__ = “rav@ravrigs.com

class mgear.rigbits.weightNode_io.RBFNode(name)

when subclassed everything that need be overrided is information specific to the module rbf node.

name

str – name of the node that either exists or to be created

rbfType

str – nodeType to create node of supported type

transformNode

str – name of transform node

addPose(poseInput, poseValue, posesIndex=None)

add pose to the weightDriver node provided. Also used for editing an existing pose, since you can specify the index. If non provided assume new

Parameters:
  • node (str) – weightedDriver
  • poseInput (list) – list of the poseInput values
  • poseValue (list) – of poseValue values
  • posesIndex (int, optional) – at desired index, if none assume
  • latest/new
copyPoses(nodeB)

Copy poses from nodeA to nodeB with the option to be blank or node for syncing nodes

Parameters:
  • nodeB (str) – name of weightedNode
  • emptyPoseValues (bool, optional) – should the copy just be the same
  • of poses but blank output value (number) –
Returns:

n/a

Return type:

n/a

create()

create an RBF node of type, defined by the subclassed module

Raises:NotImplementedError – Description
deletePose(indexToPop)

gather information on node, remove desired index and reapply

Parameters:
  • node (str) – weightDriver
  • indexToPop (int) – pose index to remove
forceEvaluation()

convenience function to force re evaluation on the rbf nodes most nodes support this

getDrivenNode()

get driven nodes connected to weightDriver

Returns:of driven nodes
Return type:list
getDrivenNodeAttributes()

get the connected attributes of the provided compound attr in order of index - Sanity check

Returns:of connected attrs in order
Return type:list
getDriverNode()

get nodes that are driving weightDriver node

Returns:of driver nodes
Return type:list
getDriverNodeAttributes()

get the connected attributes of the provided compound attr in order of index - Sanity check

Returns:of connected attrs in order
Return type:list
getNodeInfo()

get all the info for for the node in the form of a dict

Raises:
  • NotImplementedError – NotImplementedError: each rbf node is unique,
  • adhere here for rbf manager ui support
getPoseInfo()

get poseInfo dict

Raises:
  • NotImplementedError – each rbf node is unique, adhere here for
  • rbf manager ui support
getRBFToggleAttr()

get the specific to the type, “envelope” attr for rbf node

getTransformParent()

get a dict of all the information to be serialized to/from json

Returns:information to be recreated on import
Return type:dict
lengthenCompoundAttrs()

convenience function, sanity check for zero’d compound attrs

nodeType_suffix()

optional override with a module/node specific suffix for naming

setDrivenNode(drivenNode, drivenAttrs, parent=True)

set the node to be driven by the weightDriver

Parameters:
  • node (str) – weightDriver node
  • drivenNode (str) – name of node to be driven
  • drivenAttrs (list) – of attributes to be driven by weightDriver
setDriverNode(driverNode, driverAttrs)

set the node that will be driving the evaluation on our poses

Parameters:
  • node (str) – name of weightDriver node
  • driverNode (str) – name of driver node
  • driverAttrs (list) – of attributes used to perform evaluations
syncPoseIndices(srcNode)
mgear.rigbits.weightNode_io.addPose(node, poseInput, poseValue, posesIndex=None)

add pose to the weightDriver node provided. Also used for editing an existing pose, since you can specify the index. If non provided assume new

Parameters:
  • node (str) – weightedDriver
  • poseInput (list) – list of the poseInput values
  • poseValue (list) – of poseValue values
  • posesIndex (int, optional) – at desired index, if none assume latest/new
mgear.rigbits.weightNode_io.copyPoses(nodeA, nodeB, emptyPoseValues=True)

Copy poses from nodeA to nodeB with the option to be blank or node for syncing nodes OF EQUAL LENGTH IN POSE INFO

Parameters:
  • nodeA (str) – name of weightedNode
  • nodeB (str) – name of weightedNode
  • emptyPoseValues (bool, optional) – should the copy just be the same
  • of poses but blank output value (number) –
Returns:

n/a

Return type:

n/a

mgear.rigbits.weightNode_io.createRBF(name, transformName=None)

Creates a rbf node of type weightDriver

Parameters:
  • name (str) – name of node
  • transformName (str, optional) – specify name of transform
Returns:

pymel: trasnform, weightDriverShape

Return type:

list

mgear.rigbits.weightNode_io.createRBFFromInfo(weightNodeInfo_dict)

create an rbf node from the dictionary provided information

Parameters:weightNodeInfo_dict (dict) – of weightDriver information
Returns:of all created weightDriver nodes
Return type:list
mgear.rigbits.weightNode_io.createVectorDriver(driverInfo)
mgear.rigbits.weightNode_io.deletePose(node, indexToPop)

gather information on node, remove desired index and reapply

Parameters:
  • node (str) – weightDriver
  • indexToPop (int) – pose index to remove
mgear.rigbits.weightNode_io.exportNodes(filePath, weightDriverNodes)

export serialized node information to the specified filepath

Parameters:
  • filePath (str) – path/to/file.ext
  • weightDriverNodes (list) – of weightDriver nodes
mgear.rigbits.weightNode_io.forceEvaluation(node)

force evaluation of the weightDriver node thank you Ingo

Parameters:node (str) – weightDriver to be recached
mgear.rigbits.weightNode_io.getAttrInOrder(node, attrWithIndex)

get the connected attributes of the provided compound attr in order of index - Sanity check

Parameters:
  • node (str) – weightDriver node
  • attrWithIndex (str) – name of compound attr with indicies to query
Returns:

of connected attrs in order

Return type:

list

mgear.rigbits.weightNode_io.getDrivenNode(node)

get driven nodes connected to weightDriver

Parameters:node (str) – weightDriver node
Returns:of driven nodes
Return type:list
mgear.rigbits.weightNode_io.getDrivenNodeAttributes(node)

get the connected attributes of the provided compound attr in order of index - Sanity check

Parameters:node (str) – weightDriver node
Returns:of connected attrs in order
Return type:list
mgear.rigbits.weightNode_io.getDriverListInfo(node)

used for when live connections are supported on the weightDriver # TODO - Complete support

Parameters:node (str) – name of weightDriverNode
Returns:driver:poseValue
Return type:dict
mgear.rigbits.weightNode_io.getDriverNode(node)

get nodes that are driving weightDriver node

Parameters:node (str) – weightDriver node
Returns:of driver nodes
Return type:list
mgear.rigbits.weightNode_io.getDriverNodeAttributes(node)

get the connected attributes of the provided compound attr in order of index - Sanity check

Parameters:node (str) – weightDriver node
Returns:of connected attrs in order
Return type:list
mgear.rigbits.weightNode_io.getIndexValue(nodePlug, indices)

return the values of a compound attr at the specified index

Parameters:
  • nodePlug (node.attr) – name to compound attr
  • indices (int) – of the attr to get
Returns:

of indecies

Return type:

list

mgear.rigbits.weightNode_io.getNodeConnections(node)

get all connections on weightDriver node

Parameters:node (str) – weightDriver node
Returns:of connections and attrs to recreate, small list of supported nodes to be recreated
Return type:list
mgear.rigbits.weightNode_io.getNodeInfo(node)

get a dictionary of all the serialized information from the desired weightDriver node for export/import/duplication

Parameters:node (str) – name of weightDriver node
Returns:collected node info
Return type:dict
mgear.rigbits.weightNode_io.getNodesInfo(weightDriverNodes)

convenience function to get a dict of all the provided nodes

Parameters:weightDriverNodes (list) – names of all weightDriver nodes
Returns:collected serialized informtiaon
Return type:dict
mgear.rigbits.weightNode_io.getPoseInfo(node)

Get dict of the pose info from the provided weightDriver node

Parameters:node (str) – name of weightDriver
Returns:of poseInput:list of values, poseValue:values
Return type:dict
mgear.rigbits.weightNode_io.getRBFTransformInfo(node)

get a dict of all the information to be serialized to/from json

Parameters:node (str) – name of weightDriverShape node
Returns:information to be recreated on import
Return type:dict
mgear.rigbits.weightNode_io.importNodes(filePath)

create nodes from serialized data from the provided json filepath

Parameters:filePath (str) – path/to/file
mgear.rigbits.weightNode_io.lengthenCompoundAttrs(node)

In core, if a compound attr has a value of 0,0,0 it will skip creating the attribute. So to ensure that all indecies exist in the length of a compound we get fake get each index, forcing a create of that attr.

# TODO Perhaps this can turned into a more useful function since we are already querying info that will be needed later on.

Parameters:node (str) – weightDriver to perform insanity check
Returns:n/a
Return type:n/a
mgear.rigbits.weightNode_io.loadWeightPlugin(dependentFunc)

ensure that plugin is always loaded prior to importing from json

Parameters:dependentFunc (func) – any function that needs to have plugin loaded
Returns:pass through of function
Return type:func
mgear.rigbits.weightNode_io.recreateAttributes(node, attributesToRecreate)

add any attributes to the provided node from list

Parameters:
  • node (str) – name of node
  • attributesToRecreate (list) – of attrs to add
mgear.rigbits.weightNode_io.recreateConnections(connectionsInfo)

recreate connections from dict

Parameters:connectionsInfo (dict) – of nodes.attr plugs to try and recreate
mgear.rigbits.weightNode_io.setDrivenNode(node, drivenNode, drivenAttrs)

set the node to be driven by the weightDriver

Parameters:
  • node (str) – weightDriver node
  • drivenNode (str) – name of node to be driven
  • drivenAttrs (list) – of attributes to be driven by weightDriver
mgear.rigbits.weightNode_io.setDriverListFromInfo(node, driverListInfo)

set driverlist node with information from dict proivided

Parameters:
  • node (pynode) – name of driver node
  • driverListInfo (dict) – attr/value
mgear.rigbits.weightNode_io.setDriverNode(node, driverNode, driverAttrs)

set the node that will be driving the evaluation on our poses

Parameters:
  • node (str) – name of weightDriver node
  • driverNode (str) – name of driver node
  • driverAttrs (list) – of attributes used to perform evaluations
mgear.rigbits.weightNode_io.setPosesFromInfo(node, posesInfo)

set a large number of poses from the dictionary provided

Parameters:
  • node (str) – weightDriver
  • posesInfo (dict) – of poseInput/PoseValue:values
mgear.rigbits.weightNode_io.setTransformNode(transformNode, transformInfo)

set the transform node of a weightedDriver with the information from dict

Parameters:
  • transformNode (str) – name of transform nodes
  • transformInfo (dict) – information to set on transform node
mgear.rigbits.weightNode_io.setWeightNodeAttributes(node, weightNodeAttrInfo)

set the attribute information on the weightDriver node provided from the info dict

Parameters:
  • node (pynode) – name of weightDrivers
  • weightNodeAttrInfo (dict) – of attr:value
mgear.rigbits.weightNode_io.syncPoseIndices(srcNode, destNode)

Syncs the pose indices between the srcNode and destNode. The input values will be copied from the srcNode, the poseValues will be defaulted to 0 or 1(if scaleAttr)

Parameters:
  • srcNode (str) – weightedDriver
  • destNode (str) – weightedDriver