EasySnake#
- EasySnake.__init__(self)#
This tool provides various options for Snake like Rigs
as_EasySnakeMain_v1.0 About : ——- Author: (Subbaiah) Subbu Addanki, Rigging TD & Tools Developer
Visit :#
Contact :#
Mail Id: subbu.add@gmail.com, Mobile No: +91-8466086325
Copyright (c) as_EasySnakeMain_v1.0 :#
** (Subbaiah) Subbu Addanki. All Rights Reserved. **
- EasySnake._check4Author(self)#
- EasySnake._compileEasySnake(self, userFolder='$_Free_asES')#
import shutil
mayaVer =EasySnake._mayaVer() userPath =’D:/My_Scripts/$_as_EasySnake/$_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_EasySnakeMain.pyc’, ‘asNode.pyc’, ‘as_eTestMain.pyc’, ‘as_eRigMain.pyc’,
‘as_eCtrlMain.pyc’, ‘as_eSpecMain.pyc’, ‘as_eMathMain.pyc’, ]
import asNode importlib.reload(asNode) from asNode import *
from as_EasySnakeMain import * import as_EasySnakeMain importlib.reload(as_EasySnakeMain)
from as_EasySnakeMain import * import as_EasySnakeMain importlib.reload(as_EasySnakeMain)
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 *
- EasySnake._confirmAction(self, action)#
- EasySnake._isInTime(self, startDate=[2018, 1, 1], endDate=[2018, 12, 31], onlineTime=1, showDaysLeft=1, bufferTime=0)#
- EasySnake._mayaVer(self)#
- EasySnake.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.
- EasySnake.add_Selection(self, textFld)#
[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.
- EasySnake.applyCtrlColor(self, ctrlName)#
[shArgs : none]
Purpose:
:: Applies color to a control based on its name, shape, or a random color selection in Autodesk Maya.
Dynamically changes the color of a control to enhance visibility and organization within the rig.
Supports random color assignment or specific color based on the control’s shape.
Facilitates an intuitive and visually organized rig, improving the animator’s workflow.
- Parameters:
none – This function does not require direct arguments but relies on GUI inputs.
Usage Example:
>>> applyCtrlColor('ctrlName') # Applies a color to the control named 'ctrlName' based on the GUI selections.
Note: - The function reads GUI elements like checkboxes and option menus to determine the color to apply. - Make sure that the control names and GUI elements are correctly set in Maya before executing this function.
If Random ColorIf Specific ShapeStart/ Check Random Color/ Assign Random Color/ Determine Color By Shape/ Assign Color/ Set Color AttributesEnd- Flow Chart Description:
This flowchart illustrates the applyCtrlColor function:
The process begins by checking if random color is selected via a checkbox in the GUI.
If random color is selected, a random color number is assigned.
If specific shape-based color is desired, the function determines the appropriate color number based on the shape option selected in the GUI.
Once the color number is determined, it sets the control’s color attributes accordingly.
The process completes once the color attributes are set for the specified control.
- EasySnake.as_AboutEasySnake(self)#
[shArgs : none]
Purpose:
:: Displays information about the as_EasySnake plugin version 1.0 in Autodesk Maya.
Provides credits and contact information for the author, Subbaiah Subbu Addanki.
Includes links to relevant websites and contact details.
Useful for users seeking support, updates, or further information about as_EasySnake.
- Parameters:
none – This function does not require direct arguments.
Usage Example:
>>> as_AboutEasySnake() # Displays a window with information about as_EasySnake v1.0 and its author.
- Flow Chart Description:
This flowchart illustrates the as_AboutEasySnake function:
The process begins with the initialization of the information window.
The function checks if the window already exists and deletes it if necessary.
The window is then set up with sections for author information, website links, contact details, and copyright notice.
Additional details such as user-specific license information and buttons for website visitation and window closure are added.
The window is displayed and automatically closes after a specified duration.
If ExistsIf Not ExistsStart/ Check If Window Exists/ Delete Existing Window/ Setup Information Window/ Display Information Window/ Auto-Close Window After DurationEnd
- EasySnake.as_CreateEyeSetup(self)#
[shArgs : none]
Purpose:
:: Sets up a complete eye control system for a character in Autodesk Maya.
Creates eye joints and controls for both the left and right eyes.
Includes main control for both eyes, individual eye controls, and up-vector controls for aiming.
Automatically binds the geometry of the eyes to the respective joints for animation.
- Parameters:
none – This function does not require direct arguments.
Usage Example:
>>> as_CreateEyeSetup() # Sets up eye controls and joints for character rigging in Maya.
- Flow Chart Description:
This flowchart illustrates the as_CreateEyeSetup function:
The process starts with initial setup and gathering information from the user interface.
Joints for left and right eyes are created and positioned according to the geometry of the eyes.
The main control for both eyes is created and scaled appropriately.
Individual eye controls with up-vector locators are created for each eye.
The geometry of the eyes is bound to the respective joints for skinning.
The control hierarchy is organized and parented under the main control and character’s head joint.
The function completes by cleaning up the selection and refreshing the view.
Start/ Initial Setup/ Create Eye Joints/ Create Main Eye Control/ Create Individual Eye Controls/ Skin Eye Geometry/ Organize Control Hierarchy/ Cleanup and RefreshEnd
- EasySnake.as_CreateHierarchy(self)#
[shArgs : none]
Purpose:
:: Establishes the foundational rig hierarchy for a character in Autodesk Maya, including global control and main groups.
Sets up a structured and organized hierarchy crucial for efficient rigging and animation.
Creates global control and main groups like transform, joints, geometry, and IK.
Includes specific naming conventions to maintain clarity and consistency in the rig.
- Parameters:
none – This function does not require direct arguments.
Usage Example:
>>> as_CreateHierarchy() # Constructs the fundamental rig hierarchy for character animation in Maya.
- Flow Chart Description:
This flowchart illustrates the as_CreateHierarchy function:
The process starts with initializing global variables and checking authorship.
A global control is created to manage the overall character rig.
Main groups such as ‘Rig_Main’, ‘Transform’, ‘Joints’, ‘Geometry’, and ‘IK’ are established.
Parent and scale constraints are applied to link these groups with the global control.
Additional curves for jaw and spine are created and parented under the spine curve.
The hierarchy is finalized by selecting the spine curve.
Start/ Initialize Variables/ Create Global Control/ Create Main Groups/ Apply Constraints/ Create Jaw & Spine Curves/ Finalize HierarchyEnd
- EasySnake.as_CreateJawSetup(self)#
[shArgs : none]
Purpose:
:: Creates a jaw setup for a character rig in Autodesk Maya, integrating jaw movements with the head control.
Automates the creation of jaw joints and their orientation for natural jaw movement.
Ties jaw movements to head control attributes for streamlined animation control.
Enhances the rig’s functionality with a dedicated jaw setup, allowing for realistic facial expressions.
- Parameters:
none – This function does not require direct arguments.
Usage Example:
>>> as_CreateJawSetup() # Constructs and configures the jaw setup, linking it to the head control in Maya.
- Flow Chart Description:
This flowchart illustrates the as_CreateJawSetup function:
The process starts by checking authorship and initializing necessary nodes like head joint and head control.
The jaw curve is frozen to set its transformations to default.
Jaw joints are created from the jaw curve with specific naming.
The jaw joint is oriented and parented to the head joint.
Jaw attributes are added to the head control for controlling jaw movements.
The jaw curve is deleted, and the jaw setup is connected to the head control.
The process ends, leaving a functional jaw setup integrated with the head control.
Start/ Check Authorship/ Initialize Head Joint & Control/ Freeze Jaw Curve/ Create Jaw Joints/ Orient & Parent Jaw Joint/ Add Jaw Attributes to Head Control/ Connect Jaw to Head Control/ Delete Jaw CurveEnd
- EasySnake.as_CreateQuickSetup(self)#
[shArgs : none]
Purpose:
:: Facilitates the rapid setup of a spline-based rigging system in Autodesk Maya, with options for wave effects and mirroring.
Streamlines the creation of spline-based rigs, enhancing the speed and efficiency of the rigging process.
Offers additional features such as wave setup and mirroring to create more dynamic and versatile rigs.
Ideal for quickly setting up complex rigging systems for characters or objects that require flexible, spline-based movement.
- Parameters:
none – This function does not require direct arguments but uses selections and UI elements.
Usage Example:
>>> as_CreateQuickSetup() # Executes a quick spline setup based on the selected joints and UI settings.
- Flow Chart Description:
This flowchart illustrates the as_CreateQuickSetup function:
The process begins with selecting the joints for the setup.
It then applies a spline setup based on the selected joints and quick setup parameters.
Wave setup is added if specified in the UI.
The function checks for mirror setup options and applies mirroring if selected.
Adjustments are made to joint prefixes and IK curve names for mirrored setups.
The process ends with a completed quick setup of a spline rig, possibly with wave effects and mirroring applied.
If Wave Setup EnabledNo Wave SetupIf Mirror Setup EnabledNo Mirror SetupStart/ Select Joints/ Apply Spline Setup/ Check Wave Setup/ Add Wave Setup/ Check Mirror Setup/ Apply Mirror SetupEnd/ Adjust Joint Prefixes
- EasySnake.as_EasySnake(self)#
[shArgs : none]
Purpose:
:: Launches the EasySnake tool’s user interface in Autodesk Maya, providing a graphical platform for creating and managing snake-like rigging setups.
Introduces a user-friendly interface to simplify the process of creating snake-like rigs.
Facilitates the creation of spline IK setups, allowing for flexible, snake-like movement in rigged models.
Enhances the rigging workflow by offering a dedicated toolset for specific rigging requirements of snake-like characters or objects.
Usage Example:
>>> as_EasySnake() # Launches the EasySnake tool's user interface for rigging snake-like objects.
- Flow Chart Description:
This flowchart outlines the as_EasySnake function:
The function starts by invoking the about section of EasySnake to display credits and tool information.
It checks if the EasySnake window is already open and closes it to avoid duplicates.
The tool attempts to load the user interface from a predefined path. If the primary path fails, alternative paths are tried.
Once the user interface is successfully loaded, it is displayed on the screen.
The function sets up a popup menu for additional options like attaching objects to a path.
The process completes with the EasySnake tool interface ready for user interaction.
If OpenNot OpenTry Primary PathIf Primary Path FailsStart/ Display EasySnake Credits/ Check if Window Open/ Close Existing Window/ Load UI/ Load Successful/ Try Alternate Paths/ Show EasySnake Window/ Setup Popup MenuEnd
- EasySnake.as_FinalizeSetup(self)#
[shArgs : none]
Purpose:
:: Finalizes the snake rig setup in Autodesk Maya by locking control attributes and hiding non-essential nodes like IKs and curves.
Locks visibility and scale attributes on all controls to prevent accidental modifications.
Hides technical nodes like IK handles, curves, and joint groups to maintain a clean and user-friendly rig environment.
Essential for delivering a polished and animator-friendly rig, ensuring a focus on key animation controls.
Usage Example:
>>> as_FinalizeSetup() # Executes the final cleanup and lock-down of the snake rig, preparing it for animation.
- Flow Chart Description:
This flowchart outlines the as_FinalizeSetup function:
The process begins by identifying and selecting all control nodes in the rig.
Locks visibility and scale attributes on the selected controls to prevent unintended changes.
Searches for IK handles, curves, clusters, and joint groups in the rig.
Hides these technical nodes to streamline the animator’s workspace.
The process concludes with a clean, animator-friendly rig, ready for animation.
Start/ Select All Controls/ Lock Control Attributes (Visibility & Scale)/ Find Technical Nodes/ Hide IKs, Curves, ClustersEnd
- EasySnake.as_RebuildSpineSetup(self)#
[shArgs : none]
Purpose:
:: Rebuilds the spine setup in an existing Autodesk Maya rig, including renaming, skinning transfer, and cleanup.
Renames and reorganizes spine joints and controls with a new prefix for clarity and consistency.
Transfers skinning from original joints to new spine setup, maintaining the character’s deformation quality.
Cleans up the scene by removing old joints, controls, and unnecessary nodes, ensuring a tidy rig environment.
Usage Example:
>>> as_RebuildSpineSetup() # Initiates the process of rebuilding the spine setup in the rig.
- Flow Chart Description:
This flowchart outlines the steps in the as_RebuildSpineSetup function:
The function starts with a user confirmation to proceed with the rebuilding process.
Renames and reorganizes spine-related joints and controls, including COG, neck, tail, and chest joints.
Transfers skinning from old joints to the newly created spine joints.
Cleans up the rig by deleting old joints, controls, IK handles, and groups.
Completes with a confirmation message indicating successful rebuild of the spine setup.
YesNoStart/ User Confirmation/ Rename and Reorganize Spine Elements/ Terminate Action/ Transfer Skinning/ Cleanup Rig/ Confirmation MessageEnd
- EasySnake.as_SmoothMesh(self)#
[shArgs : none]
Purpose:
:: Automates the smoothing of skin weights on a mesh in Autodesk Maya, enhancing the deformation quality for animation.
Streamlines the process of smoothing skin weights, making it less time-consuming and more efficient.
Applies an even distribution of skin weights across the geometry, improving the mesh’s deformation during animation.
Utilizes Maya’s Artisan brush tools for precision and control in the smoothing process.
Usage Example:
>>> as_SmoothMesh() # Smooths the skin weights of the selected geometry in the scene.
- Flow Chart Description:
This flowchart explains the as_SmoothMesh function:
The function initiates with the selection of geometry (mesh) in the scene.
It identifies the skinCluster associated with the selected mesh.
The Artisan brush tool is set up with specific settings for smoothing skin weights.
The skin weights are smoothed in a forward direction, iterating over each influence object (joint).
The process is repeated in the reverse direction for a thorough smoothing effect.
The progress of smoothing is visually displayed through a progress bar.
Once completed, the selected geometry is reselected, and the function concludes.
Geometry SelectedStart/ Select Geometry/ Identify Skin Cluster/ Setup Artisan Brush/ Smooth Forward Direction/ Progress Bar Forward/ Smooth Reverse Direction/ Progress Bar Reverse/ Reselect GeometryEnd
- EasySnake.as_SnakeSkin(self)#
[shArgs : none]
Purpose:
:: Executes the skin binding process on a snake model in Autodesk Maya, attaching the geometry to a skeleton for animation.
Facilitates the process of binding the snake’s skin (geometry) to its skeletal joints, essential for realistic animation.
Ensures that the geometry deforms correctly according to the underlying joint movements.
Simplifies the skinning process by automating the selection and binding steps.
Usage Example:
>>> as_SnakeSkin() # Binds the selected joints to the specified snake mesh in the scene.
- Flow Chart Description:
This flowchart outlines the as_SnakeSkin function:
The function begins by verifying the authorship of the script.
It then retrieves the list of joints selected in the scene, representing the snake’s skeleton.
The skin mesh (snake’s body geometry) is identified based on the user input from the GUI.
A check is performed to ensure the specified skin mesh exists in the scene.
If the mesh exists, it’s selected along with the joints.
The Maya built-in Smooth Bind Skin command is executed to bind the skin mesh to the joints.
The function reselects the joints, concluding the skinning process.
VerifiedMesh ExistsMesh Not FoundStart/ Check Authorship/ Retrieve Joints/ Identify Skin Mesh/ Select Joints & Mesh/ Display Error/ Execute Skin Binding/ Reselect JointsEnd
- EasySnake.as_SplineSetup(self, jntPrefix=0, ctrlDir=0, ctrlType=0, ctrlParent=0, ctrlShape=0, numJnts=0, numCtrls=0, secAxis=0, secAxisWorld=0, flexAtEnds=0, quickSetup=False, ikCurv=None, **shArgs)#
[shArgs : jp=jntPrefix, cd=ctrlDir, ct=ctrlType, cp=ctrlParent, cs=ctrlShape, nj=numJnts, nc=numCtrls, sa=secAxis, saw=secAxisWorld, fae=flexAtEnds, ikc=ikCurv]
Purpose:
:: Constructs a spline IK setup for a series of joints in Autodesk Maya, typically used for animating flexible structures like spines or tails.
Provides a comprehensive tool to create an IK spline setup, allowing for flexible and smooth deformations along a curve.
Supports customization of control direction, type, parenting, and the number of joints and controls.
Essential for creating advanced rigs in character animation, enhancing the animator’s control over the movement.
- Parameters:
jntPrefix – <str> #Prefix to name the joints created in the setup.
ctrlDir – <str> #Direction for the control orientation (e.g., ‘X-Dir’, ‘Y-Dir’).
ctrlType – <str> #Type of control to create (e.g., ‘Circle’, ‘Square’).
ctrlParent – <str> #Parenting method for the controls (e.g., ‘Individual’, ‘Parent Chain’).
ctrlShape – <str> #Shape of the control curve (e.g., ‘Circle’, ‘Arrow Head’).
numJnts – <int> #Number of joints to be created along the spline.
numCtrls – <int> #Number of controls to manage the spline.
secAxis – <str> #Secondary axis for joint orientation (e.g., ‘x’, ‘y’, ‘z’).
secAxisWorld – <str> #Secondary world axis for joint orientation.
flexAtEnds – <bool> #Whether to allow flexibility at the ends of the spline.
quickSetup – <bool> #Enables quick setup mode.
ikCurv – <PyNode> #The IK curve used in the setup.
Usage Example:
>>> as_SplineSetup(jntPrefix='spine', ctrlDir='Y-Dir', ctrlType='Circle', ctrlParent='Parent Chain', numJnts=5, numCtrls=3) # Creates a spline IK setup for a spine with specific parameters.
- Flow Chart Description:
This flowchart details the as_SplineSetup function:
The function initiates by checking for selected objects in the scene.
Determines if the selected object is a curve or joint for the IK setup.
Based on the selection, it either creates joints along a curve or uses the selected joints.
Constructs an IK handle and curve for the spline setup.
Generates controls for the IK handle, positioning and orienting them based on the user’s preferences.
Optionally creates an FK on IK setup for additional control over the rig.
Locks unnecessary attributes on the controls to simplify the animator’s workflow.
If a mesh is selected, identifies the closest mesh to the setup for potential skinning.
Curve SelectedJoint SelectedIf EnabledIf DisabledStart/ Check Selection/ Create Joints on Curve/ Use Selected Joints/ Construct IK Handle/ Generate Controls/ Optional FK on IK Setup/ Create FK on IK/ Lock Control Attributes/ Identify Closest MeshEnd
- EasySnake.as_WaveSetup(self, suffix='_LR', quickSetup=0, waveDir=[0, 0, 0])#
[shArgs : none]
Purpose:
:: Creates a dynamic wave setup on a spline IK curve in Autodesk Maya, typically used for simulating wave-like motion along rigs such as tails, tentacles, or spine.
Enables the animation of wave-like motions along a spline IK setup with customizable parameters.
Provides control over wave height, length, and style through user interface elements or specified parameters.
Ideal for animating organic, fluid movements in character rigs.
- Parameters:
suffix – <str> #Suffix to identify the specific wave setup (e.g., ‘_LR’ for left-right wave).
quickSetup – <bool> #If set to True, enables a quicker setup with default settings.
waveDir – <list> #The direction of the wave motion, specified as a list of three values for rotation.
Usage Example:
>>> as_WaveSetup(suffix='_LR', quickSetup=True, waveDir=[0, 90, 0]) # Sets up a left-right wave motion on the selected IK spline curve.
- Flow Chart Description:
This flowchart outlines the as_WaveSetup function:
Starts by identifying the animation control and IK curve from the user interface.
Retrieves and sets various wave parameters like wave height, length, and style.
Creates or identifies a duplicate wave curve based on the original IK curve.
Constructs sine and flare handles to manipulate the wave motion on the curve.
Sets driven keyframes to control wave properties from the main animation control.
Optionally blends the wave curve with the IK curve for smooth transitions.
Configures the direction and initial values for the wave motion based on input parameters.
Completes by setting visibility and parenting for a clean and organized setup.
If ExistsIf Not ExistsIf NecessaryIf Not RequiredStart/ Identify Control & Curve/ Retrieve Wave Parameters/ Check for Duplicate Curve/ Use Existing Curve/ Create Duplicate Curve/ Construct Sine Handle/ Construct Flare Handle/ Setup Driven Keyframes/ Blend Curves/ Perform Blend/ Set Wave Direction/ Finalize SetupEnd
- EasySnake.attrDivider(self, animCtrl)#
[shArgs : none]
Purpose:
:: Creates a visual divider in the attribute editor for an animation control in Autodesk Maya, enhancing the organization of custom attributes.
Streamlines the attribute editor by visually separating groups of attributes, making it easier to navigate.
Automatically finds an appropriate number of underscores to use as a divider based on existing attributes.
Improves the clarity and usability of custom controls with multiple attributes.
- Parameters:
animCtrl – <PyNode> #The animation control to which the attribute divider will be added.
Usage Example:
>>> attrDivider(animCtrl) # Adds a divider attribute to the specified animation control.
Note: - This function is typically used when creating custom rig controls to organize numerous attributes. - It searches for the right number of underscores to ensure the divider is unique and doesn’t clash with existing attributes.
- Flow Chart Description:
The flowchart for the attrDivider function:
Starts by identifying the animation control provided as an input.
Iterates through a range of numbers to determine the appropriate length for the divider.
Checks if a divider with the current number of underscores already exists on the control.
If not, creates a new attribute on the control with the determined number of underscores as its name.
Locks the newly created divider attribute to prevent accidental modifications.
Completes the process, leaving the control with a neatly organized attribute editor.
If ExistsIf Not ExistsStart/ Identify Animation Control/ Iterate Through Numbers/ Check for Existing Divider/ Create Divider Attribute/ Lock Divider AttributeEnd
- EasySnake.copyAndAttachAlongPath(self, objToAttach='', pathCurve='', aimAxis=None, upAxis='Y', numObjs=0, prefix='as_')#
[shArgs : none]
Purpose:
:: Duplicates and attaches an object along a specified path curve in Autodesk Maya, evenly spacing the duplicates.
Useful for creating effects like objects following a path, chain links, or repeated patterns along a curve.
Provides control over the number of duplicates and their alignment with the path.
Automatically adjusts the spacing based on the length of the path and the size of the object.
- Parameters:
objToAttach – <str> #The name of the object to be duplicated and attached to the path.
pathCurve – <str> #The name of the curve path to which the objects will be attached.
aimAxis – <str, optional> #The axis along which the objects will aim while following the path.
upAxis – <str, optional> #The world up direction axis for the attached objects.
numObjs – <int, optional> #The number of objects to create along the path. If not provided, it’s calculated based on the object’s size and curve length.
prefix – <str, optional> #Prefix for naming the created nodes.
Usage Example:
>>> copyAndAttachAlongPath(objToAttach='sphere1', pathCurve='curve1', aimAxis='X', upAxis='Y', numObjs=10, prefix='dup_') # Attaches 10 duplicates of 'sphere1' along 'curve1', aiming along the X-axis and using Y-axis as the up direction.
Note: - The function requires an object and a path curve to be specified or selected in Maya. - If the number of objects is not specified, it calculates based on the length of the curve and the size of the object.
- Flow Chart Description:
The flowchart for the copyAndAttachAlongPath function:
Checks if the object to attach and the path curve are specified or selected.
Determines the aim and up axis based on user input or default settings.
Calculates the number of objects to create and their spacing along the path.
Duplicates the object and creates a path animation for each duplicate.
Aligns the duplicates along the path, ensuring even distribution.
Connects any additional attributes like banking for dynamic motion along the path.
Returns a list of all created objects.
If Not ProvidedIf ProvidedStart/ Check Inputs/ Select Objects/ Calculate Object Spacing/ Duplicate & Attach Objects/ Align Objects on Path/ Connect Additional Attributes/ Return List of ObjectsEnd
- EasySnake.create_BoundJntSetup(self)#
[shArgs : none]
Purpose:
:: Creates a duplicate joint setup for bounding purposes in Autodesk Maya, facilitating dynamic motion and deformation.
Efficient for setting up bounding joints in rigs, particularly useful in complex animations.
Helps in maintaining volume and structure during deformation, enhancing the rig’s realism.
The setup involves duplicating, renaming, and reorganizing joints for bounding.
- Parameters:
none – This function does not require direct arguments.
Usage Example:
>>> create_BoundJntSetup() # Duplicates the joint setup, renames, and reorganizes joints for bounding purposes.
Note: - Ensure that the original joint chain is properly set up and named before executing this function. - The function automatically handles renaming and re-parenting of duplicated joints for bounding.
- Flow Chart Description:
The flowchart for the create_BoundJntSetup function:
Starts by duplicating the top joint of the selected joint chain.
Renames the duplicated joints for bounding purposes.
Reparents the joints to a new group named ‘Bound_Jnt_Grp’.
Iterates through all joints, setting up their pivot and creating constraints.
Applies orient and point constraints to the duplicated joints for dynamic motion.
Refreshes the view to update the Maya scene with the new joint setup.
Start/ Duplicate Top Joint/ Rename Joints/ Create 'Bound_Jnt_Grp'/ Reparent Joints/ Iterate through Joints/ Apply Constraints/ Refresh ViewEnd
- EasySnake.create_FullStretchPathAnim(self)#
[shArgs : none]
Purpose:
:: Creates a full stretch path animation for a control list, allowing each control to follow a path in Autodesk Maya.
This function is useful for animating a series of controls along a path, ensuring they stretch and conform to the path’s length.
It calculates the distance each control should be from the start of the path based on the total length of the control chain.
Particularly effective for rigging and animating snake-like or chain-like structures.
- Parameters:
none – This function does not require direct arguments.
Usage Example:
>>> create_FullStretchPathAnim() # Applies a full stretch path animation to a predefined list of controls.
Note: - The control list should be properly defined and ordered before executing this function. - The path for the animation should be a well-defined curve in the scene. - Each control in the list is attached to the path, maintaining a consistent distribution along the length of the path.
- Flow Chart Description:
The flowchart for the create_FullStretchPathAnim function:
Starts by calculating the total length of the snake or chain using the control list.
Iterates through each control in the list (except the first control).
Calculates the relative position (uValue) of each control along the path based on its distance from the start.
Applies a motion path animation to each control, setting its position on the path.
Breaks initial connections to the uValue attribute, allowing manual control.
Displays a success message with the time taken to execute the function.
Start/ Calculate Total Length/ Iterate Controls/ Calculate Control Position/ Apply Motion Path Animation/ Break Initial Connections/ Display Success MessageEnd
- EasySnake.create_NonStretchPathAnim(self, aimDir)#
[shArgs: ad=aimDir]
Purpose:
:: Creates a non-stretch path animation in Autodesk Maya, aligning a series of controls along a motion path without stretching.
Configures each control on the path based on its distance from the start, maintaining consistent spacing.
Ensures the controls move along the path as a single unit, like a chain, preserving the original distances between them.
Enhances rigging and animation workflows by providing a method to animate objects along a path without distorting their spacing.
- Parameters:
aimDir – <str> #Direction for the aim constraint in the path animation setup.
- Returns:
None #This function does not return any value but applies changes directly in Maya.
Usage Example:
>>> as_NonStretchPathAnim(aimDir='x') # Sets up a non-stretch path animation with the specified aim direction in the x-axis.
Note: - This function assumes that the global variables and the motion path (‘mPath’) are already defined and accessible. - It modifies the properties of each control in the ‘ctrlList’ to align them on the ‘mPath’ without stretching.
- Flow Chart Description:
Initialize global variables.
Loop through each control in ‘ctrlList’, skipping the first control.
For each control, calculate the distance to the first control and add custom attributes.
Create a motion path animation for each control and modify attributes to prevent stretching.
Connect the last control’s motion path to other controls to ensure they follow without stretching.
- EasySnake.create_PathAnimRig(self)#
[shArgs: ad=aimDir]
Purpose:
:: Establishes a path animation rig in Autodesk Maya, allowing a series of controls to follow a defined path.
Facilitates the animation of objects along a path with options for stretching and non-stretching movement.
Supports custom configurations for the up vector and control direction, enhancing control over the animation.
Enables the creation of complex motion paths for rigging and animation, improving the versatility of the rig.
Argument | Description :param aimDir: <str> #Direction for the aim constraint in the path animation setup.
- Returns:
None #This function does not return any value but configures a path animation rig in Maya.
Usage Example:
>>> create_PathAnimRig(aimDir='x') # Creates a path animation rig with the specified aim direction along the x-axis.
Note: - This function assumes that the global variables such as ‘mPath’, ‘animCtrl’, and ‘ctrlList’ are already defined and accessible. - It modifies the properties and setups based on the selected controls and the path, providing various animation possibilities.
If Path ExistsIf Path Does Not ExistIf Anim Control ExistsIf Anim Control Does Not ExistNon-StretchStretch Along PathFull StretchStart/ Initialize Variables/ Check if Path Exists/ Check if Animation Control Exists/ Error: Path Not Found/ Determine World Direction/ Error: Animation Control Not Found/ Determine Control Direction/ Calculate Chain and Path Lengths/ Add Custom Attributes to Animation Control/ Select Stretch Option/ Setup Non-Stretch Animation/ Setup Stretch Along Path Animation/ Setup Full Stretch Animation/ Set Controls to Follow PathEnd- Flow Chart Description:
This flowchart illustrates the create_PathAnimRig function:
The process starts by initializing global variables such as the motion path, animation control, and control list.
It checks if the specified path and animation control exist.
Determines the world and control directions based on GUI options.
Calculates the chain and path lengths for the animation setup.
Adds custom attributes to the animation control for path animation management.
Depending on the selected stretch option (non-stretch, stretch along path, or full stretch), it sets up the corresponding path animation.
Configures the controls in ‘ctrlList’ to follow ‘mPath’ based on the chosen animation style.
- EasySnake.create_StretchAlongPathAnim(self)#
[shArgs : mp=mPath, ac=animCtrl, uv=upVec, wua=wUpAxis, ad=aimDir, an=arclenNode, pl=pathLength, cl=ctrlList, fc=firstCtrl, lc=lastCtrl, chl=chainLength, rs=rangeSt, re=rangeEnd]
Purpose:
:: Creates a stretch along path animation for controls in Autodesk Maya.
Ideal for rigging scenarios where stretching along a motion path is required.
Provides a dynamic and adjustable animation setup for complex rigging systems.
- Parameters:
mPath – <PyNode> # The motion path node for the animation.
animCtrl – <PyNode> # The main control node for the animation.
upVec – <tuple> # The up vector for the path animation.
wUpAxis – <str> # The world up axis for the path animation.
aimDir – <str> # The aim direction for the path animation.
arclenNode – <PyNode> # The arc length node of the motion path.
pathLength – <float> # The total length of the motion path.
ctrlList – <list> # List of control nodes to be animated along the path.
firstCtrl – <PyNode> # The first control in the control list.
lastCtrl – <PyNode> # The last control in the control list.
chainLength – <float> # The total length of the control chain.
rangeSt – <float> # Start range for the animation control.
rangeEnd – <float> # End range for the animation control.
- Returns:
None # This function does not return any value but sets up the animation.
Code Examples:
>>> mPath = "motionPathNode" >>> animCtrl = "mainControl" >>> create_StretchAlongPathAnim(mPath, animCtrl) # Sets up a stretch along path animation for specified controls.
For Each ControlIf Not First ControlIf First ControlStart/ Initialize Variables/ Reverse Control List/ Process Controls/ Check if First Control/ Calculate Control Distance/ Add Custom Attributes to Control/ Setup Motion Path Animation/ Setup First Control Motion Path/ Setup Stretch Calculations/ Connect Travel PositionEnd- Flow Chart Description:
This flowchart illustrates the create_StretchAlongPathAnim function:
The process starts by initializing necessary variables and reversing the control list.
- Each control is then processed:
If it’s not the first control, its distance from the first control is calculated.
Custom attributes are added to the control for managing its position and stretch along the path.
Sets up motion path animation for each control, based on the stretch calculations.
For the first control, a separate motion path is set up.
The travel position is connected to manage the control’s position along the path.
The process concludes after setting up the motion path for all controls.
- EasySnake.delete_PathAnim(self)#
[shArgs : pg=pathGrp, lg=locGrp]
Purpose:
:: Deletes path animation setup in Autodesk Maya.
Useful for cleaning up or resetting animation setups.
Ensures a safe removal of specific path animation components from the scene.
- Parameters:
pathGrp – <str> # Group containing the path animation nodes.
locGrp – <str> # Group containing locator nodes related to the path animation.
- Returns:
None # This function does not return any value but removes specific animation setup.
Code Examples:
>>> delete_PathAnim() # Prompts for confirmation and deletes the path animation setup if confirmed.
Deletion ConfirmedPath Animation RemovedDeletion CancelledStart/ Confirm Deletion/ Delete Animation Setup/ End- Flow Chart Description:
This flowchart illustrates the delete_PathAnim function:
The function starts and prompts the user for confirmation to delete the path animation setup.
If deletion is confirmed, it proceeds to delete the path animation setup.
If deletion is cancelled, the process ends without making any changes.
The function completes once the path animation setup is deleted or the deletion is cancelled.
- EasySnake.error(self, errorMsg)#
[shArgs : em=errorMsg]
Purpose:
:: Displays an error message through a confirmation dialog window and raises a RuntimeError after the dialog is closed.
- Parameters:
errorMsg – (<str/list>) # The error message to be displayed. If a list is provided, it is joined into a single string.
- Returns:
None
Code Examples:
>>> error('An error occurred!') After closing the window, RuntimeError will be raised
If shArgs ExistIf shArgs Does Not ExistStart/ Check shArgs/ Parse shArgs/ Initialize Parameters/ Display Dialog/ Raise Error/ End- Flow Chart Description:
This flowchart illustrates the error function:
Checks if shArgs exist, and if so, parses the error message from it.
If shArgs do not exist, initializes the error message parameter.
Displays the error message in a dialog window.
Raises a RuntimeError with the error message after the dialog window is closed.
Ends the process.
- EasySnake.globalCtrl(self, ctrlName)#
[**shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType]
Purpose:
:: Creates a global control in Autodesk Maya, offering options for control name, group level, and control type.
Useful for setting up master controls in rigging.
Customizable for various rigging and animation needs.
- Parameters:
ctrlName – <str> # Name for the global control.
grpLevel – <int, optional> # Hierarchy level for grouping the control. Default is 1.
ctrlType – <int, optional> # Type of global control to be created. Default is 1.
- Returns:
<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.
Code Examples:
>>> control_name = "globalCtrl" >>> group_level = 2 >>> control_type = 1 >>> global_control = globalCtrl(control_name, group_level, control_type) # Creates a global control with specified parameters.
Input ProvidedNo InputStart/ Check Inputs/ Create Global Control/ Group Control/ Apply ColorEndError- Flow Chart Description:
This flowchart illustrates the globalCtrl function:
The function starts by checking if all necessary inputs like control name, group level, and control type are provided.
If inputs are provided, it creates a global control with the specified parameters.
The control is then grouped according to the hierarchy level specified.
Color is applied to the control for visual differentiation.
The function ends after successfully creating and configuring the global control.
If any inputs are missing, an error is indicated.
- EasySnake.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.
- EasySnake.openPythonScripting(self)#
[shArgs : none]
Purpose:
:: Opens the Python Scripting website in a web browser from Autodesk Maya.
Enhances accessibility by providing a quick way to visit the Python Scripting resource directly from within Maya.
Useful for users who want to access additional scripting resources, tutorials, or support.
- Returns:
None # This function does not return any value but opens a web browser to a specified URL.
Code Examples:
>>> openPythonScripting() # Opens the Python Scripting website in the user's default web browser.
Author VerifiedWebsite OpenedStart/ Check Author/ Open Python Scripting Website/ End- Flow Chart Description:
This flowchart illustrates the openPythonScripting function:
The function begins and checks if the author is verified.
Upon verification, it opens the Python Scripting website in the user’s default web browser.
The function completes after the website is opened.
- EasySnake.removePathAnimAttrs(self)#
[shArgs : none]
Purpose:
:: Removes specific custom attributes related to path animation from selected animation controls in Autodesk Maya.
This function is useful for cleaning up animation controls by removing attributes that were previously added for path animation.
Helps maintain a tidy and efficient workspace by eliminating unnecessary attributes from animation controls.
- Returns:
None # This function does not return any value but modifies the selected objects by removing specified attributes.
Code Examples:
>>> removePathAnimAttrs() # Removes specific path animation attributes from the selected animation controls.
Controls SelectedAttributes RemovedStart/ Check Selected Controls/ Remove Attributes/ End- Flow Chart Description:
This flowchart illustrates the removePathAnimAttrs function:
The function starts by checking if any animation controls are selected.
It then proceeds to remove specific attributes related to path animation from the selected controls.
The function completes after the attributes are removed.
- EasySnake.shapeCtrl(self, shapeObj, trgt)#
[shArgs: so=shapeObj, t=trgt, sa=shapeAdd, rn=reName, ds=deleteShape, cn=ctrlName]
Purpose:
:: Facilitates the creation or modification of control shapes in Autodesk Maya, utilizing a source shape and various customization options.
Streamlines the process of control creation in rigging, allowing for the reuse of existing shapes.
Provides flexibility in shaping controls, catering to specific rigging requirements.
- Parameters:
shapeObj – <Maya node, optional> # The source object from which the shape is derived.
trgt – <Maya node, optional> # The target object to which the shape will be added or modified.
shapeAdd – <bool, optional> # Determines if the shape should be added to the target object. Default is True.
reName – <bool, optional> # Flag to rename the control after shape modification. Default is False.
deleteShape – <bool, optional> # Specifies whether to delete the original shape after modification. Default is True.
ctrlName – <str, optional> # Name for the control to be created or modified.
- Returns:
None # The shape of the target control is modified or created based on the specified options.
Code Examples:
>>> source_shape = "curveShape1" >>> target_object = "ctrl1" >>> shapeCtrl(shapeObj=source_shape, trgt=target_object, shapeAdd=True, reName=True, deleteShape=False, ctrlName="newCtrl") # Modifies the shape of 'ctrl1' using 'curveShape1', renames it to 'newCtrl', without deleting the original shape. >>> shapeCtrl(shapeObj="shape2", trgt="joint1") # Adds the shape from 'shape2' to 'joint1', keeping the default options.
shArgs providedshArgs not providedBoth shapeObj and trgt providedEither not providedIf target has shapesNo shapes in targetdeleteShape is TruedeleteShape is FalseStart/ Check shArgs/ Update Arguments/ Check Shape and Target/ Check Control Name/ Select Shape and Target/ Get Shape Nodes/ Apply Color to Shape Object/ Check Target Shapes/ Make Identity on ShapeObj/ Parent Shape to Target/ Check Delete Shape/ Delete Original Shapes/ Set Shape Visibility/ Rename ControlEnd- Flow Chart Description:
This flowchart illustrates the shapeCtrl function:
The process begins by checking if shArgs are provided. If so, it updates the arguments.
If shapeObj and trgt are not provided, the function selects them manually.
It then checks if a control name is provided, if not, the default name of the shape object is used.
The function retrieves the shape nodes from the shape object and applies color to them.
It checks if the target has existing shapes and makes identity on the shape object if required.
The shape nodes are parented to the target object.
Based on the deleteShape flag, it either deletes the original shapes or sets their visibility.
If reName is True, the target control is renamed.
The function ends after modifying the shape of the target control.
- EasySnake.splineCtrl(self, ctrlName, ctrlType, ctrlShape='Circle')#
[shArgs : none]
Purpose:
:: Creates control shapes for spline rigging in Autodesk Maya, offering different shape options like Circle, Snake, Gold Ring, One Pin, and Arrow Head.
A versatile function designed to generate various control shapes used in rigging and animation within Maya.
It allows customization of control size and type, aiding in the creation of tailored rigging setups for different needs.
- Parameters:
ctrlName – <str> # The name for the control shape to be created.
ctrlType – <str> # Type of control, such as ‘Grouped’ or other specified types.
ctrlShape – <str> # The shape of the control, with options like ‘Circle’, ‘Snake’, ‘Gold Ring’, ‘One Pin’, and ‘Arrow Head’. Default is ‘Circle’.
ctrlSize – <float> # The size of the control, adjustable via a text field in the Maya UI.
- Returns:
<str or PyNode> # Returns the name or PyNode of the created control or control group, depending on the control type.
Code Examples:
>>> splineCtrl('myControl', 'Grouped', 'Circle') # Creates a grouped circle control named 'myControl'. >>> splineCtrl('snakeControl', 'Single', 'Snake') # Creates a single snake-shaped control named 'snakeControl'.
Parameters ValidatedControl Shape CreatedTransformations AppliedControl ReturnedStart/ Check Parameters/ Create Control Shape/ Apply Transformations/ Return Control/ End- Flow Chart Description:
This flowchart illustrates the splineCtrl function:
The function starts by validating the provided parameters.
It then creates the specified control shape based on the given shape type and name.
Applies necessary transformations like scaling and making identity.
Returns the created control or control group depending on the control type.