EasyExp#
- EasyExp.__confirmAction(self, action)#
- EasyExp.__init__(self)#
This is “Lips & Eye Lids Auto Rigger”
as_EasyExpMain_v1.0
About :#
Author: (Subbaiah) Subbu Addanki Character Supervisor (Rigging) & Programmer
Contact :#
Mail Id: subbu.add@gmail.com
Copyright (c) as_EasyExpMain :#
** (Subbaiah) Subbu Addanki. All Rights Reserved. **
- EasyExp._compileEasyExp(self, userFolder='$_Free_EasyExp')#
import shutil
mayaVer =EasyExp._mayaVer() userPath =’D:/My_Scripts/$_as_HyperRig/$_Scripts_Sold/{}/’.format(userFolder) verPath =userPath + str(mayaVer) if not os.path.exists(verPath):
os.makedirs(verPath)
scriptPath =’D:/My_Scripts/as_Scripts/’ pycFiles =[‘as_EasyExpMain.pyc’, ‘asNode.pyc’, ‘as_eRigMain.pyc’, ‘as_eCtrlMain.pyc’, ‘as_eSpecMain.pyc’, ‘as_eModMain.pyc’, ‘as_eMathMain.pyc’, ‘as_eTestMain.pyc’]
import asNode importlib.reload(asNode) from asNode import *
import as_eRigMain importlib.reload(as_eRigMain) from as_eRigMain import *
import as_eCtrlMain importlib.reload(as_eCtrlMain) from as_eCtrlMain import *
import as_eSpecMain importlib.reload(as_eSpecMain) from as_eSpecMain import *
import as_eTestMain importlib.reload(as_eTestMain) from as_eTestMain import *
import as_eMathMain importlib.reload(as_eMathMain) from as_eMathMain import *
import as_eModMain importlib.reload(as_eModMain) from as_eModMain import *
from as_HyperRigMain import * import as_HyperRigMain importlib.reload(as_HyperRigMain)
from as_HyperRigMain import * import as_HyperRigMain importlib.reload(as_HyperRigMain) #HyperRig.as_HyperRig()
- EasyExp._isInTime(self, startDate=[2017, 1, 1], endDate=[2018, 1, 1], onlineTime=1, showDaysLeft=1, bufferTime=1)#
- EasyExp._isNum(self, obj)#
- EasyExp._isPosList(self, posList)#
if posList == [1, 3, 10.5] | [0.1, 10, 9.5] | [0, 0, 0] | (0, 10, 5): return True else: return False
- EasyExp._mayaVer(self)#
- EasyExp.add_Prefix(self, txtFldName)#
[shArgs : tfn=txtFldName]
Purpose:
:: Extracts the prefix from the name of a selected Maya object and inputs it into a specified UI text field.
Ideal for automating repetitive tasks in Maya that involve working with object names and their prefixes.
Simplifies the process of retrieving and using prefixes from object names for various rigging or modeling operations.
Supports updating a specified UI text field with the extracted prefix.
- Parameters:
txtFldName – <str> # The name of the text field where the object’s prefix will be inputted.
- Returns:
None # This function does not return any value but updates the UI text field with the extracted prefix.
Code Examples:
>>> add_Prefix(txtFldName='objectPrefixField') # Extracts the prefix from the selected object's name and updates 'objectPrefixField'.
Usage:
Left_Hand # Adds 'Left_' While pressing Enter.. <== button Hand # Adds '' While pressing Enter.. <== button
- Flow Chart Description:
This flowchart illustrates the add_Prefix function:
The process begins by checking if a Maya object is selected.
If an object is selected, the function extracts the prefix from its name.
The extracted prefix is then used to update the specified text field.
If no object is selected, the function clears the specified text field.
The function ends after updating or clearing the text field.
- EasyExp.add_Selection(self, textFld, multiSelect=False)#
[shArgs : tf=textFld, ms=multiSelect]
Purpose:
:: Adds the name of the selected Maya object(s) to a specified UI text field.
Useful for quickly transferring selected object names into user interfaces or scripts within Maya.
Can handle multiple selections, appending each selected object’s name to the text field.
Streamlines workflows involving the selection and naming of objects in Maya.
- Parameters:
textFld – <str> # The name of the text field where the object’s name will be inputted.
multiSelect – <bool> # Indicates whether multiple object names should be concatenated and added to the text field.
- Returns:
None # This function does not return any value but updates the UI text field with the selected object name(s).
Code Examples:
>>> add_Selection(textFld='objectNameField', multiSelect=True) # Adds names of all selected objects to 'objectNameField'. >>> add_Selection(textFld='singleObjectNameField', multiSelect=False) # Adds the name of the first selected object to 'singleObjectNameField'.
Usage:
obj10 # Adds 'obj10' While pressing Enter.. <== button box25 # Adds 'box25' While pressing Enter.. <== button
If Objects are SelectedIf No Objects are SelectedIf Multi-Select is TrueIf Multi-Select is FalseStart/ Check Object Selection/ Determine Selection Type/ Clear Field/ Concatenate Object Names/ Add Single Object Name/ Update Field/ End- Flow Chart Description:
This flowchart illustrates the add_Selection function:
The process starts by checking if objects are selected in Maya.
If objects are selected, it determines if multiple selections are allowed.
If multiple selections are allowed, it concatenates the names of all selected objects.
If only a single selection is allowed, it adds the name of the first selected object.
The selected object names are then added to the specified text field.
If no objects are selected, the function clears the specified text field.
The process ends after updating or clearing the text field.
- EasyExp.applyCtrlColor(self, ctrlName, colorNum=None)#
[shArgs : ctrlName=n, colorNum=cn]
Purpose:
:: Adjusts the color of a control in Maya based on its name prefix or a specified color number.
Automatically sets control colors to blue for ‘L’ prefix, red for ‘R’, and yellow or white for others.
Useful for distinguishing left, right, and center controls in a character rig.
- Parameters:
ctrlName – (<str>) # Name of the control to color.
colorNum – (<int>, optional) # Specific override color number. If not provided, color is set based on the control name prefix.
Code Examples:
>>> as_EasyExpMain().applyCtrlColor('L_Arm_Ctrl') # Colors the 'L_Arm_Ctrl' control blue. >>> as_EasyExpMain().applyCtrlColor('R_Leg_Ctrl') # Colors the 'R_Leg_Ctrl' control red. >>> as_EasyExpMain().applyCtrlColor('Center_Ctrl', 17) # Colors the 'Center_Ctrl' control with the specified color number (17 for yellow).
If colorNum is not providedIf colorNum is providedIf ctrlName starts with 'L'If ctrlName starts with 'R'OtherStart/ Check Color Number/ Check Prefix/ Apply Custom Color/ Apply Blue Color/ Apply Red Color/ Apply Yellow ColorEnd- Flow Chart Description:
This flowchart illustrates the applyCtrlColor function:
The process starts by checking if a specific color number is provided.
If no specific color number is given, it checks the prefix of the control name.
Applies blue color for controls starting with ‘L’, red color for those starting with ‘R’, and yellow for others.
If a specific color number is provided, it applies that color to the control.
- EasyExp.as_AboutEasyExp(self)#
[shArgs : none]
Purpose:
:: Displays a credits window for the as_EasyExp_v1.0 tool, providing information about the author, contact details, and additional resources.
The window features sections for author details, website links, contact information, and copyright notice.
Includes buttons for visiting the author’s website and closing the window.
Usage Example:
>>> as_AboutEasyExp() # Displays a window with credits and information about as_EasyExp_v1.0.
No Arguments or Returns.
- EasyExp.as_BuildLipsRig(self)#
[shArgs : none]
Purpose:
:: Constructs a comprehensive lip rigging system in Autodesk Maya for character animation.
Automates the rigging process for upper and lower lips, allowing for realistic and flexible lip movements.
Utilizes curves to define the lip region, enabling precise control over lip shapes and expressions.
Supports customization through various user-defined parameters, such as the number of controls, scaling, and parent objects.
Integrates with existing rig structures, allowing for seamless incorporation into complex character rigs.
- Parameters:
none – This function does not require direct arguments but relies on GUI inputs.
Usage Example:
>>> as_BuildLipsRig() # Constructs a lip rig based on user-defined parameters in the GUI.
Note:
The user needs to specify curve names, control counts, and other rig parameters in the GUI fields before executing this function.
Ensure that the curves and control objects mentioned in the GUI fields exist in the Maya scene.
If Curves ExistIf Curves Do Not ExistStartInitializeParameters/ Check Curve Existence/ Setup Curve Direction/ Error: No Curves Found/ Create Lip Rig Groups/ Create Main Controls/ Add Skin Mesh Joints/ Bind Skin to Curve/ Attach to Rig Hierarchy/ Setup Global Scaling/ Create Lip Roll Setup/ Finalize SetupEnd- Flow Chart Description:
This flowchart illustrates the as_BuildLipsRig function:
Initializes parameters such as upper and lower curves, control scale, and group prefixes.
Checks if the specified lip curves exist.
If curves exist, sets up their direction and creates groups for the lip rig.
Creates main control locators along the curves for lips.
Adds skin mesh joints and aligns them with the main controls.
Binds the skin to the curve to influence lip movement.
Attaches the lip rig to the main rig hierarchy.
Sets up global scaling for the lip rig components.
Creates a lip roll setup for more natural lip movements.
Finalizes the setup by organizing joints and preparing for skinning.
The process ends once the lip rig is successfully created or if an error is encountered such as missing curves.
- EasyExp.as_CreateLipRoll(self, jntList_Side, centerJnt, lipCtrl, locGrp, rotAxis='x')#
[**shArgs : jls=jntList_Side, cj=centerJnt, lc=lipCtrl, lg=locGrp, ra=rotAxis]
Purpose:
:: Creates a lip roll setup for controlling lip joints.
- Parameters:
jls – (<list>) # List of side lip joints.
c – (<str>) # Center joint of the lip.
lc – (<str>) # Lip control object.
lg – (<str>) # Name of the group to hold distance nodes.
ra – (<str>) # Rotation axis for lip roll.
- Returns:
(<NoneType>) # This function does not return anything.
Code Examples:
>>> as_CreateLipRoll(jntList_Side=['leftLip_01', 'leftLip_02'], centerJnt='centerLip', lipCtrl='lipControl', locGrp='lipLocGrp', rotAxis='x')
If Custom Rotation Axis ProvidedIf Custom Rotation Axis Not ProvidedStart/ Clear Selection/ Select Lip Joints/ Map Lip Joints/ Select Center Joint/ Set Attributes/ Check Rotation Axis/ Configure Rotation/ Connect Roll Attribute/ Calculate Distance/ Create Distance Nodes/ Create Conditional Nodes/ End- Flow Chart Description:
This flowchart illustrates the as_CreateLipRoll function:
Clears the selection in the scene.
Selects the lip joints.
Maps the lip joints to node objects.
Selects the center joint.
Sets attributes on the lip control.
- Checks if a custom rotation axis is provided.
If a custom rotation axis is provided, configures the rotation accordingly.
If not, connects the roll attribute to the center joint’s rotation.
Calculates the distance between the center joint and the lip joints.
Creates distance nodes to measure the distance.
Creates conditional nodes based on the distance calculations.
The function concludes.
- EasyExp.as_CreateStickyLips(self)#
[shArgs : none]
Purpose:
:: Creates a sticky lips setup for a character in Autodesk Maya, enhancing the realism of lip movements during animations.
Utilizes the advanced sticky lips module (eMod.as_CreateStickyLips_Adv) to set up the functionality.
Allows for dynamic interaction between the upper and lower lips of a character, simulating natural lip adhesion.
The setup is driven by curve controls and influenced by the head control, ensuring that lip movements follow the overall facial animations.
- Parameters:
upperCurv – <str> #Name of the curve controlling the upper lip.
lowerCurv – <str> #Name of the curve controlling the lower lip.
headCtrl – <str> #Name of the head control that influences the sticky lips setup.
skinMesh – <str> #Name of the skin mesh to which the sticky lips setup is applied.
Usage Example:
>>> as_CreateStickyLips() # Initializes the sticky lips setup based on the specified curve controls, head control, and skin mesh.
Initialize Sticky Lips SetupStart/ Get Upper Curve/ Get Lower Curve/ Get Head Control/ Get Skin Mesh/ Create Sticky Lips ModuleEnd- Flow Chart Description:
This flowchart illustrates the as_CreateStickyLips function:
The function starts by retrieving the name of the curve controlling the upper lip.
Then, it gets the name of the curve for the lower lip.
The head control influencing the sticky lips setup is identified next.
It proceeds to get the name of the skin mesh where the sticky lips setup will be applied.
Finally, the advanced sticky lips module is initiated to create the dynamic interaction between upper and lower lips.
- EasyExp.as_EasyExp(self)#
Purpose:
:: Initializes the EasyExp class, setting up the necessary environment and variables for operation.
This function is typically called at the beginning of using the EasyExp class.
It configures the class environment and prepares it for executing other methods within the class.
- Parameters:
self – # The instance of the EasyExp class.
- Returns:
None # This function does not return a value but initializes the class.
Code Examples:
>>> easy_exp_instance = as_EasyExp() # Initializes an instance of the EasyExp class.
- EasyExp.as_GetCurvFromEdgeLoop(self, deg=3)#
[**shArgs : d=deg]
Purpose:
:: Extracts a curve from an edge loop in Autodesk Maya, converting a polygon edge loop into a NURBS curve.
Ideal for creating curves from existing polygon edge loops.
Allows for easy conversion of complex edge geometry to smooth curves.
- Parameters:
deg – <int, optional> # Degree of the curve to be created from the edge loop. Defaults to 3.
- Returns:
<str> # The name of the newly created curve as a Maya node.
Code Examples:
>>> degree = 3 >>> curve_name = getCurv_FromEdgeLoop(degree) # Generates a NURBS curve from an edge loop with the specified degree.
Selected Edges ExistConversion SuccessfulNo Edges SelectedCurve FinalizedStart/ Get Selected Edges/ Convert Edges to Curve/ Finalize CurveErrorEnd- Flow Chart Description:
This flowchart illustrates the eCtrl.getCurv_FromEdgeLoop function:
Starts by getting the currently selected edges in Maya.
If edges are selected, it converts these edges into a NURBS curve with the specified degree.
Once the curve is created, it finalizes the curve by deleting history and centering its pivot.
If no edges are selected, an error is indicated.
The function concludes after the curve is finalized or if an error occurs due to no selection.
- EasyExp.as_ImportTemplate(self)#
[shArgs : templateFile=tf]
Purpose:
:: Imports a Maya template file specified in the ‘as_ModelFile_TF’ text field into the current Maya scene.
This function supports both Maya ASCII (.ma) and Maya Binary (.mb) file formats.
- Parameters:
templateFile – (<str>) #Path of the Maya template file to be imported.
- Returns:
None. Imports the specified Maya file into the current scene.
Code Examples:
>>> as_ImportTemplate() # Imports the Maya template file specified in the 'as_ModelFile_TF' text field into the current Maya scene.
If .ma fileIf .mb fileStart/ Retrieve Template Path/ Check File Type/ Import Maya ASCII/ Import Maya BinaryEnd- Flow Chart Description:
This flowchart illustrates the as_ImportTemplate function:
The process begins by retrieving the template file path from a text field.
It checks the file type of the template (Maya ASCII .ma or Maya Binary .mb).
Depending on the file type, it imports the template file into the current Maya scene.
- EasyExp.as_SplitCurvAtEnds(self)#
[shArgs : ic=inputCurv, a=axis, uep=useEditPoints, r=rebuild]
Purpose:
:: Splits a given curve at its ends based on the specified axis and other parameters.
Useful in rigging and animation workflows for manipulating curve-based structures.
Provides options for axis selection, edit point usage, and curve rebuilding.
- Parameters:
inputCurv – <str, optional> #Curve to be split. If None, the selected curve is used.
axis – <str, optional> #Axis along which the curve is split. Defaults to ‘x’.
useEditPoints – <bool, optional> #If True, uses edit points for splitting. Defaults to False.
rebuild – <int, optional> #If 1, rebuilds the curve before splitting. Defaults to 1.
- Returns:
<list> #Returns a list of two new curve segments resulting from the split.
Code Examples:
>>> splitCurvAtEnds(inputCurv='curve1', axis='x', useEditPoints=True, rebuild=1)
Input Curve ProvidedNo Input CurveRebuild EnabledNo RebuildUse Edit PointsNo Edit PointsStart/ Initialize Parameters/ Check Input CurveProcessCurve/ Select Curve/ Rebuild Curve Check/ Rebuild Curve/ Split Curve/ Check Use Edit Points/ Detach Curve at Edit Points/ Detach Curve at Parametric Points/ Rename CurvesEnd- Flow Chart Description:
This flowchart illustrates the eSpec.splitCurvAtEnds function:
The function starts by initializing parameters like inputCurv, axis, useEditPoints, and rebuild.
It checks if an input curve is provided. If not, the user is prompted to select a curve.
The curve is then processed, with an optional rebuild step for better precision.
The function decides whether to use edit points or parametric values for splitting.
Based on the selection, the curve is detached at either edit points or parametric points.
The resulting curves are renamed for clarity and organization.
The process concludes after splitting and renaming the curve segments.
- EasyExp.as_disconnectAttr(self, objs, attrs)#
[**shArgs : o=objs, a=attrs]
Purpose:
:: Disconnects specified attributes from given objects.
Provide Argument | Description:
- Parameters:
objs – (<list>) # List of objects from which attributes will be disconnected.
attrs – (<list>) # List of attributes to be disconnected.
- Returns:
(<NoneType>) # No return value.
Code Examples:
>>> as_disconnectAttr(objs=["pCube1", "pCube2"], attrs=["translateX", "rotateY"])
If shArgs ExistIf shArgs Does Not ExistFor Each Selected ObjectIf Object Starts With PrefixIf Prefix is Found in ObjectIf No Prefix is FoundIf Target Object ExistsIf Target Object Does Not ExistIf Connections ExistFor Each AttributeIf Connection ExistsIf No Connection ExistsStart/ Check shArgs/ Parse shArgs/ Initialize Parameters/ Get Selected Objects/ Check Prefix/ Split Object Name/ Replace Prefix/ Error: No Prefix Found/ Check Object Exists/ End/ Check Connections/ Error: Target Object Not Found/ Disconnect Attributes/ Disconnect Attribute Connection- Flow Chart Description:
This flowchart illustrates the as_disconnectAttr function:
Checks if shArgs exist, and if so, parses the objs and attrs from it.
If shArgs do not exist, initializes parameters with default values.
Retrieves a list of selected objects.
- For each selected object:
Checks if it starts with a specified prefix.
If not, checks if the prefix is found within the object name.
If neither condition is met, an error is raised.
Checks if the target object exists.
- If the target object exists:
Checks for connections to specified attributes and disconnects them.
If the target object does not exist, an error is raised.
- EasyExp.as_getMDagPath(self, obj)#
[shArgs : none]
Purpose:
:: Retrieves the MDagPath of a specified Maya object. This function is useful for operations that require direct manipulation or querying of the Maya DAG (Directed Acyclic Graph) structure.
The function selects the given object, retrieves its MDagPath from the active selection list, and returns it.
This method is essential in contexts where Maya’s internal node and path representations are required, particularly in more complex scripting and plugin development.
- Parameters:
obj – <str> #The name of the Maya object for which the MDagPath is to be retrieved.
- Returns:
<om.MDagPath> #The MDagPath of the specified object.
Usage Example:
>>> dag_path = as_getMDagPath('pCube1') # Retrieves the MDagPath for the object named 'pCube1'.
Start/ Select Object/ Retrieve MDagPath/ Return MDagPathEnd- Flow Chart Description:
This flowchart illustrates the as_getMDagPath function:
Begins by selecting the specified Maya object.
Retrieves the MDagPath of the selected object.
Returns the obtained MDagPath.
- EasyExp.as_getPos(self, objName)#
[shArgs : none]
Purpose:
:: Retrieves the world space position of a specified Maya object or component (like a vertex). This function is crucial for scripts that involve spatial calculations or manipulations.
The function distinguishes between object-level and component-level queries, applying the appropriate method to obtain the world space position.
For objects, it utilizes the MFnTransform function set to access the transform node’s pivot position in world space.
For components, it directly queries the world space position using the xform command.
- Parameters:
objName – <str> #The name of the Maya object or component whose world space position is to be retrieved.
- Returns:
<list> #A list containing the world space coordinates [x, y, z] of the specified object or component.
Usage Example:
>>> position = as_getPos('pCube1') # Retrieves the world space position of the object named 'pCube1'.
If not a vertexIf a vertexStart/ Check Object Format/ Get MDagPath/ Retrieve Transform/ Get World Space Position/ Get World Space Position/ Return Position/ Return PositionEnd- Flow Chart Description:
This flowchart illustrates the as_getPos function:
The function starts by checking the format of the input object.
If the object is not a vertex, it gets the MDagPath of the object.
Retrieves the transform function of the object.
Then, obtains the world space position using the transform function.
If the object is a vertex, directly gets the world space position.
Finally, the function returns the position of the object.
- EasyExp.as_lockAttrs(self, nodeList, attrList)#
[shArgs : none]
Purpose:
:: Locks and makes specified attributes (attrList) non-keyable for a list of nodes (nodeList). This function is useful in 3D modeling and animation for preventing unintended modifications to certain attributes of objects.
The function can handle either a single attribute or a list of attributes to be locked.
It also supports either a single node or a list of nodes to apply the lock operation.
Attributes are specified as strings (e.g., ‘t’ for translation, ‘tx’ for translation in x-axis).
The function iterates over each node and attribute, performing the locking operation.
- Parameters:
nodeList – <list/str> #List of node names or a single node name on which attributes will be locked.
attrList – <list/str> #List of attribute names or a single attribute name to be locked and made non-keyable.
Usage Example:
>>> as_lockAttrs(['pCube1', 'pSphere1'], ['tx', 'ry']) # Locks and makes 'tx' and 'ry' attributes non-keyable for 'pCube1' and 'pSphere1'.
Start/ Convert to List/ Loop Through Nodes/ Loop Through Attributes/ Lock AttributeEnd- Flow Chart Description:
This flowchart illustrates the as_lockAttrs function:
The process begins by converting the nodeList and attrList arguments into lists if they are not already.
It then loops through each node in the nodeList.
For each node, it loops through each attribute in the attrList.
Locks each attribute to prevent modifications.
- EasyExp.as_lockNhide(self, objs, attrs, lock, channelBox)#
[shArgs : none]
Purpose:
:: Handles locking and hiding attributes for a list of objects in Maya. This function is beneficial in 3D modeling and animation to streamline the control of object attributes.
Iterates over each object and attribute specified in the input.
Allows for locking or unlocking the attribute based on the ‘lock’ parameter.
Sets the visibility of the attribute in the channel box based on the ‘channelBox’ parameter.
Suitable for bulk operations on multiple objects and attributes.
- Parameters:
objs – <list> #List of object names to which the attribute lock/hide operation will be applied.
attrs – <list> #List of attribute names that will be locked/unlocked and shown/hidden in the channel box.
lock – <bool> #Determines whether the attributes are to be locked (True) or unlocked (False).
channelBox – <bool> #Determines whether the attributes are to be visible (True) or hidden (False) in the channel box.
Usage Example:
>>> as_lockNhide(['pCube1', 'pSphere1'], ['translate', 'rotate'], True, False) # Locks and hides 'translate' and 'rotate' attributes for 'pCube1' and 'pSphere1'.
Start/ Loop Through Objects/ Loop Through Attributes/ Lock and Hide AttributeEnd- Flow Chart Description:
This flowchart illustrates the as_lockNhide function:
The function starts by iterating through each object in objs.
For each object, it loops through each attribute in attrs.
Each attribute is locked and hidden based on the lock and channelBox parameters.
- EasyExp.as_openAttrs(self, nodeList, attrList)#
[shArgs : none]
Purpose:
:: Unlocks and makes specified attributes (attrList) keyable for a list of nodes (nodeList). This function is commonly used in 3D modeling and animation to allow transformations or other changes to be applied to objects.
The function accepts either a single attribute or a list of attributes to be unlocked and made keyable.
It also accepts either a single node or a list of nodes on which the operation will be performed.
The attributes are specified as strings (e.g., ‘t’ for translation, ‘tx’ for translation in x-axis).
The function iterates over each node and attribute, performing the unlocking and keyable operation.
- Parameters:
nodeList – <list/str> #List of node names or a single node name on which attributes will be unlocked.
attrList – <list/str> #List of attribute names or a single attribute name to be unlocked and made keyable.
Usage Example:
>>> as_openAttrs(['pCube1', 'pSphere1'], ['tx', 'ry']) # Unlocks and makes 'tx' and 'ry' attributes keyable for 'pCube1' and 'pSphere1'.
Start/ Convert to List/ Loop Through Nodes/ Loop Through Attributes/ Unlock AttributeEnd- Flow Chart Description:
This flowchart illustrates the as_openAttrs function:
The function begins by converting the nodeList and attrList arguments into lists if they are not already.
It then loops through each node in the nodeList.
For each node, it loops through each attribute in the attrList.
Unlocks each attribute to allow modifications.
- EasyExp.as_snapObjs(self, objs, type)#
[shArgs : none]
Purpose:
:: Performs snapping of objects based on a specified constraint type in Autodesk Maya. This function is useful for aligning objects quickly and efficiently in 3D space.
Iteratively applies a constraint of the specified type between the first object and each subsequent object in the list.
Executes a Maya command to create the constraint and immediately deletes it, leaving the objects in their snapped positions.
Suitable for operations that require precise alignment of multiple objects, such as rigging or scene setup.
- Parameters:
objs – <list> #List of object names that will be involved in the snapping operation. The first object in the list serves as the target for the rest.
type – <str> #Specifies the type of constraint to be used for snapping. Common types include ‘point’, ‘orient’, ‘parent’, etc.
Usage Example:
>>> as_snapObjs(['pCube1', 'pSphere1', 'pCylinder1'], 'point') # Snaps 'pSphere1' and 'pCylinder1' to the position of 'pCube1' using a point constraint.
Start/ Prepare Constraint Command/ Loop Through Objects/ Execute Constraint CommandEnd- Flow Chart Description:
This flowchart illustrates the as_snapObjs function:
The process starts by preparing the constraint command based on the provided type.
It then iterates through the objects in objs, starting from the second object.
For each object, the constraint command is executed to snap it to the first object in the list.
- EasyExp.as_snapRot(self, src, destObj)#
[shArgs : none]
Purpose:
:: Aligns the rotation of the source object (src) with the rotation of the destination object (destObj). This function is utilized extensively in 3D modeling and animation for matching the rotational orientation of objects.
The function creates a temporary orient constraint to align the rotations and then applies this rotation to the source object.
After applying the rotation, the temporary constraint is removed to maintain the original object hierarchy.
- Parameters:
src – <str> #The name of the source object whose rotation will be aligned.
destObj – <str> #The name of the destination object whose rotation is to be matched.
Usage Example:
>>> as_snapRot('pCube1', 'pSphere1') # Aligns the rotation of 'pCube1' with the rotation of 'pSphere1'.
Start/ Create Orient Constraint/ Get Rotation/ Delete Constraint/ Set RotationEnd- Flow Chart Description:
This flowchart illustrates the as_snapRot function:
The process starts by creating an orientation constraint from the destination object to the source.
Retrieves the rotation value of the source object.
Deletes the orientation constraint.
Sets the rotation of the source object to the retrieved values.
- EasyExp.as_snapToObj(self, srcObj, destObj=[0, 0, 0])#
[shArgs : none]
Purpose:
:: Moves the source object to match the position of the destination object or a specified coordinate. This function is widely used in rigging and animation for aligning objects in 3D space.
It supports snapping to both a specific object or a given position in world space.
The function determines whether the destination is an object or a coordinate list and proceeds accordingly.
For object destinations, it first retrieves the object’s world space position before executing the snap.
- Parameters:
srcObj – <str> #The name of the source object that needs to be moved.
destObj – <str/list> #The target destination, which can be either the name of a Maya object or a list of coordinates [x, y, z].
Usage Example:
>>> as_snapToObj('pCube1', 'pSphere1') # Moves 'pCube1' to the position of 'pSphere1'.
>>> as_snapToObj('pCube1', [5, 10, 15]) # Moves 'pCube1' to the coordinates [5, 10, 15] in world space.
If not a listIf a listStart/ Check Destination Format/ Get Position/ Select Source/ Move to DestinationEnd/ Move to Destination- Flow Chart Description:
This flowchart illustrates the as_snapToObj function:
The process starts by checking the format of the destination object.
If the destination object is not a list, it retrieves the position of the destination object.
The source object is then selected.
The source object is moved to the retrieved position of the destination object.
If the destination object is a list, the source object is directly moved to the specified list coordinates.
- EasyExp.as_snapToVtxs(self, srcObj, vtxList)#
[shArgs : none]
Purpose:
:: Moves the source object (srcObj) to the averaged position of a list of specified vertices (vtxList). This function is useful in 3D modeling and animation to position objects precisely in relation to specific vertices.
The function creates a temporary cluster to calculate the averaged position of the vertices in vtxList.
It then moves the source object to this calculated position.
After the positioning is complete, the temporary cluster is deleted to maintain the original scene structure.
- Parameters:
srcObj – <str> #The name of the source object to be moved.
vtxList – <list> #A list of vertex names or positions to which the source object will be aligned.
Usage Example:
>>> as_snapToVtxs('pCube1', ['pSphere1.vtx[0]', 'pSphere1.vtx[1]', 'pSphere1.vtx[2]']) # Moves 'pCube1' to the averaged position of the first three vertices of 'pSphere1'.
Start/ Select Vertices/ Create Cluster/ Snap to Cluster/ Delete ClusterEnd- Flow Chart Description:
This flowchart illustrates the as_snapToVtxs function:
The process starts by selecting the vertices provided in the vtxList.
Creates a cluster on the selected vertices.
Snaps the source object to the created cluster handle.
Deletes the cluster after snapping.
- EasyExp.as_transferConnections(self, obj, targetObj)#
[**shArgs : o=obj, t=targetObj]
Purpose:
:: Transfers connections from one object to another.
Provide Argument | Description:
- Parameters:
obj – (<str>) # The source object from which connections will be transferred.
targetObj – (<str>) # The target object to which connections will be transferred.
- Returns:
(<NoneType>) # No return value.
Code Examples:
>>> as_transferConnections(obj="sourceNode", targetObj="targetNode")
If shArgs ExistIf shArgs Does Not ExistFor Each ConnectionIf Connection Attribute Contains Source ObjectStart/ Check shArgs/ Parse shArgs/ Initialize Parameters/ Get Connections/ Check Attribute/ Replace Attribute/ Connect To Target Object/ End- Flow Chart Description:
This flowchart illustrates the as_transferConnections function:
Checks if shArgs exist, and if so, parses the obj and targetObj from it.
If shArgs do not exist, initializes parameters with default values.
Retrieves connections from the source object.
- For each connection:
Checks if the connection attribute contains the source object.
If the source object is found in the attribute, replaces it with the target object.
Connects the modified attribute to the target object.
The function concludes successfully.
- EasyExp.circleCtrl(self, ctrlName, grpLevel=2, initRot=[0, 0, 0])#
[shArgs : ctrlName=n, grpLevel=gl, initRot=ir, ctrlType=ct, grpSufxList=gsl]
Purpose:
:: Efficiently generates a circular control in Autodesk Maya, ideal for rigging and animation purposes.
The circle control serves as a versatile rigging element for various animation needs, providing intuitive manipulation for animators.
Customizable rotation, group levels, and multiple shape options enhance the utility and adaptability of the control in a rigging context.
- Parameters:
ctrlName – <str, optional> # Name to assign to the circle control. Defaults to ‘as_Circle_Ctrl’ if None.
grpLevel – <int, optional> # Number of grouping levels for organizing the control in the scene. Default is 2.
initRot – <list> # Initial rotation of the control, specified as [x, y, z].
ctrlType – <int, optional> # Type of circle control, with options 1 for a single circle and 2 for a dual circle. Default is 1.
grpSufxList – <list, optional> # List of suffixes for naming the control groups. Defaults to None.
- Returns:
<list> # A list containing the circle control and its top group as asNodes.
Code Examples:
>>> circle_control = circleCtrl(ctrlName="myCircleCtrl", grpLevel=3, initRot=[45, 0, 0], ctrlType=2) # Creates a dual circle control named "myCircleCtrl" with specific rotation and group level.
- EasyExp.confirmAction(self, action, raiseErr=False, trueVal='Yes', falseVal='No')#
[shArgs : a=action, e=raiseErr, tv=trueVal, fv=falseVal, eb1=ex1Btn, ea1=ex1Action, eb2=ex2Btn, ea2=ex2Action, eb3=ex3Btn, ea3=ex3Action]
Purpose:
:: Requests the user to confirm an action displayed in a dialog window.
- Parameters:
action – (<str>) # The action to be confirmed.
raiseErr – (<bool, optional>) # Whether to raise an error if the action is confirmed. Default is False.
trueVal – (<str, optional>) # The label for the true button in the confirmation dialog. Default is ‘Yes’.
falseVal – (<str, optional>) # The label for the false button in the confirmation dialog. Default is ‘No’.
ex1Btn – (<str, optional>) # Label for an additional button in the confirmation dialog. Default is None.
ex1Action – (<function, optional>) # Action to perform when the additional button is clicked. Default is None.
ex2Btn – (<str, optional>) # Label for a second additional button in the confirmation dialog. Default is None.
ex2Action – (<function, optional>) # Action to perform when the second additional button is clicked. Default is None.
ex3Btn – (<str, optional>) # Label for a third additional button in the confirmation dialog. Default is None.
ex3Action – (<function, optional>) # Action to perform when the third additional button is clicked. Default is None.
- Returns:
<bool/str/None> # True if the action is confirmed as ‘Yes’, False if confirmed as ‘No’, the label of the additional button if clicked, or None if no action is taken.
Code Examples:
>>> confirmation = confirmAction('Are you sure?', trueVal='Confirm', falseVal='Cancel') >>> if confirmation: ... print("Action confirmed.") ... else: ... print("Action canceled.")
If shArgs ExistIf shArgs Does Not ExistStart/ Check shArgs/ Parse shArgs/ Initialize Parameters/ Process Dialog/ End- Flow Chart Description:
This flowchart illustrates the confirmAction function:
Checks if shArgs exist, and if so, parses the parameters from it.
If shArgs do not exist, initializes parameters with default values.
Processes the dialog window based on the provided parameters.
Ends the process.
- EasyExp.createNode_MD(self, valOrAttr01, valOrAttr02, mdnSign='*', mdnName='asNode_MDN', destAttr=None)#
[shArgs : va1=valOrAttr01, va2=valOrAttr02, ms=mdnSign, mn=mdName, da=destAttr]
Purpose:
:: Creates a ‘multiplyDivide’ node to perform mathematical operations on two input values or attributes.
Performs multiplication, division, or power operations on the inputs.
Useful for procedural rigging, animation setups, and dynamic attribute control.
- Parameters:
valOrAttr01 – <str/float> #First value or attribute for the operation.
valOrAttr02 – <str/float> #Second value or attribute for the operation.
mdnSign – <str> #Operation type: ‘*’ for multiply, ‘/’ for divide, ‘**’ for power.
mdName – <str, optional> #Name for the multiplyDivide node. Defaults to ‘asNode_MD’.
destAttr – <str, optional> #Destination attribute for the output of the operation.
showError – <int, optional> #Flag to show error if input is not connected.
- Returns:
<list> #List containing the multiplyDivide node and the output attribute.
- Flags:
Available mdnSigns are: [‘*’, ‘/’, ‘**’]
Usage:
valOrAttr01 =selected()[0] + '.tx' | selected()[0] + '.t' | 25 | [0, 2, 10] valOrAttr02 =selected()[1] + '.ty' | selected()[1] + '.r' | 10 | [0, 2, 10] destAttr =selected()[1] + '.ty' | selected()[1] + '.r' eSpec.create_MD(valOrAttr01, valOrAttr02, '*', 'node_MD', destAttr) Returns: return [mdNode, outAttr] #_ outAttr = node + '.' + attr
If shArgs is providedIf shArgs is not providedSet mdnSign operationIf valOrAttr01 is providedIf valOrAttr01 is not providedIf valOrAttr02 is providedIf valOrAttr02 is not providedStart/ Check shArgs/ Update Inputs/ Create MD Node/ Set mdnSign/ Check valOrAttr01/ Connect valOrAttr01/ Check valOrAttr02/ Connect valOrAttr02/ Set Output Connection/ Return MD Node and OutputEnd- Flow Chart Description:
This flowchart illustrates the createNode_MD function:
The function starts by checking if additional arguments (shArgs) are provided and updating the inputs accordingly.
A multiplyDivide (MD) node is created, and its operation type is set based on the mdnSign provided.
The first value or attribute (valOrAttr01) is connected to the MD node’s input1.
The second value or attribute (valOrAttr02) is connected to the MD node’s input2.
The output of the MD node is connected to the specified destination attribute, if provided.
Finally, the function returns the MD node and its output attribute.
- EasyExp.ctrlMaker(self, curvList, ctrlName)#
[shArgs : curvList=cl, ctrlName=n]
Purpose:
:: Creates a control curve by combining multiple specified curves.
This method is useful for creating custom control shapes from multiple curve segments.
- Parameters:
curvList – (<list>) #List of curve segments to be combined into a single control curve.
ctrlName – (<str>) #Name to assign to the newly created control curve.
- Returns:
<asNode> #The newly created control curve as an asNode.
Code Examples:
>>> curvList = [edge1, edge2, edge3] >>> ctrlName = "customCtrl" >>> ctrlCurv = ctrlMaker(curvList, ctrlName) # Creates a control curve named "customCtrl" by combining curves from 'edge1', 'edge2', and 'edge3'.
Fonts:
#_ fontList =['Palatino Linotype', 'Bolide', 'Vectroid', 'Snap ITC', 'Quaint', 'Ravie'] #_ ['Outer Sider BRK', 'ChangChangWoodcut'] #_ textCurves(ch=0, t='ikfk', f= 'Quaint|h-16|w700|c0') #_ font =fontList[rand.randint(0, 5)]
Start/ Select Curves/ Group Curves/ Set Pivot/ Separate Shapes/ Rename Shapes/ Delete Group/ Create Main Curve/ Set Pivot Main/ Apply Control ColorsEnd- Flow Chart Description:
This flowchart illustrates the ctrlMaker function:
Starts by selecting curves to form the control.
Groups the selected curves together.
Sets the pivot to the origin for the group.
Separates the shapes from the group.
Renames the separated shapes for clarity.
Deletes the initial group after separation.
Creates a main curve to combine the shapes.
Sets the pivot for the main curve.
Applies control colors based on the naming convention (L_, R_, or default).
- EasyExp.dimondCtrl(self, ctrlName=None, grpLevel=3, initRot=[0, 0, 0], ctrlType=1, grpSufxList=None, **shortArgs)#
[shArgs : ctrlName=n, grpLevel=gl, initRot=ir, ctrlType=ct, grpSufxList=gsl]
Purpose:
:: Creates a diamond-shaped control with optional grouping levels and initial rotation settings.
This method is useful for creating custom controls in rigging setups.
Offers flexibility in control shape, initial rotation, and hierarchy depth.
Argument | Description :param ctrlName: (<str>, optional) # Name for the control to be created. Defaults to ‘as_Dimond_Ctrl’. :param grpLevel: (<int>, optional) # Number of top groups to be created for the control. Defaults to 3. :param initRot: (<list of float>, optional) # List specifying initial rotation in degrees for each axis. :param ctrlType: (<int>, optional) # Specifies the type of control shape. Can be 1, 2, 3, etc. :param grpSufxList: (<list of str>, optional) # List of suffixes for group names, if required.
- Returns:
<list of asNode> # Returns a list containing the created control and its top group node.
Code Examples:
>>> ctrl, ctrlGrp = as_EasyExpMain().dimondCtrl(ctrlName='myControl', grpLevel=2, initRot=[90, 0, 0], ctrlType=1) # Creates a diamond control named 'myControl' with 2 group levels and initial rotation of 90 degrees on the X-axis.
Args:
ctrlName : name(str) #_ name for the control which is going to be created grpLevl : num(int) #_ Number of top groups on control to be created initRot : [float, float, float] #_ Rotates the shape initially ctrlType : 1|2|3 etc #_ One of 3 Shapes can be returned
If additional keyword arguments providedNo additional argumentsIf ctrlName is not providedIf ctrlName is providedType 1Type 2Type 3Start/ Check Arguments/ Update Arguments/ Check Control Name/ Set Default Name/ Select Control Type/ Create Diamond Control Type 1/ Create Diamond Control Type 2/ Create Diamond Control Type 3/ Rotate and Freeze Transform/ Group Control/ Apply Control ColorEnd- Flow Chart Description:
This flowchart illustrates the dimondCtrl function:
Starts by checking if additional keyword arguments are provided and updates arguments accordingly.
Checks if a control name is provided. If not, sets a default name for the control.
Selects the control type based on the ctrlType parameter.
Creates the diamond control based on the selected type (Type 1, 2, or 3).
Rotates and freezes the control’s transformations as per the initRot parameter.
Groups the control according to the specified grpLevel and optionally applies group suffixes.
Applies a control color to the diamond control.
Completes the process and returns the control and its top group.
- EasyExp.doBindSkin(self, jntList, skinMesh, clustName='skinCluster1', ignoreHI=False, skinMethod=2, normalizeMethod=1, maxInflu=3, retainMaxInflu=True, dropRate=8.5)#
[shArgs : jl=jntList, sm=skinMesh, cn=clustName, ih=ignoreHI, sm=skinMethod, mi=maxInflu, dr=dropRate, cre=curvRigidEnds]
Purpose:
:: Applies skinning to a mesh or curve using specified joints, with various skinning methods and options.
This function is used for skinning meshes or curves to joints, providing control over skinning methods, influence limits, and more.
It supports classical linear, dual quaternion, and blended skinning methods.
skinCluster(n=’clustName’, tsb=True, ih=False, sm=2, nw=1, mi=3, omi=1, dr=8.5, rui=0, ps=1, sw=1)
bindMethod : ignoreHI - Disregard the place of joints hierarchy when computing the closest joints that influence a point of the geometry.
skinMethod : 0 - Classical linear skinning (default). 1 - Dual quaternion (volume preserving), 2 - A weighted blend between the two.
Other Args:
nw : 0 - None, 1 - Interactive, 2 - Post (default) for normalizing weights
- Parameters:
jntList – <list, optional> #List of joints to use for skinning. If not provided, uses selected joints.
skinMesh – <str/object, optional> #The mesh or curve to be skinned. If not provided, uses the selected mesh or curve.
clustName – <str, optional> #Name for the created skin cluster. Default is ‘skinCluster1’.
ignoreHI – <int> #Flag to ignore joint hierarchy in skinning calculations.
skinMethod – <int> #Skinning method: 0 (linear), 1 (dual quaternion), or 2 (blend).
maxInflu – <int> #Maximum number of joint influences per vertex.
dropRate – <float> #Dropoff rate for skinning weights.
curvRigidEnds – <list, optional> #Flags to apply rigid skinning at the ends of a curve.
- Returns:
<list> #A list containing the created skin cluster and associated joints.
Code Examples:
>>> doBindSkin(jntList=['joint1', 'joint2'], skinMesh='mesh1', clustName='mySkinCluster', ignoreHI=0, skinMethod=2, maxInflu=3, dropRate=8.5, curvRigidEnds=[1, 1])
If jntList and skinMesh are not providedIf jntList and skinMesh are providedFor Each Skin MeshIf Mesh or CurveIf CurveNot CurveAll Meshes ProcessedStart/ Check Args/ Select Objects/ Prepare Skin List/ Iterate Through Skin Mesh/ Check Mesh Type/ Delete Existing Skin Cluster/ Check Skin Method/ Do Skinning/ Check If Curve/ Auto Weight Curve/ Add To Result ListEnd- Flow Chart Description:
This flowchart illustrates the doBindSkin function:
The process begins by checking if joint list and skin mesh are provided; if not, objects are selected interactively.
Prepares a list of skin meshes based on the input or selected objects.
Iterates through each skin mesh to process.
For each skin mesh, checks if it is a mesh or curve and deletes any existing skin cluster.
Verifies the skinning method to ensure it’s valid.
Performs skinning using the specified method, joints, and additional parameters.
If the skin mesh is a curve, auto weights the curve based on the joints.
Adds the skinned mesh and associated skin cluster to the result list.
The process repeats for all skin meshes and ends once all have been processed.
- EasyExp.edgeLoopCtrl(self, ctrlName='as_EdgeLoop_Ctrl', closeLoop=1, grpLevel=0, edgeList=None, oneShape=True, curvDegree=3, stepVal=1, offset=0)#
[shArgs : n=ctrlName, cl=closeLoop, gl=grpLevel, el=edgeList, os=oneShape, cd=curvDegree, sv=stepVal, sp=snapPiv, o=offset, mc=multiCtrls]
Purpose:
:: Generates a control based on an edge loop in Autodesk Maya, with various customization options for shape, grouping, and pivot settings.
This function is particularly useful for rigging and animation tasks where edge loop based controls are needed.
Offers flexibility to create single or multiple controls based on edge loops, with adjustable degree, step value, and offset.
- Parameters:
ctrlName – <int/str, optional> # Name for the control to be created. Defaults to 0 if not provided.
closeLoop – <bool, optional> # Specifies whether to close the first and last edges. Defaults to True.
grpLevel – <int, optional> # Hierarchy level for grouping the control. Defaults to 0.
edgeList – <list/str, optional> # List of edges or a single edge to create the control from. If None, selection is used.
oneShape – <bool, optional> # Determines if a single shape or multiple shapes should be created. Defaults to True.
curvDegree – <int, optional> # Degree of the curve for the control. Ranges from 1 to 5. Defaults to 1.
stepVal – <int, optional> # Step value to skip vertices. Defaults to 1 (no skip).
offset – <int, optional> # Offset value for scaling the control. Defaults to 0.
snapPiv – <bool, optional> # If True, snaps group pivot to the control. Defaults to True.
multiCtrls – <bool, optional> # If True, creates multiple controls for each edge in edgeList. Defaults to False.
- Returns:
<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.
Code Examples:
>>> ctrl_name = "myEdgeLoopCtrl" >>> edge_loop = ["edge1", "edge2", "edge3"] >>> control, control_group = edgeLoopCtrl(ctrlName=ctrl_name, edgeList=edge_loop, grpLevel=2) # This will create a control based on the specified edge loop with 2 group levels.
:param ctrlName : name(str) #_ name for the control which is going to be created :param closeLoop : True | False #_ Closes the first and last edges :param grpLevl : num(int) #_ Number of top groups on control to be created :param edgeList : None | strList | str #_ If edgeList is not given, edges are selected from selection
#_ If singe edge is given, edgeLoop will be selected
:param oneShape : True | False #_ If not oneShape, multiple shapes equal to no of edges will be created :param curvDegree : 1|2|3|4|5 #_ Used for the degree of the curve :param stepVal : 1|2|etc #_ Skips number of vertices (stepVal-1), if stepVal is more than 1 :param offset : num(int) #_ Keeps the created ctrl with the offset in scaling :param snapPiv : True | False #_ Snaps Group pivot to ‘edgeLoopCtrl’
CtrlName providedCtrlName not providedEdgeList providedEdgeList not providedSingle ControlMultiple ControlsStart/ Check Control Name/ Check Edge List Provided/ Assign Default Ctrl Name/ Check Multiple Controls/ Select Edges from Selection/ Create Single Control/ Create Multiple Controls/ Finalize ControlEnd- Flow Chart Description:
This flowchart illustrates the edgeLoopCtrl function:
The function starts by checking if a control name is provided. If not, a default name is assigned.
It then checks if an edge list is provided. If not, edges are selected from the current selection.
The function determines whether to create a single control or multiple controls based on the ‘multiCtrls’ parameter.
For a single control, it creates one control based on the provided edge loop.
For multiple controls, it creates individual controls for each edge in the edge list.
Finally, the function finalizes the control with group levels, pivot snapping, and color application.
The process ends by returning the control and its top group.
- EasyExp.generateCurv(self, curvName, deg=3, step=1, objOrPosList=None)#
[shArgs: n=curvName, d=deg, s=step, opl=objOrPosList, sc=showCVs, se=showEditor, pc=printCommand]
Function:: generateCurv
Purpose:
:: Generates a curve with specified parameters in Maya.
- Parameters:
curvName – (<str>) # Name for the generated curve. Default is ‘as_Curv’.
deg – (<int>) # Degree of the curve. Default is 3.
step – (<int>) # Step value for the curve. Default is 1.
objOrPosList – (<list>) # List of objects or positions to define the curve.
showCVs – (<bool>) # If True, shows the CVs of the curve.
showEditor – (<bool>) # If True, opens the curve editor.
printCommand – (<bool>) # If True, prints the command used to create the curve.
- Returns:
curvNode # asNode
- Usage::
#_ (Usage: Select the vertices or objects not the curve itself)
>>> generateCurv(curvName="myCurve", deg=2, step=2, objOrPosList=["obj1", "obj2", "obj3"], showCVs=True, showEditor=False, printCommand=True)
If shArgs providedIf shArgs not providedIf TrueIf FalseIf TrueIf FalseIf TrueIf FalseStart/ Check shArgs/ Retrieve Positions/ Reduce Position List/ Build Curve String/ Execute Curve Command/ Show CVs/ Show Editor/ Print Command/ Return Curve NodeEnd- Flow Chart Description:
This flowchart illustrates the generateCurv function:
The process starts by checking if shArgs are provided, updating parameters accordingly.
It retrieves the positions from the objects or positions list.
The position list is reduced based on the step value.
A curve creation command string is built using the positions and curve parameters.
The curve command is executed to generate the curve.
If showCVs is True, the Curve Vertices (CVs) are displayed.
If showEditor is True, the curve editor is shown.
If printCommand is True, the curve creation command is printed.
The function concludes by returning the created curve node.
- EasyExp.generateLipsCurve(self)#
[**shArgs : ]
Purpose:
:: Generates a lips curve based on selected edges or rebuilds the provided curve.
- Returns:
(<NoneType>) # This function does not return anything.
Code Examples:
>>> generateLipsCurve()
If Rebuild Checkbox Not Checked and Selected Object is Not CurveIf Rebuild Checkbox Not Checked and Selected Object is Not CurveIf Edge List Not EmptyIf Edge List EmptyIf Edge Count Equals 1If Edge Count Not Equals 1Start/ Check Rebuild Checkbox/ Check Edge List/ End/ Check Edge Count/ Show Error Message/ Set Close Curve Checkbox/ Get Close Loop Value/ Set Curve Name/ Create Curve/ Rebuild Curve- Flow Chart Description:
This flowchart illustrates the generateLipsCurve function:
Checks if the ‘RebuildCurv’ checkbox is not checked and the selected object is not a curve.
- If the checkbox is not checked and the selected object is not a curve:
Checks if an edge list is empty.
If the edge list is not empty, checks the count of edges.
If the count of edges equals 1, sets the ‘CloseCurve’ checkbox.
Obtains the value of the ‘CloseCurve’ checkbox.
Sets the curve name based on whether the upper or lower lip curve exists.
Creates the curve.
Rebuilds the curve.
The function concludes.
- EasyExp.generate_HyperSkin(self, jntList=None, vtxList=None, bodyMesh=None)#
[shArgs : ]
Purpose:
:: Generates a hyper skinning setup for enhanced skin deformation on a character or object in Autodesk Maya.
Facilitates precise skinning by allowing targeted influence of joints on specific vertices of a mesh.
Enhances the deformation quality around joints, providing more realistic movements for characters or objects.
Operates on the selected mesh and joint list, automatically identifying nearest vertices for skinning influence.
Offers an option to specify vertices and joints manually for more controlled skinning.
- Parameters:
jntList – <list> #List of joints to influence the skinning.
vtxList – <list> #List of vertices to be influenced by the specified joints.
bodyMesh – <str> #Name of the body mesh to which the hyper skinning is applied.
Usage Example:
>>> generate_HyperSkin(jntList, vtxList, 'bodyMesh') # Applies hyper skinning to 'bodyMesh' using the specified joints and vertices for enhanced deformation.
Note: - If ‘vtxList’ is not provided, the tool will automatically determine the nearest vertices for each joint. - The skin cluster of ‘bodyMesh’ should exist before using this function.
If Vertex List is ProvidedIf Vertex List is Not ProvidedIf Mesh is Not SkinnedIf Mesh is SkinnedIf Joint List ProvidedIf Joint List Not ProvidedPerform Hyper Skinning ProcessStart/ Check Vertex List/ Use Provided Vertices/ Get Body Mesh/ Check Mesh Type/ Error: Mesh Not Skinned/ Check Joint List/ Use Provided Joints/ Error: No Joints Provided/ Apply Hyper SkinningEnd- Flow Chart Description:
This flowchart illustrates the generate_HyperSkin function:
Starts by checking if a vertex list is provided.
If provided, uses these vertices for skinning influence. If not, it retrieves the body mesh to be skinned.
Checks if the body mesh is already skinned. If not, raises an error.
Checks if a joint list is provided for influencing the skin.
If the joint list is provided, uses these joints. If not, raises an error for no joints provided.
Applies the hyper skinning process to enhance skin deformation around joints.
The process ends once hyper skinning is successfully applied or an error is encountered.
- EasyExp.getClosestParam_Crv(self, from_ObjOrPos, curvName, getLoc=True)#
[shArgs : fo=from_ObjOrPos, cn=curvName, gl=getLoc]
Purpose:
:: Retrieves the parameter value on a curve that is closest to a given object or position in Autodesk Maya.
Ideal for rigging and animation tasks where precision placement or movement along curves is required.
- Parameters:
from_ObjOrPos – <asNode/str/list> #Object or position from which to find the closest parameter on the curve.
curvName – <str> #Name of the curve to find the closest parameter on.
getLoc – <bool> #If True, returns a locator at the position of the closest parameter.
- Returns:
<float/asNode> #Parameter value or locator at the position of the closest parameter on the curve.
Code Examples:
>>> getClosestParam_Crv(from_ObjOrPos='pSphere1', curvName='curve1', getLoc=False)
If getLoc is FalseStart/ Retrieve Curve/ Determine Source Position/ Get Closest Position on Curve/ Calculate Parameter Value/ Create Locator at Position (Optional)End- Flow Chart Description:
This flowchart illustrates the getClosestParam_Crv function:
The process begins by retrieving the curve data from the specified curve (curvName).
It determines the source position from the given object or position (from_ObjOrPos).
The function finds the closest position on the curve to this source position.
It calculates the parameter value on the curve at this closest position.
If getLoc is True, the function creates a locator at this position on the curve.
The process ends by either returning the parameter value or the locator, based on the getLoc argument.
- EasyExp.getClosestPos_Crv(self, from_ObjOrPos, curvName, getLoc=True)#
[shArgs : from_ObjOrPos=fop, curvName=cn, getLoc=gl]
Purpose:
:: Finds the nearest position on a specified curve from a given object or position.
This function is commonly used in rigging and animation to align objects or locators to a curve.
- Parameters:
from_ObjOrPos – (<str/list>) #Source object or position from which to find the nearest point on the curve.
curvName – (<str>) #Name of the curve to calculate the nearest point on.
getLoc – (<bool>, optional) #If True, returns a locator at the nearest point. If False, returns the position coordinates.
- Returns:
If getLoc is True, returns a locator at the nearest point on the curve. If False, returns a list of position coordinates.
Code Examples:
>>> nearest_point_locator = getClosestPos_Crv('Sphere1', 'Curve1', True) # Returns a locator positioned at the nearest point on 'Curve1' from 'Sphere1'. >>> nearest_point_position = getClosestPos_Crv([1, 2, 3], 'Curve1', False) # Returns the coordinates of the nearest point on 'Curve1' from position [1, 2, 3].
Create nearestPointOnCurve nodeIf getLoc is TrueIf getLoc is FalseStart/ Get Closest Position/ Set Input Data/ Connect Curve/ Retrieve Position/ Check Return Locator/ Create Locator/ Return Position/ Return LocatorEnd- Flow Chart Description:
This flowchart illustrates the getClosestPos_Crv function:
The function begins by getting the closest position on the curve to the specified object or position.
It sets the input data for the nearest point calculation.
The curve is connected to the nearestPointOnCurve node.
The position on the curve closest to the given point is retrieved.
The function checks if a locator is required to be returned.
If getLoc is True, a locator is created at the closest position.
The closest position or the created locator is then returned.
- EasyExp.getModelFile(self)#
[shArgs : srcPath=sp, destFile=df]
Purpose:
:: Opens a file dialog to select a Maya model file and updates the specified text field with the selected file path.
This function is particularly useful in user interfaces where users need to select and load model files.
- Parameters:
srcPath – (<str>) #Initial directory path shown in the file dialog.
destFile – (<str>, output) #Path of the selected Maya model file.
- Returns:
None. Updates the ‘as_ModelFile_TF’ text field with the path of the selected file.
Code Examples:
>>> getModelFile() # Opens a file dialog for selecting a Maya model file and updates the 'as_ModelFile_TF' text field with the selected file path.
Start/ Get Source Path/ Open File Dialog/ Update PathEnd- Flow Chart Description:
This flowchart illustrates the getModelFile function:
The process begins by retrieving the source path from a text field.
An open file dialog is initiated, allowing the user to select a Maya file.
The chosen file’s path is then updated in the text field.
- EasyExp.isAttr(self, objNAttr)#
[**shArgs : oa=objNAttr]
Purpose:
:: Determines if the specified object attribute exists.
- Parameters:
objNAttr – <str> # The object and attribute in the format ‘object.attribute’.
- Returns:
<bool> # True if the attribute exists on the specified object, False otherwise.
Code Examples:
>>> attr_to_check = "myObject.myAttribute" >>> result = isAttr(attr_to_check) # Explain above code in one line
If format is 'object.attribute'If format is not 'object.attribute'If attribute existsIf attribute does not existStart/ Check Format/ Split Object & Attribute/ Return False/ Check Attribute Existence/ Return True/ Return False- Flow Chart Description:
This flowchart illustrates the isAttr function:
The function starts by checking the format of the input, ensuring it’s in the ‘object.attribute’ format.
If the format is correct, it splits the input into object and attribute components.
The function then checks if the attribute exists on the specified object, returning True if it does and False otherwise.
- EasyExp.isNum(self, obj)#
- EasyExp.locCtrl(self, ctrlName, grpLevel=1)#
[shArgs : cn=ctrlName, gl=grpLevel]
Purpose:
:: Generates a locator-like control in Autodesk Maya, customizable with control name and group level.
- Parameters:
ctrlName – <str> #Name for the locator control.
grpLevel – <int, optional> #Specifies the hierarchy level for grouping the control. Default is 1.
- Returns:
<list> #A list containing the control and its top group as Maya nodes, based on grpLevel.
Usage:
ctrl =eCtrl.locCtrl(ctrlName)[0] ctrlGrp =eCtrl.locCtrl(ctrlName)[-1] ctrl, ctrlGrp =eCtrl.locCtrl(ctrlName)
If shArgs ExistIf shArgs Does Not ExistIf shArgs ExistCreate Locator ControlCreate Control GroupApply Control ColorStart/ Check shArgs/ Parse shArgs/ Initialize Parameters/ Create Locator Control/ Create Control Group/ Apply Control Color/ End- Flow Chart Description:
This flowchart illustrates the locCtrl function:
Checks if shArgs exist and parses them if present.
Initializes parameters for control creation, including ctrlName and grpLevel.
Creates a locator-like control using the provided ctrlName.
Creates a control group based on the grpLevel.
Applies control color to the control.
- EasyExp.message(self, messageTxt)#
[**shArgs : mt=messageTxt]
Purpose:
:: Sends a given message through confirmDialog window.
Provide Argument | Description:
- Parameters:
messageTxt – (<str>) # The message to be displayed in the dialog window.
- Returns:
(<NoneType>) # No return value.
Code Examples:
>>> message("This is a sample message!")
If shArgs is providedIf shArgs is not providedDisplay message in dialogStart/ Check shArgs/ Process shArgs/ Call confirmDialogEnd- Flow Chart Description:
This flowchart illustrates the message function:
The process starts by checking if shArgs are provided and updates messageTxt if necessary.
It then calls the confirmDialog function to display the message.
- EasyExp.old_generate_HyperSkin(self, jntList=None)#
- EasyExp.old_setScale(self, ctrlGrpList, refObj=None, refAttr=None, ratio=1.0, refVal=None)#
- EasyExp.rebuildCurv(self, curvName=None)#
[**shArgs : c=curvName]
Purpose:
:: Rebuilds a curve with specified parameters.
- Parameters:
curvName – (<str>) # Optional. The name of the curve to be rebuilt. If not provided, the selected curve will be rebuilt.
- Returns:
(<str> or <NoneType>) # Returns the name of the rebuilt curve if successful, otherwise None.
Code Examples:
>>> rebuildCurv(curvName="myCurve") >>> rebuildCurv()
If CurvName is NoneIf CurvName is SpecifiedIf Curv is SelectedIf Curv is Not SelectedIf Curv ExistsIf Curv Does Not ExistStart/ Check CurvName/ Select Curv/ Get Curv From Name/ Check Selected Curv/ Get Selected Curv/ End/ Check Curv Exists/ Get Curv Shape/ Get Curv Degree/ Get Num Spans/ Rebuild Curve- Flow Chart Description:
This flowchart illustrates the rebuildCurv function:
Checks if the curvName parameter is None.
If curvName is None, selects the curve interactively.
If curvName is specified, gets the curve from the given name.
- If the curve is selected or obtained from the name:
Checks if the curve exists.
If the curve exists, gets its shape.
Retrieves the degree of the curve.
Gets the number of spans of the curve.
Rebuilds the curve with the specified parameters.
The function concludes.
- EasyExp.refreshView(self, num)#
- EasyExp.setScale(self, ctrlList=None, refObj=None, refAttr=None, ratio=1.0, refVal=None, **shortArgs)#
[**shArgs : cl=ctrlList, ro=refObj, ra=refAttr, r=ratio, rv=refVal, fi=freezeIt, us=useShape]
Purpose:
:: Adjusts the scale of a list of controls in Autodesk Maya based on a reference object or value.
Useful for dynamically scaling controls in relation to another object’s attributes or a specified value.
Offers options to freeze transformations and use shape nodes for scaling.
- Parameters:
ctrlList – <list, optional> # List of control names to be scaled. If None, uses the currently selected controls.
refObj – <str, optional> # Name of the reference object for scaling.
refAttr – <str, optional> # Name of the attribute on the reference object to use for scaling.
ratio – <float> # Ratio to apply to the reference attribute value for scaling.
refVal – <float, optional> # Direct reference value to use for scaling if no reference object is specified.
freezeIt – <bool> # Whether to freeze transformations after scaling.
useShape – <bool> # Whether to apply scaling to the shape node instead of the transform node.
- Returns:
None # Does not return a value but scales the specified controls.
Code Examples:
>>> control_list = ["ctrl1", "ctrl2"] >>> reference_object = "locator1" >>> scale_ratio = 1.5 >>> setScale(control_list, reference_object, ratio=scale_ratio) # Scales the controls in control_list based on the scale of reference_object with a ratio of 1.5.
If ctrlList is providedIf ctrlList is not providedControls selectedNo controls selectedCalculate scaling value based on provided parametersStart/ Check Inputs/ Determine Scaling/ Select ControlsError: No Controls/ Apply ScalingEnd- Flow Chart Description:
This flowchart illustrates the setScale function:
Starts by checking if a list of controls (ctrlList) is provided.
If ctrlList is provided, the function proceeds to determine the scaling value based on the provided parameters (refObj, refAttr, ratio, refVal).
If ctrlList is not provided, it prompts the user to select controls.
After determining the scaling value, the function applies the scaling to the selected controls.
The function concludes after applying the scaling or encountering an error due to no controls being selected.
- EasyExp.sortByDict(self, dictName, sortType='up', returnType='keys', sortListIndex=0, sliceDict=None, **shNames)#
[**shArgs: dn=dictName, st=sortType, rt=returnType, sli=sortListIndex, sd=sliceDict]
Purpose:
:: Sorts a dictionary by its values, with optional slicing and filtering.
:: Sorts a dictionary by its values, with optional slicing and filtering. eRig.sortedByDict({‘j1’:10, ‘j2’:2, ‘j3’:-1.0, ‘j4’:50.0, ‘j5’:0, ‘j6’:10}, ‘up’) sliceDict : None | [‘>’, val] | [‘<’, val] | [‘>=’, val] | [‘<=’, val] | [‘==’, val]
- Parameters:
dictName – (<type dict>) # Dictionary to be sorted.
sortType – (<type str, optional>) # Sorting order, ‘up’ for ascending, ‘down’ for descending. Default is ‘up’.
returnType – (<type str, optional>) # Type of return, ‘keys’ or ‘values’. Default is ‘keys’.
sortListIndex – (<type int, optional>) # Index to sort by if the value is a list. Default is 0.
sliceDict – (<type list, optional>) # Criteria to slice the dictionary. Default is None.
- Returns:
(<type list>) # Sorted list based on the specified parameters.
Code Example:
>>> dictName = {'j1':[10], 'j2':[2], 'j3':[-1.0], 'j4':[50.0], 'j5':[0], 'j6':[10]} >>> sortType = 'up' >>> returnType = 'keys' >>> sortListIndex = 0 >>> sliceDict = ['>=', 0] >>> sortByDict(dictName, sortType, returnType, sortListIndex, sliceDict) # Returns: ['j1', 'j4', 'j6', 'j5'] >>> dictName = {'a': 10, 'b': 2, 'c': -1.0, 'd': 50.0, 'e': 0, 'f': 10} >>> sortType = 'down' >>> returnType = 'values' >>> sortByDict(dictName, sortType, returnType) # Returns: [50.0, 10, 10, 2, 0, -1.0]
Arguments ProvidedSort DictStart/ Check shArgs/ Sort by Dict/ End- Flow Chart Description:
This flowchart illustrates the sortByDict function:
The function starts with the provided arguments.
It checks if arguments are provided.
It sorts the dictionary based on the specified parameters, including sorting type, return type, and slicing.
The function ends after sorting the dictionary.
- EasyExp.splitCurv(self, curvName, splitCount=1, getBothEnds=True, getLocators=False, locType=1, locPrefix='as_', **kw)#
[shArgs : curvName=n, splitCount=sc, getBothEnds=gbe, getLocators=gl, locType=lt, locPrefix=lp]
Purpose:
:: Splits a curve into specified number of segments, returning positions or locators at split points.
Facilitates the division of a spine curve into equal parts for rigging purposes.
Argument | Description :param curvName: (<str>) #Name of the curve to be split. :param splitCount: (<int>, default=1) #Number of segments to split the curve into. :param getBothEnds: (<bool>, default=True) #If True, includes both ends of the curve in the output. :param getLocators: (<bool>, default=False) #If True, returns locators at the split points. :param locType: (<int>, default=1) #Type of locator to create, if getLocators is True. :param locPrefix: (<str>, default=’as_’) #Prefix for locator names, if getLocators is True.
- Returns:
Depends on getLocators. If True, returns [position list, locator list]. Otherwise, returns position list.
Code Examples:
>>> split_positions = splitCurv('Spine_Curve', splitCount=3) # Splits 'Spine_Curve' into 3 segments, returning the positions. >>> split_positions, locators = splitCurv('Spine_Curve', splitCount=3, getLocators=True) # Splits 'Spine_Curve' into 3 segments, returning both positions and locators.
If getLocators is TrueIf getLocators is FalseIf maxValue is greater than 1.0If maxValue is less than or equal to 1.0Start/ Check Arguments/ Create Locators Group/ Determine Max Value/ Rebuild Curve/ Calculate Split Values/ Locate Split PointsEnd- Flow Chart Description:
This flowchart illustrates the splitCurv function:
The function starts by checking if getLocators is True to create a group for locators.
It then determines the maximum value of the curve.
If the maxValue is greater than 1.0, the curve is rebuilt and split points are located using the new curve.
If the maxValue is less than or equal to 1.0, the function calculates the values for splitting the curve.
The split points are located on the curve and the positions or locators of these points are returned.
- EasyExp.triangleCtrl(self, ctrlName='as_Triangle_Ctrl', grpLevel=3, initRot=[0, 0, 0], ctrlType=1, **kw)#
[shArgs : ctrlName=n, grpLevel=gl, initRot=ir, ctrlType=ct]
Purpose:
:: Creates a triangle-shaped control with customizable properties like group level, initial rotation, and control type.
Useful for rigging where triangle shapes are needed for intuitive control handles.
Allows for initial orientation and grouping for better scene organization.
Argument | Description :param ctrlName: (<str>, optional) # Name for the triangle control. Defaults to ‘as_Triangle_Ctrl’. :param grpLevel: (<int>, optional) # Number of top groups for the control. Defaults to 3. :param initRot: (<list of float>, optional) # List of three float values for initial rotation. Defaults to [0, 0, 0]. :param ctrlType: (<int>, optional) # Type of triangle control to create. Defaults to 1.
- Returns:
<list of asNodes> # Returns a list containing the control and its top group node.
Code Examples:
>>> as_EasyExpMain().triangleCtrl(ctrlName='myCtrl', grpLevel=2, initRot=[90, 0, 0], ctrlType=2) # Creates a triangle control named 'myCtrl' with 2 group levels, initial rotation of 90 degrees on X-axis, and of type 2.
If additional keyword arguments providedNo additional argumentsType 1Type 2Type 3Start/ Check Arguments/ Update Arguments/ Select Control Type/ Create Triangle Control Type 1/ Create Triangle Control Type 2/ Create Triangle Control Type 3/ Rotate and Freeze Transform/ Group Control/ Apply Control ColorEnd- Flow Chart Description:
This flowchart illustrates the triangleCtrl function:
Starts by checking if additional keyword arguments are provided, and updates arguments accordingly.
Selects the control type based on the ctrlType parameter.
Creates the triangle control based on the selected type (Type 1, 2, or 3).
Rotates and freezes the control’s transformations as per the initRot parameter.
Groups the control according to the specified grpLevel.
Applies a control color to the triangle control.
Completes the process and returns the control and its top group.