Red9_CoreUtils¶
Red9_CoreUtils is the backbone of much of the systems, used to filter, find and process nodes on mass withing Maya as well as containing a lot of core functions for dealing with data.
The FilterNode and FilterSettings classes are used throughout the pack, in fact any time the tools process a hierarchy it’s these classes that deal with it.
Core Functions
nodeNameStrip (node) |
Simple method to strip any |Path and :Namespaces: from |
prioritizeNodeList (*args, **kws) |
Simple function to force the order of a given nList such that nodes in the given priority list are moved to the front of the list. |
sortNumerically (data) |
Sort the given data in the way that humans expect. |
stringReplace (text, replace_dict) |
Replace words in a text that match a key in replace_dict with the associated value, return the modified text. |
matchNodeLists (nodeListA, nodeListB[, ...]) |
Matches 2 given NODE LISTS by node name via various methods. |
getBlendTargetsFromMesh (node[, asList, ...]) |
quick func to return the blendshape targets found from a give mesh’s connected blendshape’s |
timeOffset_addPadding ([pad, padfrom, scene]) |
simple wrap of the timeoffset class which will add padding into the |
timeOffset_collapse ([scene, timerange]) |
Light wrap over the TimeOffset call to manage collapsing time |
decodeString (val) |
From configObj the return is a string, we want to encode |
floatIsEqual (a, b[, tolerance, allowGimbal]) |
compare 2 floats with tolerance. |
valueToMappedRange (value, currentMin, ...) |
Acts like the setRange node but code side |
distanceBetween (nodeA, nodeB) |
simple calculation to return the distance between 2 objects |
Core Classes
FilterNode_Settings () |
Simple concept, this settings object is passed into the filterNode Calls and is used to setup how hierarchies are processed and filtered. |
FilterNode ([roots, filterSettings]) |
FilterNode is a class for managing, searching and filtering nodes with the scene. |
MatchedNodeInputs ([nodes, filterSettings, ...]) |
Class to process and match input nodes for most of the Hierarchy/Anim functions that work on carefully managed matched pairs of nodes. |
LockChannels () |
Simple UI to manage the lock and key status of nodes |
TimeOffset |
A class for dealing with time manipulation inside Maya. |
-
nodeNameStrip
(node)¶ Simple method to strip any |Path and :Namespaces: from a given object DagPath ie Ns:Rig|Ns:Leg|Ns:Foot == Foot
-
prioritizeNodeList
(*args, **kws)¶ Simple function to force the order of a given nList such that nodes in the given priority list are moved to the front of the list.
Parameters: - inputlist – main input list
- priorityList – list which is used to prioritize/order the main nList
- regex – Switches from regex search to simple exact node name
- prioritysOnly – return just the priorityList matches or the entire list sorted
Note
Known issue, if Regex=True and you have 2 similar str’s in the priority list then there’s a chance that matching may be erractic...
>>> priorityList=['upperLip','l_upperLip'] >>> nodes=['|my|dag|path|jaw',|my|dag|path|l_upperLip','|my|dag|path|upperLip','|my|dag|path|lowerLip'] >>> returns: ['|my|dag|path|l_upperLip','|my|dag|path|upperLip',|my|dag|path|jaw,'|my|dag|path|lowerLip]
as in regex ‘l_upperLip’==’upperLip’ as well as ‘upperLip’==’upperLip’ really in regex you’d need to be more specific: priorityList=[‘^upperLip’,’l_upperLip’]
-
sortNumerically
(data)¶ Sort the given data in the way that humans expect.
>>> data=['Joint_1','Joint_2','Joint_9','Joint_10','Joint_11','Joint_12'] >>> >>> # standard gives us: >>> data.sort() >>> ['Joint_1', 'Joint_10', 'Joint_11', 'Joint_12', 'Joint_2', 'Joint_9'] >>> >>> # sortNumerically gives us: >>> sortNumerically(data) >>> ['Joint_1', 'Joint_2', 'Joint_9', 'Joint_10', 'Joint_11', 'Joint_12']
-
stringReplace
(text, replace_dict)¶ Replace words in a text that match a key in replace_dict with the associated value, return the modified text. Only whole words are replaced. Note that replacement is case sensitive, but attached quotes and punctuation marks are neutral.
Parameters: replace_dict –
-
decodeString
(val)¶ From configObj the return is a string, we want to encode it back to it’s original state so we pass it through this
-
validateString
(strText, fix=False, illegals=['-', '#', '!', ' '])¶ Function to validate that a string has no illegal characters
Parameters: - strText – text to validate
- fix – if True then we replace illegals with ‘_’
- illegals – now allow you to pass in what you consider illegals, default=[‘-‘, ‘#’, ‘!’, ‘ ‘]
-
filterListByString
(input_list, filter_string, matchcase=False)¶ Generic way to filter a list by a given string input. This is so that all the filtering used in the UI’s is consistent. Used by the poseSaver, facialUI, MetaUI and many others.
Parameters: - iniput_list – list of strings to be filtered
- filter_string – string to use in the filter, supports comma separated search strings eg : ‘brows,smile,funnel’
- matchcase – whether to match or ignore case sensitivity
-
nodes_in_hierarchy
(rootNode, nodes=[], nodeType=None)¶ check to see if a given set of nodes (shortname matched) are found in the given hierarchy and return the matches
Parameters: - rootNode – rootNode of the hierarchy to search
- nodes – nodes to find from their shortName
- nodeType – nodeTypes within the hierarchy to search
-
class
FilterNode_Settings
¶ Bases:
object
Simple concept, this settings object is passed into the filterNode Calls and is used to setup how hierarchies are processed and filtered. This is class is used through out Red in conjunction with the filterNode class.
- Default settings bound:
- nodeTypes: [] - search for given Maya nodeTypes’
- searchAttrs: [] - search for given attributes on nodes
- searchPattern: [] - search for nodeName patterns
- hierarchy: False - full hierarchy process
- metaRig: False - ??Do we do this here?? {‘MetaClass’,’functCall’}
- filterPriority: [] - A way of re-ordering the hierarchy lists
- incRoots: True - process rootNodes in the filters
- transformClamp: True - clamp any nodes found to their transforms
- infoBlock: ‘’
- rigData: {}
-
filterIsActive
()¶ the filter is deemed to be active if any of the filterSettings would produce a hierarchy search.
-
printSettings
()¶ prettyr print the filterSettings data
-
resetFilters
(rigData=True)¶ reset the MAIN filter args only
Parameters: rigData – this is a cached attr and not fully handled by the UI hence the option NOT to reset, used by the UI presetFill calls
-
setByDict
(data)¶ set the filetrSettings via a dict correctly formatted, used to pull the data back from an MRig that has this data bound to it
Parameters: data – dict of data formatted as per the filterSettings keys. this is a new function allowing a dict of data to be passed into the object from a config file or mNode directly
-
write
(filepath)¶ write the filterSettings attribute out to a ConfigFile
Parameters: filepath – file path to write the configFile out to
-
read
(filepath)¶ Read a given ConfigFile and fill this object instance with the data
Parameters: filepath – file path to write the configFile out to Note
If filepath doesn’t exists or you pass in just the short name of the config you want to load then we try and find a matching config in the default presets dir in Red9
-
class
FilterNode
(roots=None, filterSettings=None)¶ Bases:
object
FilterNode is a class for managing, searching and filtering nodes with the scene. If the arg roots[] is given then the code filters the hierarchy’s of these roots. If roots is not given then the functions will search globally at a scene level.
Note that the main call, ProcessFilter() is only part of this class, there are many other specific filtering functions for finding nodes in your Maya scene.
This is a crucial class and used extensively in Red9 where ever hierarchies are in need of filtering. Used in conjunction with a FilterNode_Settings object which,if not given, gets bound to self.settings.
>>> flt = FilterNode(rootNode) >>> flt.settings.nodeTypes=['nurbsCurve'] >>> filt.settings.searchPattern=['Ctrl'] >>> filt.ProcessFilter()
The above makes a filterNode class, we pass in our hierarchies rootNode (string), then set the internal settings to filter the hierarchy for all child nurbsCurves who’s name includes ‘Ctrl’. Finally the ProcessFilter runs the main call.
Parameters: - roots – Given root nodes in the Maya scene to search from. If a root is NOT given then the filter codes default to scanning all scene nodes.
- filterSettings – This expects a FilterNode_Settings Object to be passed in. This in turn holds all the filtering parameters used by the main lsIntersector call all other calls use given params so can be called directly.
-
rootNodes
¶
-
processMode
¶
-
static
knownShapes
()¶
-
getObjectSetMembers
(objSet)¶ return objectSet members in long form
Parameters: objSet – set to inspect and return the memebers from
-
lsHierarchy
(incRoots=False, transformClamp=False)¶ Simple wrapper of the listRelatives, BUT with the option to include the rootNodes and select the results
Also if a single rootNode is passed, and it’s of type ‘character’ then the code will return the characterMembers instead
Parameters: - incRoots – include the given rootNodes in the filter
- transformClamp – clamp all searches so that any shape style node returns it’s parent transform
TODO: objectSet modifications need testing!!!!!
-
lsSearchNodeTypes
(nodeTypes, nodes=None, incRoots=True, transformClamp=False)¶ Main filter function wraps the cmds.listRelatives but replicates the mel listTransforms function in that it’s capable of just returning the transform nodes of the given nodeTypes for example, when filtered for meshes, we might not want the shape node This now has complex handling for dealing with CharcterSets and SelectionSets
Parameters: - nodeTypes – Maya NodeTypes passed into the listRelatives wrapper
- nodes – optional - allows you to pass in a list to process if required
- incRoots – Include the given root nodes in the search, default=True Valid only if the Class is in ‘Selected’ processMode only.
- transformClamp – Clamp the return to the Transform nodes. Ie, mesh normally would return the shape node, this clamps the return to it’s Transform node, default=False
Returns: a list of nodes who type match the given search list
TODO: Add the ability to use the NOT: operator in this, so for example, nodeTypes=transform would return all mesh nodes too, or rather the transform from a mesh, maybe you’d want to clamp that and prevent mesh transforms being returned? Is this even reasonable???
-
lsMeshes
()¶ Filter for Meshes : from a start node find all mesh nodes in the hierarchy
-
lsTransforms
()¶ Filter for Transforms : from a start node find all transform nodes in the hierarchy
-
lsJoints
()¶ Filter for Joints : from a start node find all Joints nodes in the hierarchy
-
lsLocators
()¶ Filter for Locators : from a start node find all Locators nodes in the hierarchy
-
lsIkData
()¶ Filter for IKData : from a start node find all ikHandle & ikEffector nodes in the hierarchy
-
lsNurbsCurve
()¶ Filter for NurbsCurve : from a start node find all NurbsCurve nodes in the hierarchy
-
lsConstraintsAll
()¶ Filter for All Constraint Nodes : from a start node find all Constraint nodes in the hierarchy
-
lsOrientConstraint
()¶ Filter for OrientConstraint : from a start node find all OrientConstraint nodes in the hierarchy
-
lsPointConstraint
()¶ Filter for PointConstraint : from a start node find all PointConstraint nodes in the hierarchy
-
lsParentConstraint
()¶ Filter for ParentConstraint : from a start node find all ParentConstraint nodes in the hierarchy
-
static
lsAnimCurves
(nodes=None, safe=False)¶ Search for animationCurves. If no nodes are passed in to process then this is a simple one liner, BUT if you pass in a selection of nodes to process then it’s a lot harder. This code has to traverse the history and connection lists to find any animCurves that are in the nodes graph. This passes over character sets and animLayers to find all animCurve data. Note that this has no filter for excluding curves of type eg: setDrivens etc will need post filtering from the returns in many cases
Parameters: - nodes – optional given node list, return animData in the nodes history
- safe – optional ‘bool’, only return animCurves which are safe to modify, this will strip out SetDrivens, Clips curves etc..
-
lsSearchAttributes
(searchAttrs, nodes=None, incRoots=True, returnValues=False)¶ Search for nodes that have a given attr or any attrs from a given list[]
Parameters: - searchAttrs – list or string of attributes to search for on all child nodes NOTE: new operators ‘NOT:’ and ‘=’
- nodes – optional - allows you to pass in a list to process if required
- returnValues – If found return the Value of the Attrs along with the node - switches return type to tuple. default=False
- incRoots – Include the given root nodes in the search, default=True Valid only if the Class is in ‘Selected’ processMode only.
Return type: list[] or dict{} of nodes whos attributes include any of the given attrs[]
Returns: Nodes that have the search attr/attrs. If returnValue is given as a keyword then it will return a dict in the form {node,attrValue}
Note
If the searchAttrs has an entry in the form NOT:searchAttr then this will be forcibly excluded from the filter. Also you can now do ‘myAttr=2.33’ to only pass if the attr is equal similarly ‘NOT:myAttr=2.33’ will exclude if the value is equal see the ..Red9 estsRed9_CoreUtilTests.py for live unittest examples
- TODO: current Implementation DOES NOT allow multiple attr tests as only 1 val per key
- in the excludeAttrs and includeAttrs is currently supported!!!!!!
-
lsSearchNamePattern
(searchPattern, nodes=None, incRoots=True)¶ Search for nodes who’s name match the given search patterns
Parameters: - searchPattern – string/list patterns to match node names against (includes a ‘NOT:’ operator)
- nodes – optional - allows you to pass in a list to process if required
- incRoots – Include the given root nodes in the search, default=True Valid only if the Class is in ‘Selected’ processMode only.
Note
If the searchPattern has an entry in the form NOT:searchtext then this will be forcibly excluded from the filter. ie, My_L_Foot_Ctrl will be excluded with the following pattern [‘Ctrl’,’NOT:My’] where Ctrl finds it, but the ‘NOT:My’ tells the filter to skip it if found
-
lsCharacterSets
()¶ Get any characterSets from the given rootNode (single only). If rootNode[0] is of type ‘character’ then it will just return itself. If not will test all children of the root for links to characterSets and return those found.
-
lsCharacterMembers
()¶ From self.characterSets return all it’s node members. If characterSets attr hasn’t been set then it will invoke a test on the RootNode down through it’s hierarchy to find all characterSet links. Not that this now processes subCharacterSets too
##### THIS NEEDS WORK TO RETURN THE MEMBERS IN THE CORRECT ORDER #####
-
lsMetaRigControllers
(walk=True, incMain=True)¶ very light wrapper to handle MetaData in the FilterSystems. This is hard coded to find CTRL markered attrs and give back the attached nodes :param walk: walk the found systems for subSystems and process those too :param incMain: Like the other filters we allow the given top
node in the hierarchy to be removed from processing. In a MetaRig this is the CTRL_Main controller which should be Top World Space
-
ProcessFilter
()¶ Depricated Function: Replace the ‘P’ in the function call but not depricating it just yet as too much code both internally and externally relies on this method
-
processFilter
()¶ Uses intersection to allow you to process multiple search flags for more accurate filtering. Uses the FilterNode_Settings object for all args such that:
Parameters: - settings.nodeTypes – nodetypes to search for on child nodes
- settings.searchAttrs – attribute to search for on child nodes
- settings.searchPattern – name pattern to match on child nodes
- settings.transformClamp – Clamp the return to the Transform nodes.
- settings.incRoots – Include the given root nodes in the search.
Returns: all nodes which match ALL the given keyword filter searches
-
getBlendTargetsFromMesh
(node, asList=True, returnAll=False, levels=4)¶ quick func to return the blendshape targets found from a give mesh’s connected blendshape’s
TODO: missing index’s used to be an issue if you’d deleted a target Maya would leave the index free resulting in blank targets, doesn’t seem to do that now?? Also what do we return and in what format if we have multiple blendShapes on the node?
Parameters: - node – node to inspect for blendShapes, or the blendshape itself
- asList – return as a straight list of target names or a dict of data
- returnAll – if multiple blendshapes are found do we return all, or just the first
- levels – same as the ‘levels’ flag in listHistory as that’s ultimately what grabs the blendShape nodes here
-
getBlendTargetIndex
(blendNode, targetName)¶ given a blendshape node return the weight index for a given targetName
Parameters: - blendNode – blendShape node to inspect
- targetName – target Alias Name of the channel we’re trying to find the index for
-
matchNodeLists
(nodeListA, nodeListB, matchMethod='stripPrefix')¶ Matches 2 given NODE LISTS by node name via various methods.
Parameters: - nodeListA – list of nodes
- nodeListB – list of nodes
- matchMethod –
default ‘stripPrefix’
* matchMethod=”index” : No intelligent matching, just purely zip the lists together in the order they were given* matchMethod=”indexReversed” : No intelligent matching, just purely zip the lists together in the reverse order they were given* matchMethod=”base” : Match each element by exact name (shortName) such that Spine==Spine or REF1:Spine==REF2:Spine* matchMethod=”stripPrefix” : Match each element by a relaxed naming convention allowing for prefixes one side such that RigX_Spine == Spine* matchMethod=”mirrorIndex” : Match via the nodes MirrorMarker
Returns: matched pairs of tuples for processing [(a1,b2),[(a2,b2)]
-
processMatchedNodes
(nodes=None, filterSettings=None, toMany=False, matchMethod='stripPrefix')¶ HUGELY IMPORTANT CALL FOR ALL ANIMATION FUNCTIONS
PreProcess the given ‘nodes’ and ‘filterSettings’(optional) via a MatchedNodeInput OBJECT that has an attribute self.MatchedPairs We’re going to use this throughout the code such that: nodeList.MatchedPairs = [(ObjA,ObjB),(ObjC,ObjD) .....]
Parameters: - nodes – Given Nodes for processing
- filterSettings – as all other functions, this is the main hierarchy filter
- toMany – Return a MatchedPairs where the first node in each tuple is the first selected node, ie, used to cast data from the first node to all subsequent nodes [(ObjA,ObjB),(ObjA,ObjC),(ObjA,ObjD) ....
- matchMethod – method used in the name matchProcess
Returns: MatchNodeInputs class object
-
class
MatchedNodeInputs
(nodes=None, filterSettings=None, matchMethod='stripPrefix')¶ Bases:
object
Class to process and match input nodes for most of the Hierarchy/Anim functions that work on carefully managed matched pairs of nodes.
Parameters: - nodes – root nodes to start the filtering process from
- matchMethod – Method of matching each nodePair based on nodeName
- filterSettings –
This is a FilterSettings_Node object used to pass all the filter types into the FilterNode code within. Internally the following is true:
settings.nodeTypes: list[] - search nodes of typesettings.searchAttrs: list[] - search nodes with Attrs of namesettings.searchPattern: list[] - search for a given nodeName searchPatternsettings.hierarchy: bool - process all children from the rootssettings.incRoots: bool - include the original root nodes in the filter
Returns: list of matched pairs [(a1,b2),[(a2,b2)]
Note
with all the search and hierarchy keywords OFF the code performs a Dumb zip, no matching and no Hierarchy filtering, just zip the given nodes into selected pairs obj[0]>obj[1], obj[2]>obj[3] etc
-
processMatchedPairs
()¶ Filter selected roots for hierarchy matching using a FilterNode and it’s settings object if one was passed in to the main class. This uses the ProcessFilter() method for powerful pre-filtering before passing the results into the matchNodeLists func. :rtype: tuple :return: a matched pair list of nodes
-
class
LockChannels
¶ Bases:
object
Simple UI to manage the lock and key status of nodes
-
LockChannels.
saveChannelMap
(filepath=None, nodes=None, hierarchy=True, serializeNode=None)¶ WE HAVE TO LOCK THE ATTRIBUTE!! why, 32k Maya string character Limits kick in and truncates the data unless the attr is locked out
-
LockChannels.
loadChannelMap
(filepath=None, nodes=None, hierarchy=True, serializeNode=None)¶ From a given chnMap file restore the channelBox status for all attributes found that are in the map file. ie, keyable, hidden, locked
Parameters: - filepath – filepath to the map to load
- nodes – nodes to load the data onto, if hierarcchy=True this is the rootNode
- hierarchy – process all child nodes of the nodes passed in
- serializeNode – if Meta then this is used to serialize the attrMap to the node itself
Note
Here we’re dealing with 2 possible sets of data, either decoded by the ConfigObj decoder or a JSON deserializer and there’s subtle differences in the dict thats returned hence the decodeString() calls
TODO: Add progress bar?
-
static
LockChannels.
processState
(nodes, attrs, mode, hierarchy=False, userDefined=False)¶ Easy wrapper to manage channels that are keyable / locked in the channelBox.
Parameters: - nodes – nodes to process <<<<<<< HEAD
- attrs – set() of attrs, or ‘all’ =======
- attrs – set() of attrs >>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e
- mode – ‘lock’, ‘unlock’, ‘hide’, ‘unhide’, ‘fullkey’, ‘lockall’
- hierarchy – process all child nodes, default is now False
- usedDefined – process all UserDefined attributes on all nodes
>>> r9Core.LockChannels.processState(nodes, attrs=["sx", "sy", "sz", "v"], mode='lockall') >>> >>> # note: if attrs='all' we now set it to the following for ease: >>> ["tx", "ty", "tz", "rx", "ry", "rz", "sx", "sy", "sz", "v", "nds", "radius"]
-
-
timeOffset_addPadding
(pad=None, padfrom=None, scene=False)¶ simple wrap of the timeoffset class which will add padding into the animation curves on the selected object by shifting keys
Parameters: - pad – amount of padding frames to add
- padfrom – frame to pad from
- scene – offset the entire scene
-
timeOffset_collapse
(scene=False, timerange=None)¶ Light wrap over the TimeOffset call to manage collapsing time
Parameters: - scene – offset the entire scene or just selected
- timerange – specific timerange to collapse else we use the r9 timerange get call
-
timeOffset_collapseUI
()¶ collapse time confirmation UI
-
class
TimeOffset
¶ Bases:
object
A class for dealing with time manipulation inside Maya.
>>> offset=100 >>> >>> #build a filterSettings object up, in this case we're loading a current one. >>> flt=r9Core.FilterNode_Settings() >>> flt.read(os.path.join(r9Setup.red9Presets(),'Crytek_New_Meta.cfg')) >>> flt.incRoots=True >>> flt.printSettings() >>> >>> r9Core.TimeOffset().fromSelected(offset, filterSettings=flt, flocking=False, randomize=False)
-
classmethod
fullScene
(offset, timelines=False, timerange=None, ripple=True)¶ Process the entire scene and time offset all suitable nodes
Parameters: - offset – number of frames to offset
- timelines – offset the playback timelines
- timerange – only offset times within a given timerange
- ripple – manage the upper range of data and ripple them with the offset
-
classmethod
fromSelected
(offset, nodes=None, filterSettings=None, flocking=False, randomize=False, timerange=None, ripple=True)¶ Process the current selection list and offset as appropriate.
Parameters: - offset – number of frames to offset
- nodes – nodes to offset (or root of the filterSettings)
- flocking – wether to sucessively increment nodes during offset
- randomize – whether to add a ramdon factor to each succesive nodes offset
- timerange – only offset times within a given timerange
- ripple – manage the upper range of data and ripple them with the offset
- filterSettings –
this is a FilterSettings_Node object used to pass all the filter types into the FilterNode code. Internally the following is true:
settings.nodeTypes: list[] - search nodes of typesettings.searchAttrs: list[] - search nodes with Attrs of namesettings.searchPattern: list[] - search for a given nodeName searchPatternsettings.hierarchy: bool - process all children from the rootssettings.incRoots: bool - include the original root nodes in the filter
-
static
animCurves
(*args, **kws)¶ Shift Animation curves. If nodes are fed in to process then we do a number of aggressive searches to find all linked animation data.
Parameters: - offset – amount to offset the curves
- nodes – nodes to offset if given
- timerange – if timerange given [start,end] then we cut the keys in that range before shifting associated keys. Now we could just use the keyframe(option=’insert’) BUT this has a MAJOR crash bug!
- ripple – manage the upper range of keys and ripple them with the offset
-
static
timelines
(offset)¶ Shift the main playback timelines and CurrentFrame
-
static
sound
(offset, mode='Scene', audioNodes=None, timerange=None, ripple=True)¶ Offset Audio nodes.
Parameters: - offset – amount to offset the sounds nodes by
- mode – either process entire scene or selected
- audioNodes – optional, given nodes to process
- timerange – optional timerange to process (outer bounds only)
- ripple – when shifting nodes ripple the offset to sounds after the range, if ripple=False we only shift audio that starts in tghe bounds of the timerange
-
static
animClips
(offset, mode='Scene', clips=None, timerange=None, ripple=True)¶ Offset Trax Clips
Parameters: - offset – amount to offset the sounds nodes by
- mode – either process entire scene or selected
- clips – optional, given clips to offset
- timerange – optional timerange to process (outer bounds only)
- ripple – when shifting nodes ripple the offset to clips after the range, if ripple=False we only shift clips that starts in tghe bounds of the timerange
-
static
metaNodes
(*args, **kws)¶ Offset special handling for MetaNodes. Inspect the metaNode and see if the ‘timeOffset’ method has been implemented and if so, call it.
Note
ONLY runs in Scene mode and timerange and ripple are down to the metaNode to handle in it’s internal implementation
Parameters: - offset – amount to offset the sounds nodes by
- timerange – optional timerange to process (outer bounds only)
- ripple – when shifting nodes ripple the offset to clips after the range, if ripple=False we only shift clips that starts in tghe bounds of the timerange
-
classmethod
-
floatIsEqual
(a, b, tolerance=0.01, allowGimbal=True)¶ compare 2 floats with tolerance.
Parameters: - a – value 1
- b – value 2
- tolerance – compare with this tolerance default=0.001
- allowGimbal – allow values differences to be divisible by 180 compensate for gimbal flips
-
valueToMappedRange
(value, currentMin, currentMax, givenMin, givenMax)¶ Acts like the setRange node but code side we have a min max range, lets say 0.5 - 15 and we want to map the range to a new range say 0-1 and return where the value given is in that new range
-
<<<<<<< HEAD
timeIsInRange
(baseRange=(), testRange=(), start_inRange=True, end_inRange=True)¶ test that a given testRange [start,end], falls within the bounds of a baseRange [start,end] =======
timeIsInRange
(baseRange=(), testRange=())¶test that a given testRange falls within the bounds of a baseRange >>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e Used to test if timeRanges fall within a baseRange
Parameters: - baseRange – base time range to test against
- testRange – range to test against the baseRange, do these times fall within the baseRange? <<<<<<< HEAD
- start_inRange – check is the testRange[0] value falls fully in the baseRange
- end_inRange – check is the testRange[1] value falls fully in the baseRange ======= >>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e
Note
<<<<<<< HEADif you pass in baseRange as (None, 100) then we only validate against the end time regardless of the flags. if we pass in baseRange as (10, None) we only validate against the start time regardless of the flags. =======
if you pass in baseRange as (None, 100) then we only validate against the end time. if we pass in baseRange as (10, None) we only validate against the start time >>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e else we validate that testRange is fully within the baseRanges times
-
distanceBetween
(nodeA, nodeB)¶ simple calculation to return the distance between 2 objects
-
class
MatrixOffset
¶ Bases:
object
Given 2 transforms calculate the difference as a Matrix and apply that as an offset matrix to a given list of nodes.
>>> matrixOffset = MatrixOffset() >>> matrixOffset.setOffsetMatrix('inputA','inputB') >>> applyOffsetMatrixToNodes(nodesToOffset)
-
static
get_MDagPath
(node)¶
-
setOffsetMatrix
(inputA, inputB)¶ from 2 transform return an offsetMatrix between them
Parameters: - inputA – MayaNode A
- inputB – MayaNode B
-
applyOffsetMatrixToNodes
(nodes, matrix=None)¶ offset all the given nodes by the given MMatrix object
Parameters: - nodes – Nodes to apply the offset Matrix too
- matrix – Optional OpenMaya.MMatrix to transform the data by
-
static