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 :#

http://www.pythonscripting.com

Contact :#

Mail Id: subbu.add@gmail.com, Mobile No: +91-8466086325

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
graph TB Start[("fa:fa-play Start")] --> CheckSelection{"/fas:fa-mouse-pointer Check Object Selection"} CheckSelection --"If Object is Selected"--> ExtractPrefix["/fas:fa-pen Extract Prefix"] CheckSelection --"If No Object is Selected"--> ClearField["/fas:fa-eraser Clear Field"] ExtractPrefix --> UpdateField["/fas:fa-pencil-alt Update Field"] ClearField --> End["/fas:fa-stop End"] UpdateField --> End style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckSelection fill:#ffcc99,stroke:#000,stroke-width:2px style ExtractPrefix fill:#99ccff,stroke:#000,stroke-width:2px style ClearField fill:#ff9999,stroke:#000,stroke-width:2px style UpdateField fill:#ccffcc,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the add_Prefix function:

  1. The process begins by checking if a Maya object is selected.

  2. If an object is selected, the function extracts the prefix from its name.

  3. The extracted prefix is then used to update the specified text field.

  4. If no object is selected, the function clears the specified text field.

  5. 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
graph TB Start[("fa:fa-play Start")] --> CheckSelection{"/fas:fa-mouse-pointer Check Object Selection"} CheckSelection --"If Objects are Selected"--> DetermineSelectionType{"/fas:fa-list-ul Determine Selection Type"} CheckSelection --"If No Objects are Selected"--> ClearField["/fas:fa-eraser Clear Field"] DetermineSelectionType --"If Multi-Select is True"--> ConcatenateNames["/fas:fa-stream Concatenate Object Names"] DetermineSelectionType --"If Multi-Select is False"--> AddSingleName["/fas:fa-plus-circle Add Single Object Name"] ConcatenateNames --> UpdateField["/fas:fa-pencil-alt Update Field"] AddSingleName --> UpdateField ClearField --> End["/fas:fa-stop End"] UpdateField --> End style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckSelection fill:#ffcc99,stroke:#000,stroke-width:2px style DetermineSelectionType fill:#99ccff,stroke:#000,stroke-width:2px style ConcatenateNames fill:#ccffcc,stroke:#000,stroke-width:2px style AddSingleName fill:#cc99ff,stroke:#000,stroke-width:2px style UpdateField fill:#ff9999,stroke:#000,stroke-width:2px style ClearField fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the add_Selection function:

  1. The process starts by checking if objects are selected in Maya.

  2. If objects are selected, it determines if multiple selections are allowed.

  3. If multiple selections are allowed, it concatenates the names of all selected objects.

  4. If only a single selection is allowed, it adds the name of the first selected object.

  5. The selected object names are then added to the specified text field.

  6. If no objects are selected, the function clears the specified text field.

  7. 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.

graph TB Start[("fa:fa-play Start")] --> CheckRandomColor{"/fas:fa-question-circle Check Random Color"} CheckRandomColor --"If Random Color"--> AssignRandomColor["/fas:fa-palette Assign Random Color"] CheckRandomColor --"If Specific Shape"--> DetermineColorByShape{"/fas:fa-shapes Determine Color By Shape"} DetermineColorByShape --> AssignColor["/fas:fa-tint Assign Color"] AssignRandomColor --> SetColorAttributes["/fas:fa-sliders-h Set Color Attributes"] AssignColor --> SetColorAttributes SetColorAttributes --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckRandomColor fill:#ffcc00,stroke:#000,stroke-width:2px style AssignRandomColor fill:#99ccff,stroke:#000,stroke-width:2px style DetermineColorByShape fill:#99ccff,stroke:#000,stroke-width:2px style AssignColor fill:#cc99ff,stroke:#000,stroke-width:2px style SetColorAttributes fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the applyCtrlColor function:

  1. The process begins by checking if random color is selected via a checkbox in the GUI.

  2. If random color is selected, a random color number is assigned.

  3. If specific shape-based color is desired, the function determines the appropriate color number based on the shape option selected in the GUI.

  4. Once the color number is determined, it sets the control’s color attributes accordingly.

  5. 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:

  1. The process begins with the initialization of the information window.

  2. The function checks if the window already exists and deletes it if necessary.

  3. The window is then set up with sections for author information, website links, contact details, and copyright notice.

  4. Additional details such as user-specific license information and buttons for website visitation and window closure are added.

  5. The window is displayed and automatically closes after a specified duration.

graph TB Start[("fa:fa-play Start")] --> CheckWindowExists{"/fas:fa-window-maximize Check If Window Exists"} CheckWindowExists --"If Exists"--> DeleteExistingWindow["/fas:fa-window-close Delete Existing Window"] DeleteExistingWindow --> SetupWindow["/fas:fa-window-restore Setup Information Window"] CheckWindowExists --"If Not Exists"--> SetupWindow SetupWindow --> DisplayWindow["/fas:fa-eye Display Information Window"] DisplayWindow --> AutoCloseWindow["/fas:fa-clock Auto-Close Window After Duration"] AutoCloseWindow --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckWindowExists fill:#ffcc00,stroke:#000,stroke-width:2px style DeleteExistingWindow fill:#99ccff,stroke:#000,stroke-width:2px style SetupWindow fill:#99ff99,stroke:#000,stroke-width:2px style DisplayWindow fill:#ffcc99,stroke:#000,stroke-width:2px style AutoCloseWindow fill:#ffcc99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The process starts with initial setup and gathering information from the user interface.

  2. Joints for left and right eyes are created and positioned according to the geometry of the eyes.

  3. The main control for both eyes is created and scaled appropriately.

  4. Individual eye controls with up-vector locators are created for each eye.

  5. The geometry of the eyes is bound to the respective joints for skinning.

  6. The control hierarchy is organized and parented under the main control and character’s head joint.

  7. The function completes by cleaning up the selection and refreshing the view.

graph TB Start[("fa:fa-play Start")] --> InitialSetup["/fas:fa-cog Initial Setup"] InitialSetup --> CreateJoints["/fas:fa-bone Create Eye Joints"] CreateJoints --> CreateMainControl["/fas:fa-crosshairs Create Main Eye Control"] CreateMainControl --> CreateIndividualControls["/fas:fa-eye Create Individual Eye Controls"] CreateIndividualControls --> SkinGeometry["/fas:fa-user-md Skin Eye Geometry"] SkinGeometry --> OrganizeHierarchy["/fas:fa-sitemap Organize Control Hierarchy"] OrganizeHierarchy --> Cleanup["/fas:fa-broom Cleanup and Refresh"] Cleanup --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style InitialSetup fill:#ffcc00,stroke:#000,stroke-width:2px style CreateJoints fill:#99ccff,stroke:#000,stroke-width:2px style CreateMainControl fill:#99ff99,stroke:#000,stroke-width:2px style CreateIndividualControls fill:#ffcc99,stroke:#000,stroke-width:2px style SkinGeometry fill:#99ccff,stroke:#000,stroke-width:2px style OrganizeHierarchy fill:#99ff99,stroke:#000,stroke-width:2px style Cleanup fill:#ffcc99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The process starts with initializing global variables and checking authorship.

  2. A global control is created to manage the overall character rig.

  3. Main groups such as ‘Rig_Main’, ‘Transform’, ‘Joints’, ‘Geometry’, and ‘IK’ are established.

  4. Parent and scale constraints are applied to link these groups with the global control.

  5. Additional curves for jaw and spine are created and parented under the spine curve.

  6. The hierarchy is finalized by selecting the spine curve.

graph TB Start[("fa:fa-play Start")] --> InitializeVariables["/fas:fa-cog Initialize Variables"] InitializeVariables --> CreateGlobalControl["/fas:fa-globe-americas Create Global Control"] CreateGlobalControl --> CreateMainGroups["/fas:fa-layer-group Create Main Groups"] CreateMainGroups --> ApplyConstraints["/fas:fa-link Apply Constraints"] ApplyConstraints --> CreateAdditionalCurves["/fas:fa-curve Create Jaw & Spine Curves"] CreateAdditionalCurves --> FinalizeHierarchy["/fas:fa-check-circle Finalize Hierarchy"] FinalizeHierarchy --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style InitializeVariables fill:#ffcc00,stroke:#000,stroke-width:2px style CreateGlobalControl fill:#99ccff,stroke:#000,stroke-width:2px style CreateMainGroups fill:#99ff99,stroke:#000,stroke-width:2px style ApplyConstraints fill:#ffcc99,stroke:#000,stroke-width:2px style CreateAdditionalCurves fill:#cc99ff,stroke:#000,stroke-width:2px style FinalizeHierarchy fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The process starts by checking authorship and initializing necessary nodes like head joint and head control.

  2. The jaw curve is frozen to set its transformations to default.

  3. Jaw joints are created from the jaw curve with specific naming.

  4. The jaw joint is oriented and parented to the head joint.

  5. Jaw attributes are added to the head control for controlling jaw movements.

  6. The jaw curve is deleted, and the jaw setup is connected to the head control.

  7. The process ends, leaving a functional jaw setup integrated with the head control.

graph TB Start[("fa:fa-play Start")] --> CheckAuthorship["/fas:fa-user-check Check Authorship"] CheckAuthorship --> InitializeNodes["/fas:fa-code-branch Initialize Head Joint & Control"] InitializeNodes --> FreezeJawCurve["/fas:fa-snowflake Freeze Jaw Curve"] FreezeJawCurve --> CreateJawJoints["/fas:fa-user-md Create Jaw Joints"] CreateJawJoints --> OrientParentJaw["/fas:fa-sync-alt Orient & Parent Jaw Joint"] OrientParentJaw --> AddJawAttributes["/fas:fa-plus-circle Add Jaw Attributes to Head Control"] AddJawAttributes --> ConnectJawToControl["/fas:fa-link Connect Jaw to Head Control"] ConnectJawToControl --> DeleteJawCurve["/fas:fa-trash-alt Delete Jaw Curve"] DeleteJawCurve --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckAuthorship fill:#ffcc00,stroke:#000,stroke-width:2px style InitializeNodes fill:#99ccff,stroke:#000,stroke-width:2px style FreezeJawCurve fill:#99ff99,stroke:#000,stroke-width:2px style CreateJawJoints fill:#cc99ff,stroke:#000,stroke-width:2px style OrientParentJaw fill:#ffcc99,stroke:#000,stroke-width:2px style AddJawAttributes fill:#99ccff,stroke:#000,stroke-width:2px style ConnectJawToControl fill:#99ff99,stroke:#000,stroke-width:2px style DeleteJawCurve fill:#ffcc99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The process begins with selecting the joints for the setup.

  2. It then applies a spline setup based on the selected joints and quick setup parameters.

  3. Wave setup is added if specified in the UI.

  4. The function checks for mirror setup options and applies mirroring if selected.

  5. Adjustments are made to joint prefixes and IK curve names for mirrored setups.

  6. The process ends with a completed quick setup of a spline rig, possibly with wave effects and mirroring applied.

graph TB Start[("fa:fa-play Start")] --> SelectJoints["/fas:fa-hand-pointer Select Joints"] SelectJoints --> ApplySplineSetup["/fas:fa-project-diagram Apply Spline Setup"] ApplySplineSetup --> CheckWaveSetup{"/fas:fa-wave-square Check Wave Setup"} CheckWaveSetup --"If Wave Setup Enabled"--> AddWaveSetup["/fas:fa-water Add Wave Setup"] CheckWaveSetup --"No Wave Setup"--> CheckMirrorSetup{"/fas:fa-clone Check Mirror Setup"} AddWaveSetup --> CheckMirrorSetup CheckMirrorSetup --"If Mirror Setup Enabled"--> ApplyMirrorSetup["/fas:fa-mirror Apply Mirror Setup"] CheckMirrorSetup --"No Mirror Setup"--> End[("fas:fa-stop End")] ApplyMirrorSetup --> AdjustPrefixes["/fas:fa-text-height Adjust Joint Prefixes"] AdjustPrefixes --> End style Start fill:#00cc00,stroke:#000,stroke-width:3px style SelectJoints fill:#ffcc00,stroke:#000,stroke-width:2px style ApplySplineSetup fill:#99ccff,stroke:#000,stroke-width:2px style CheckWaveSetup fill:#ffcc99,stroke:#000,stroke-width:2px style AddWaveSetup fill:#99ff99,stroke:#000,stroke-width:2px style CheckMirrorSetup fill:#ffcc99,stroke:#000,stroke-width:2px style ApplyMirrorSetup fill:#99ccff,stroke:#000,stroke-width:2px style AdjustPrefixes fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The function starts by invoking the about section of EasySnake to display credits and tool information.

  2. It checks if the EasySnake window is already open and closes it to avoid duplicates.

  3. The tool attempts to load the user interface from a predefined path. If the primary path fails, alternative paths are tried.

  4. Once the user interface is successfully loaded, it is displayed on the screen.

  5. The function sets up a popup menu for additional options like attaching objects to a path.

  6. The process completes with the EasySnake tool interface ready for user interaction.

graph TB Start[("fa:fa-play Start")] --> DisplayCredits["/fas:fa-info-circle Display EasySnake Credits"] DisplayCredits --> CheckWindowOpen{"/fas:fa-window-restore Check if Window Open"} CheckWindowOpen --"If Open"--> CloseWindow["/fas:fa-window-close Close Existing Window"] CheckWindowOpen --"Not Open"--> LoadUI{"/fas:fa-upload Load UI"} CloseWindow --> LoadUI LoadUI --"Try Primary Path"--> LoadSuccess["/fas:fa-check-circle Load Successful"] LoadUI --"If Primary Path Fails"--> TryAlternatePaths{"/fas:fa-exchange-alt Try Alternate Paths"} TryAlternatePaths --> LoadSuccess LoadSuccess --> ShowWindow["/fas:fa-window-maximize Show EasySnake Window"] ShowWindow --> SetupPopupMenu["/fas:fa-bars Setup Popup Menu"] SetupPopupMenu --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style DisplayCredits fill:#ffcc00,stroke:#000,stroke-width:2px style CheckWindowOpen fill:#ffcc99,stroke:#000,stroke-width:2px style CloseWindow fill:#99ff99,stroke:#000,stroke-width:2px style LoadUI fill:#99ccff,stroke:#000,stroke-width:2px style TryAlternatePaths fill:#99ccff,stroke:#000,stroke-width:2px style LoadSuccess fill:#99ff99,stroke:#000,stroke-width:2px style ShowWindow fill:#99ccff,stroke:#000,stroke-width:2px style SetupPopupMenu fill:#ffcc99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The process begins by identifying and selecting all control nodes in the rig.

  2. Locks visibility and scale attributes on the selected controls to prevent unintended changes.

  3. Searches for IK handles, curves, clusters, and joint groups in the rig.

  4. Hides these technical nodes to streamline the animator’s workspace.

  5. The process concludes with a clean, animator-friendly rig, ready for animation.

graph TB Start[("fa:fa-play Start")] --> SelectControls["/fas:fa-mouse-pointer Select All Controls"] SelectControls --> LockControlAttributes["/fas:fa-lock Lock Control Attributes (Visibility & Scale)"] LockControlAttributes --> FindTechnicalNodes{"/fas:fa-search Find Technical Nodes"} FindTechnicalNodes --> HideNodes["/fas:fa-eye-slash Hide IKs, Curves, Clusters"] HideNodes --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style SelectControls fill:#99ccff,stroke:#000,stroke-width:2px style LockControlAttributes fill:#99ff99,stroke:#000,stroke-width:2px style FindTechnicalNodes fill:#ffcc99,stroke:#000,stroke-width:2px style HideNodes fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The function starts with a user confirmation to proceed with the rebuilding process.

  2. Renames and reorganizes spine-related joints and controls, including COG, neck, tail, and chest joints.

  3. Transfers skinning from old joints to the newly created spine joints.

  4. Cleans up the rig by deleting old joints, controls, IK handles, and groups.

  5. Completes with a confirmation message indicating successful rebuild of the spine setup.

graph TB Start[("fa:fa-play Start")] --> UserConfirmation{"/fas:fa-question-circle User Confirmation"} UserConfirmation --"Yes"--> RenameAndReorganize["/fas:fa-pen Rename and Reorganize Spine Elements"] UserConfirmation --"No"--> Terminate["/fas:fa-times-circle Terminate Action"] RenameAndReorganize --> TransferSkinning["/fas:fa-exchange-alt Transfer Skinning"] TransferSkinning --> Cleanup["/fas:fa-broom Cleanup Rig"] Cleanup --> ConfirmationMessage["/fas:fa-check Confirmation Message"] Terminate --> End[("fas:fa-stop End")] ConfirmationMessage --> End style Start fill:#00cc00,stroke:#000,stroke-width:3px style UserConfirmation fill:#ffcc00,stroke:#000,stroke-width:2px style RenameAndReorganize fill:#99ccff,stroke:#000,stroke-width:2px style TransferSkinning fill:#99ff99,stroke:#000,stroke-width:2px style Cleanup fill:#99ff99,stroke:#000,stroke-width:2px style ConfirmationMessage fill:#99ff99,stroke:#000,stroke-width:2px style Terminate fill:#ff6666,stroke:#000,stroke-width:3px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The function initiates with the selection of geometry (mesh) in the scene.

  2. It identifies the skinCluster associated with the selected mesh.

  3. The Artisan brush tool is set up with specific settings for smoothing skin weights.

  4. The skin weights are smoothed in a forward direction, iterating over each influence object (joint).

  5. The process is repeated in the reverse direction for a thorough smoothing effect.

  6. The progress of smoothing is visually displayed through a progress bar.

  7. Once completed, the selected geometry is reselected, and the function concludes.

graph TB Start[("fa:fa-play Start")] --> SelectGeometry{"/fas:fa-object-group Select Geometry"} SelectGeometry --"Geometry Selected"--> IdentifySkinCluster["/fas:fa-project-diagram Identify Skin Cluster"] IdentifySkinCluster --> SetupArtisanBrush["/fas:fa-paint-brush Setup Artisan Brush"] SetupArtisanBrush --> SmoothForward["/fas:fa-arrow-right Smooth Forward Direction"] SmoothForward --> ProgressForward["/fas:fa-spinner Progress Bar Forward"] ProgressForward --> SmoothReverse["/fas:fa-arrow-left Smooth Reverse Direction"] SmoothReverse --> ProgressReverse["/fas:fa-spinner Progress Bar Reverse"] ProgressReverse --> ReselectGeometry["/fas:fa-object-group Reselect Geometry"] ReselectGeometry --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style SelectGeometry fill:#ffcc00,stroke:#000,stroke-width:2px style IdentifySkinCluster fill:#99ccff,stroke:#000,stroke-width:2px style SetupArtisanBrush fill:#99ccff,stroke:#000,stroke-width:2px style SmoothForward fill:#99ff99,stroke:#000,stroke-width:2px style ProgressForward fill:#99ff99,stroke:#000,stroke-width:2px style SmoothReverse fill:#99ff99,stroke:#000,stroke-width:2px style ProgressReverse fill:#99ff99,stroke:#000,stroke-width:2px style ReselectGeometry fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The function begins by verifying the authorship of the script.

  2. It then retrieves the list of joints selected in the scene, representing the snake’s skeleton.

  3. The skin mesh (snake’s body geometry) is identified based on the user input from the GUI.

  4. A check is performed to ensure the specified skin mesh exists in the scene.

  5. If the mesh exists, it’s selected along with the joints.

  6. The Maya built-in Smooth Bind Skin command is executed to bind the skin mesh to the joints.

  7. The function reselects the joints, concluding the skinning process.

graph TB Start[("fa:fa-play Start")] --> CheckAuthorship{"/fas:fa-user-shield Check Authorship"} CheckAuthorship --"Verified"--> RetrieveJoints["/fas:fa-bone Retrieve Joints"] RetrieveJoints --> IdentifySkinMesh{"/fas:fa-search Identify Skin Mesh"} IdentifySkinMesh --"Mesh Exists"--> SelectJointsAndMesh["/fas:fa-mouse-pointer Select Joints & Mesh"] IdentifySkinMesh --"Mesh Not Found"--> DisplayError["/fas:fa-exclamation-triangle Display Error"] SelectJointsAndMesh --> ExecuteSkinning["/fas:fa-syringe Execute Skin Binding"] ExecuteSkinning --> ReselectJoints["/fas:fa-bone Reselect Joints"] ReselectJoints --> End[("fas:fa-stop End")] DisplayError --> End style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckAuthorship fill:#ffcc00,stroke:#000,stroke-width:2px style RetrieveJoints fill:#99ccff,stroke:#000,stroke-width:2px style IdentifySkinMesh fill:#99ccff,stroke:#000,stroke-width:2px style SelectJointsAndMesh fill:#99ff99,stroke:#000,stroke-width:2px style DisplayError fill:#ff6666,stroke:#000,stroke-width:2px style ExecuteSkinning fill:#99ff99,stroke:#000,stroke-width:2px style ReselectJoints fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. The function initiates by checking for selected objects in the scene.

  2. Determines if the selected object is a curve or joint for the IK setup.

  3. Based on the selection, it either creates joints along a curve or uses the selected joints.

  4. Constructs an IK handle and curve for the spline setup.

  5. Generates controls for the IK handle, positioning and orienting them based on the user’s preferences.

  6. Optionally creates an FK on IK setup for additional control over the rig.

  7. Locks unnecessary attributes on the controls to simplify the animator’s workflow.

  8. If a mesh is selected, identifies the closest mesh to the setup for potential skinning.

graph TB Start[("fa:fa-play Start")] --> CheckSelection{"/fas:fa-mouse-pointer Check Selection"} CheckSelection --"Curve Selected"--> CreateJointsOnCurve["/fas:fa-project-diagram Create Joints on Curve"] CheckSelection --"Joint Selected"--> UseSelectedJoints["/fas:fa-bone Use Selected Joints"] CreateJointsOnCurve --> ConstructIKHandle["/fas:fa-link Construct IK Handle"] UseSelectedJoints --> ConstructIKHandle ConstructIKHandle --> GenerateControls["/fas:fa-sliders-h Generate Controls"] GenerateControls --> OptionalFKonIKSetup{"/fas:fa-exchange-alt Optional FK on IK Setup"} OptionalFKonIKSetup --"If Enabled"--> CreateFKonIK["/fas:fa-code-branch Create FK on IK"] OptionalFKonIKSetup --"If Disabled"--> LockControlAttributes["/fas:fa-lock Lock Control Attributes"] CreateFKonIK --> LockControlAttributes LockControlAttributes --> IdentifyClosestMesh{"/fas:fa-search Identify Closest Mesh"} IdentifyClosestMesh --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckSelection fill:#ffcc00,stroke:#000,stroke-width:2px style CreateJointsOnCurve fill:#99ccff,stroke:#000,stroke-width:2px style UseSelectedJoints fill:#99ccff,stroke:#000,stroke-width:2px style ConstructIKHandle fill:#99ff99,stroke:#000,stroke-width:2px style GenerateControls fill:#99ff99,stroke:#000,stroke-width:2px style OptionalFKonIKSetup fill:#ffcc00,stroke:#000,stroke-width:2px style CreateFKonIK fill:#99ccff,stroke:#000,stroke-width:2px style LockControlAttributes fill:#99ff99,stroke:#000,stroke-width:2px style IdentifyClosestMesh fill:#99ccff,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. Starts by identifying the animation control and IK curve from the user interface.

  2. Retrieves and sets various wave parameters like wave height, length, and style.

  3. Creates or identifies a duplicate wave curve based on the original IK curve.

  4. Constructs sine and flare handles to manipulate the wave motion on the curve.

  5. Sets driven keyframes to control wave properties from the main animation control.

  6. Optionally blends the wave curve with the IK curve for smooth transitions.

  7. Configures the direction and initial values for the wave motion based on input parameters.

  8. Completes by setting visibility and parenting for a clean and organized setup.

graph TB Start[("fa:fa-play Start")] --> IdentifyControlAndCurve{"/fas:fa-search-plus Identify Control & Curve"} IdentifyControlAndCurve --> RetrieveWaveParameters["/fas:fa-sliders-h Retrieve Wave Parameters"] RetrieveWaveParameters --> CheckDuplicateCurve{"/fas:fa-clone Check for Duplicate Curve"} CheckDuplicateCurve --"If Exists"--> UseExistingCurve["/fas:fa-check-circle Use Existing Curve"] CheckDuplicateCurve --"If Not Exists"--> CreateDuplicateCurve["/fas:fa-plus-circle Create Duplicate Curve"] UseExistingCurve --> ConstructSineHandle["/fas:fa-sine-wave Construct Sine Handle"] CreateDuplicateCurve --> ConstructSineHandle ConstructSineHandle --> ConstructFlareHandle["/fas:fa-flare Construct Flare Handle"] ConstructFlareHandle --> SetupDrivenKeyframes["/fas:fa-key Setup Driven Keyframes"] SetupDrivenKeyframes --> BlendCurves{"/fas:fa-blender Blend Curves"} BlendCurves --"If Necessary"--> PerformBlend["/fas:fa-blender-phone Perform Blend"] BlendCurves --"If Not Required"--> SetWaveDirection["/fas:fa-compass Set Wave Direction"] PerformBlend --> SetWaveDirection SetWaveDirection --> FinalizeSetup["/fas:fa-check Finalize Setup"] FinalizeSetup --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style IdentifyControlAndCurve fill:#ffcc00,stroke:#000,stroke-width:2px style RetrieveWaveParameters fill:#99ccff,stroke:#000,stroke-width:2px style CheckDuplicateCurve fill:#ffcc00,stroke:#000,stroke-width:2px style UseExistingCurve fill:#99ccff,stroke:#000,stroke-width:2px style CreateDuplicateCurve fill:#99ccff,stroke:#000,stroke-width:2px style ConstructSineHandle fill:#99ff99,stroke:#000,stroke-width:2px style ConstructFlareHandle fill:#99ff99,stroke:#000,stroke-width:2px style SetupDrivenKeyframes fill:#99ff99,stroke:#000,stroke-width:2px style BlendCurves fill:#ffcc00,stroke:#000,stroke-width:2px style PerformBlend fill:#99ccff,stroke:#000,stroke-width:2px style SetWaveDirection fill:#99ccff,stroke:#000,stroke-width:2px style FinalizeSetup fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. Starts by identifying the animation control provided as an input.

  2. Iterates through a range of numbers to determine the appropriate length for the divider.

  3. Checks if a divider with the current number of underscores already exists on the control.

  4. If not, creates a new attribute on the control with the determined number of underscores as its name.

  5. Locks the newly created divider attribute to prevent accidental modifications.

  6. Completes the process, leaving the control with a neatly organized attribute editor.

graph TB Start[("fa:fa-play Start")] --> IdentifyControl{"/fas:fa-search-plus Identify Animation Control"} IdentifyControl --> IterateNumbers{"/fas:fa-list-ol Iterate Through Numbers"} IterateNumbers --> CheckExistingDivider{"/fas:fa-question-circle Check for Existing Divider"} CheckExistingDivider --"If Exists"--> IterateNumbers CheckExistingDivider --"If Not Exists"--> CreateDivider["/fas:fa-minus Create Divider Attribute"] CreateDivider --> LockDivider["/fas:fa-lock Lock Divider Attribute"] LockDivider --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style IdentifyControl fill:#ffcc00,stroke:#000,stroke-width:2px style IterateNumbers fill:#99ccff,stroke:#000,stroke-width:2px style CheckExistingDivider fill:#ffcc00,stroke:#000,stroke-width:2px style CreateDivider fill:#99ff99,stroke:#000,stroke-width:2px style LockDivider fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. Checks if the object to attach and the path curve are specified or selected.

  2. Determines the aim and up axis based on user input or default settings.

  3. Calculates the number of objects to create and their spacing along the path.

  4. Duplicates the object and creates a path animation for each duplicate.

  5. Aligns the duplicates along the path, ensuring even distribution.

  6. Connects any additional attributes like banking for dynamic motion along the path.

  7. Returns a list of all created objects.

graph TB Start[("fa:fa-play Start")] --> CheckInputs{"/fas:fa-question-circle Check Inputs"} CheckInputs --"If Not Provided"--> SelectObjects{"/fas:fa-mouse-pointer Select Objects"} CheckInputs --"If Provided"--> CalculateSpacing{"/fas:fa-ruler-combined Calculate Object Spacing"} SelectObjects --> CalculateSpacing CalculateSpacing --> DuplicateObjects{"/fas:fa-clone Duplicate & Attach Objects"} DuplicateObjects --> AlignObjects{"/fas:fa-align-center Align Objects on Path"} AlignObjects --> ConnectAttributes{"/fas:fa-link Connect Additional Attributes"} ConnectAttributes --> ReturnObjects{"/fas:fa-check-circle Return List of Objects"} ReturnObjects --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckInputs fill:#ffcc00,stroke:#000,stroke-width:2px style SelectObjects fill:#99ccff,stroke:#000,stroke-width:2px style CalculateSpacing fill:#99ccff,stroke:#000,stroke-width:2px style DuplicateObjects fill:#99ff99,stroke:#000,stroke-width:2px style AlignObjects fill:#99ff99,stroke:#000,stroke-width:2px style ConnectAttributes fill:#99ff99,stroke:#000,stroke-width:2px style ReturnObjects fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. Starts by duplicating the top joint of the selected joint chain.

  2. Renames the duplicated joints for bounding purposes.

  3. Reparents the joints to a new group named ‘Bound_Jnt_Grp’.

  4. Iterates through all joints, setting up their pivot and creating constraints.

  5. Applies orient and point constraints to the duplicated joints for dynamic motion.

  6. Refreshes the view to update the Maya scene with the new joint setup.

graph TB Start[("fa:fa-play Start")] --> DuplicateTopJoint{"/fas:fa-clone Duplicate Top Joint"} DuplicateTopJoint --> RenameJoints{"/fas:fa-text-width Rename Joints"} RenameJoints --> CreateBoundGroup{"/fas:fa-object-group Create 'Bound_Jnt_Grp'"} CreateBoundGroup --> ReparentJoints{"/fas:fa-level-up-alt Reparent Joints"} ReparentJoints --> IterateJoints{"/fas:fa-repeat Iterate through Joints"} IterateJoints --> ApplyConstraints{"/fas:fa-link Apply Constraints"} ApplyConstraints --> RefreshView{"/fas:fa-sync Refresh View"} RefreshView --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style DuplicateTopJoint fill:#99ccff,stroke:#000,stroke-width:2px style RenameJoints fill:#99ccff,stroke:#000,stroke-width:2px style CreateBoundGroup fill:#99ff99,stroke:#000,stroke-width:2px style ReparentJoints fill:#99ff99,stroke:#000,stroke-width:2px style IterateJoints fill:#ffcc00,stroke:#000,stroke-width:2px style ApplyConstraints fill:#ffcc00,stroke:#000,stroke-width:2px style RefreshView fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:

  1. Starts by calculating the total length of the snake or chain using the control list.

  2. Iterates through each control in the list (except the first control).

  3. Calculates the relative position (uValue) of each control along the path based on its distance from the start.

  4. Applies a motion path animation to each control, setting its position on the path.

  5. Breaks initial connections to the uValue attribute, allowing manual control.

  6. Displays a success message with the time taken to execute the function.

graph TB Start[("fa:fa-play Start")] --> CalculateLength{"/fas:fa-ruler-horizontal Calculate Total Length"} CalculateLength --> IterateControls{"/fas:fa-repeat Iterate Controls"} IterateControls --> CalculatePosition{"/fas:fa-map-marker-alt Calculate Control Position"} CalculatePosition --> ApplyMotionPath{"/fas:fa-route Apply Motion Path Animation"} ApplyMotionPath --> BreakConnections{"/fas:fa-unlink Break Initial Connections"} BreakConnections --> DisplayMessage{"/fas:fa-comment Display Success Message"} DisplayMessage --> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CalculateLength fill:#99ccff,stroke:#000,stroke-width:2px style IterateControls fill:#ffcc00,stroke:#000,stroke-width:2px style CalculatePosition fill:#99ccff,stroke:#000,stroke-width:2px style ApplyMotionPath fill:#ffcc00,stroke:#000,stroke-width:2px style BreakConnections fill:#99ccff,stroke:#000,stroke-width:2px style DisplayMessage fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
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:
  1. Initialize global variables.

  2. Loop through each control in ‘ctrlList’, skipping the first control.

  3. For each control, calculate the distance to the first control and add custom attributes.

  4. Create a motion path animation for each control and modify attributes to prevent stretching.

  5. 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.

graph TB Start[("fa:fa-play Start")] --> InitializeVars["/fas:fa-cogs Initialize Variables"] InitializeVars --> CheckPathExists{"/fas:fa-question-circle Check if Path Exists"} CheckPathExists --"If Path Exists"--> CheckAnimCtrlExists{"/fas:fa-question-circle Check if Animation Control Exists"} CheckPathExists --"If Path Does Not Exist"--> ErrorPathNotFound["/fas:fa-exclamation-triangle Error: Path Not Found"] CheckAnimCtrlExists --"If Anim Control Exists"--> DetermineWorldDir{"/fas:fa-globe Determine World Direction"} CheckAnimCtrlExists --"If Anim Control Does Not Exist"--> ErrorAnimCtrlNotFound["/fas:fa-exclamation-triangle Error: Animation Control Not Found"] DetermineWorldDir --> DetermineCtrlDir{"/fas:fa-directions Determine Control Direction"} DetermineCtrlDir --> CalculateLengths["/fas:fa-ruler-combined Calculate Chain and Path Lengths"] CalculateLengths --> AddAttributesToAnimCtrl["/fas:fa-plus Add Custom Attributes to Animation Control"] AddAttributesToAnimCtrl --> SelectStretchOption{"/fas:fa-expand-arrows-alt Select Stretch Option"} SelectStretchOption --"Non-Stretch"--> SetupNonStretch["/fas:fa-compress Setup Non-Stretch Animation"] SelectStretchOption --"Stretch Along Path"--> SetupStretchAlongPath["/fas:fa-expand-arrows-alt Setup Stretch Along Path Animation"] SelectStretchOption --"Full Stretch"--> SetupFullStretch["/fas:fa-arrows-alt Setup Full Stretch Animation"] SetupNonStretch --> SetControlsOnPath["/fas:fa-path Set Controls to Follow Path"] SetupStretchAlongPath --> SetControlsOnPath SetupFullStretch --> SetControlsOnPath SetControlsOnPath --> End[("fas:fa-stop End")] ErrorPathNotFound --> End ErrorAnimCtrlNotFound --> End style Start fill:#00cc00,stroke:#000,stroke-width:3px style InitializeVars fill:#ff9999,stroke:#000,stroke-width:2px style CheckPathExists fill:#ffcc00,stroke:#000,stroke-width:2px style CheckAnimCtrlExists fill:#ffcc00,stroke:#000,stroke-width:2px style DetermineWorldDir fill:#99ccff,stroke:#000,stroke-width:2px style DetermineCtrlDir fill:#99ccff,stroke:#000,stroke-width:2px style CalculateLengths fill:#cc99ff,stroke:#000,stroke-width:2px style AddAttributesToAnimCtrl fill:#99ff99,stroke:#000,stroke-width:2px style SelectStretchOption fill:#ffcc99,stroke:#000,stroke-width:2px style SetupNonStretch fill:#ccffcc,stroke:#000,stroke-width:2px style SetupStretchAlongPath fill:#99ff99,stroke:#000,stroke-width:2px style SetupFullStretch fill:#99ff99,stroke:#000,stroke-width:2px style SetControlsOnPath fill:#cc99ff,stroke:#000,stroke-width:2px style ErrorPathNotFound fill:#ff9999,stroke:#000,stroke-width:2px style ErrorAnimCtrlNotFound fill:#ff9999,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the create_PathAnimRig function:

  1. The process starts by initializing global variables such as the motion path, animation control, and control list.

  2. It checks if the specified path and animation control exist.

  3. Determines the world and control directions based on GUI options.

  4. Calculates the chain and path lengths for the animation setup.

  5. Adds custom attributes to the animation control for path animation management.

  6. Depending on the selected stretch option (non-stretch, stretch along path, or full stretch), it sets up the corresponding path animation.

  7. 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.
graph TB Start[("fa:fa-play Start")] --> InitializeVars["/fas:fa-cogs Initialize Variables"] InitializeVars --> ReverseCtrlList["/fas:fa-random Reverse Control List"] ReverseCtrlList --> ProcessCtrls{"/fas:fa-question-circle Process Controls"} ProcessCtrls --"For Each Control"--> CheckFirstCtrl{"/fas:fa-question-circle Check if First Control"} CheckFirstCtrl --"If Not First Control"--> CalculateCtrlDistance["/fas:fa-ruler Calculate Control Distance"] CalculateCtrlDistance --> SetupCtrlAttributes["/fas:fa-plus Add Custom Attributes to Control"] SetupCtrlAttributes --> SetupMotionPathAnim["/fas:fa-road Setup Motion Path Animation"] CheckFirstCtrl --"If First Control"--> SetupFirstCtrlMotionPath["/fas:fa-road Setup First Control Motion Path"] SetupMotionPathAnim --> SetupStretchCalculations["/fas:fa-expand-arrows-alt Setup Stretch Calculations"] SetupStretchCalculations --> ConnectTravelPosition["/fas:fa-link Connect Travel Position"] ConnectTravelPosition --> End[("fas:fa-stop End")] SetupFirstCtrlMotionPath --> End style Start fill:#00cc00,stroke:#000,stroke-width:3px style InitializeVars fill:#ff9999,stroke:#000,stroke-width:2px style ReverseCtrlList fill:#99ccff,stroke:#000,stroke-width:2px style ProcessCtrls fill:#ffcc00,stroke:#000,stroke-width:2px style CheckFirstCtrl fill:#99ff99,stroke:#000,stroke-width:2px style CalculateCtrlDistance fill:#cc99ff,stroke:#000,stroke-width:2px style SetupCtrlAttributes fill:#ffcc99,stroke:#000,stroke-width:2px style SetupMotionPathAnim fill:#99ccff,stroke:#000,stroke-width:2px style SetupFirstCtrlMotionPath fill:#99ccff,stroke:#000,stroke-width:2px style SetupStretchCalculations fill:#cc99ff,stroke:#000,stroke-width:2px style ConnectTravelPosition fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the create_StretchAlongPathAnim function:

  1. The process starts by initializing necessary variables and reversing the control list.

  2. 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.

  3. For the first control, a separate motion path is set up.

  4. The travel position is connected to manage the control’s position along the path.

  5. 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.
graph TB Start[("fa:fa-play Start")] --> ConfirmDeletion{"/fas:fa-question-circle Confirm Deletion"} ConfirmDeletion --"Deletion Confirmed"--> DeleteAnimationSetup["/fas:fa-trash-alt Delete Animation Setup"] DeleteAnimationSetup --"Path Animation Removed"--> End["/fas:fa-stop End"] ConfirmDeletion --"Deletion Cancelled"--> End style Start fill:#00cc00,stroke:#000,stroke-width:3px style ConfirmDeletion fill:#ffcc00,stroke:#000,stroke-width:2px style DeleteAnimationSetup fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the delete_PathAnim function:

  1. The function starts and prompts the user for confirmation to delete the path animation setup.

  2. If deletion is confirmed, it proceeds to delete the path animation setup.

  3. If deletion is cancelled, the process ends without making any changes.

  4. 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
graph TD Start[("fa:fa-play Start")] --> CheckShArgs{"/fas:fa-question-circle Check shArgs"} CheckShArgs --"If shArgs Exist"--> ParseShArgs["/fas:fa-cogs Parse shArgs"] CheckShArgs --"If shArgs Does Not Exist"--> InitializeParameters["/fas:fa-wrench Initialize Parameters"] ParseShArgs --> DisplayDialog{"/fas:fa-desktop Display Dialog"} DisplayDialog --> RaiseError{"/fas:fa-exclamation-circle Raise Error"} RaiseError --> End["/fas:fa-stop End"] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckShArgs fill:#ffcc00,stroke:#000,stroke-width:2px style ParseShArgs fill:#ff9999,stroke:#000,stroke-width:2px style InitializeParameters fill:#ff9999,stroke:#000,stroke-width:2px style DisplayDialog fill:#99ccff,stroke:#000,stroke-width:2px style RaiseError fill:#ff6666,stroke:#000,stroke-width:3px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the error function:

  1. Checks if shArgs exist, and if so, parses the error message from it.

  2. If shArgs do not exist, initializes the error message parameter.

  3. Displays the error message in a dialog window.

  4. Raises a RuntimeError with the error message after the dialog window is closed.

  5. 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.
graph TB Start[("fa:fa-play Start")] --> CheckInputs{"/fas:fa-question-circle Check Inputs"} CheckInputs --"Input Provided"--> CreateControl[("/fas:fa-vector-square Create Global Control")] CreateControl --> GroupControl[("/fas:fa-object-group Group Control")] GroupControl --> ApplyColor[("/fas:fa-palette Apply Color")] ApplyColor --> End[("fas:fa-stop-circle End")] CheckInputs --"No Input"--> Error[("fa:fa-times Error")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckInputs fill:#ffcc00,stroke:#000,stroke-width:2px style CreateControl fill:#99ff99,stroke:#000,stroke-width:2px style GroupControl fill:#ff9999,stroke:#000,stroke-width:2px style ApplyColor fill:#99ccff,stroke:#000,stroke-width:2px style Error fill:#ff6666,stroke:#000,stroke-width:3px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the globalCtrl function:

  1. The function starts by checking if all necessary inputs like control name, group level, and control type are provided.

  2. If inputs are provided, it creates a global control with the specified parameters.

  3. The control is then grouped according to the hierarchy level specified.

  4. Color is applied to the control for visual differentiation.

  5. The function ends after successfully creating and configuring the global control.

  6. 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!")
graph TB Start[("fa:fa-play Start")] --> CheckShArgs{{"/fas:fa-question Check shArgs"}} CheckShArgs --"If shArgs is provided"--> ProcessShArgs["/fas:fa-cogs Process shArgs"] CheckShArgs --"If shArgs is not provided"--> CallConfirmDialog["/fas:fa-comment-dots Call confirmDialog"] ProcessShArgs --> CallConfirmDialog CallConfirmDialog --"Display message in dialog"--> End[("fas:fa-stop End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckShArgs fill:#ffcc00,stroke:#000,stroke-width:2px style ProcessShArgs fill:#ff9999,stroke:#000,stroke-width:2px style CallConfirmDialog fill:#99ccff,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the message function:

  1. The process starts by checking if shArgs are provided and updates messageTxt if necessary.

  2. 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.
graph TB Start[("fa:fa-play Start")] --> CheckAuthor{"/fas:fa-user-check Check Author"} CheckAuthor --"Author Verified"--> OpenWebsite["/fas:fa-globe Open Python Scripting Website"] OpenWebsite --"Website Opened"--> End["/fas:fa-stop End"] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckAuthor fill:#ffcc00,stroke:#000,stroke-width:2px style OpenWebsite fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the openPythonScripting function:

  1. The function begins and checks if the author is verified.

  2. Upon verification, it opens the Python Scripting website in the user’s default web browser.

  3. 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.
graph TB Start[("fa:fa-play Start")] --> CheckSelection{"/fas:fa-check-circle Check Selected Controls"} CheckSelection --"Controls Selected"--> RemoveAttributes["/fas:fa-times-circle Remove Attributes"] RemoveAttributes --"Attributes Removed"--> End["/fas:fa-stop End"] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckSelection fill:#ffcc00,stroke:#000,stroke-width:2px style RemoveAttributes fill:#99ff99,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the removePathAnimAttrs function:

  1. The function starts by checking if any animation controls are selected.

  2. It then proceeds to remove specific attributes related to path animation from the selected controls.

  3. 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.
graph TB Start[("fa:fa-play Start")] --> CheckShArgs{{"/fas:fa-question Check shArgs"}} CheckShArgs --"shArgs provided"--> UpdateArgs[("/fas:fa-sync-alt Update Arguments")] CheckShArgs --"shArgs not provided"--> CheckShapeAndTarget{{"/fas:fa-question-circle Check Shape and Target"}} UpdateArgs --> CheckShapeAndTarget CheckShapeAndTarget --"Both shapeObj and trgt provided"--> CheckCtrlName[("/fas:fa-i-cursor Check Control Name")] CheckShapeAndTarget --"Either not provided"--> SelectShapeAndTarget[("/fas:fa-mouse-pointer Select Shape and Target")] CheckCtrlName --> GetShapeNodes[("/fas:fa-project-diagram Get Shape Nodes")] SelectShapeAndTarget --> GetShapeNodes GetShapeNodes --> ApplyColorToShapeObj[("/fas:fa-paint-brush Apply Color to Shape Object")] ApplyColorToShapeObj --> CheckTargetShapes{{"/fas:fa-shapes Check Target Shapes"}} CheckTargetShapes --"If target has shapes"--> MakeIdentity[("/fas:fa-vector-square Make Identity on ShapeObj")] CheckTargetShapes --"No shapes in target"--> ParentShape[("/fas:fa-link Parent Shape to Target")] MakeIdentity --> ParentShape ParentShape --> CheckDeleteShape{{"/fas:fa-trash-alt Check Delete Shape"}} CheckDeleteShape --"deleteShape is True"--> DeleteOriginalShapes[("/fas:fa-trash Delete Original Shapes")] CheckDeleteShape --"deleteShape is False"--> SetShapeVisibility[("/fas:fa-eye Set Shape Visibility")] DeleteOriginalShapes --> RenameControl[("/fas:fa-text-width Rename Control")] SetShapeVisibility --> RenameControl RenameControl --> End[("fas:fa-stop-circle End")] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckShArgs fill:#ffcc00,stroke:#000,stroke-width:2px style UpdateArgs fill:#ff9999,stroke:#000,stroke-width:2px style CheckShapeAndTarget fill:#99ccff,stroke:#000,stroke-width:2px style SelectShapeAndTarget fill:#cc99ff,stroke:#000,stroke-width:2px style CheckCtrlName fill:#ffcc66,stroke:#000,stroke-width:2px style GetShapeNodes fill:#99ff99,stroke:#000,stroke-width:2px style ApplyColorToShapeObj fill:#66ccff,stroke:#000,stroke-width:2px style CheckTargetShapes fill:#f0ad4e,stroke:#000,stroke-width:2px style MakeIdentity fill:#d9534f,stroke:#000,stroke-width:2px style ParentShape fill:#5bc0de,stroke:#000,stroke-width:2px style CheckDeleteShape fill:#f0ad4e,stroke:#000,stroke-width:2px style DeleteOriginalShapes fill:#d9534f,stroke:#000,stroke-width:2px style SetShapeVisibility fill:#5bc0de,stroke:#000,stroke-width:2px style RenameControl fill:#5cb85c,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the shapeCtrl function:

  1. The process begins by checking if shArgs are provided. If so, it updates the arguments.

  2. If shapeObj and trgt are not provided, the function selects them manually.

  3. It then checks if a control name is provided, if not, the default name of the shape object is used.

  4. The function retrieves the shape nodes from the shape object and applies color to them.

  5. It checks if the target has existing shapes and makes identity on the shape object if required.

  6. The shape nodes are parented to the target object.

  7. Based on the deleteShape flag, it either deletes the original shapes or sets their visibility.

  8. If reName is True, the target control is renamed.

  9. 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'.
graph TB Start[("fa:fa-play Start")] --> CheckParams{"/fas:fa-check-circle Check Parameters"} CheckParams --"Parameters Validated"--> CreateControl["/fas:fa-plus-circle Create Control Shape"] CreateControl --"Control Shape Created"--> ApplyTransformations{"/fas:fa-sync-alt Apply Transformations"} ApplyTransformations --"Transformations Applied"--> ReturnControl["/fas:fa-arrow-right Return Control"] ReturnControl --"Control Returned"--> End["/fas:fa-stop End"] style Start fill:#00cc00,stroke:#000,stroke-width:3px style CheckParams fill:#ffcc00,stroke:#000,stroke-width:2px style CreateControl fill:#99ff99,stroke:#000,stroke-width:2px style ApplyTransformations fill:#99ccff,stroke:#000,stroke-width:2px style ReturnControl fill:#cc99ff,stroke:#000,stroke-width:2px style End fill:#ff6666,stroke:#000,stroke-width:3px
Flow Chart Description:

This flowchart illustrates the splineCtrl function:

  1. The function starts by validating the provided parameters.

  2. It then creates the specified control shape based on the given shape type and name.

  3. Applies necessary transformations like scaling and making identity.

  4. Returns the created control or control group depending on the control type.