eCtrl#

_images/as_eCtrl.jpg

eCtrl Features

:Advanced Control Maker Module:

The eCtrl module, like the asNode module, is a custom Python module tailored for use in VFX, specifically in rigging and animation within Autodesk Maya. Here are a few potential uses or features of the eCtrl module:

  1. Animation Control Rigging: eCtrl is designed to assist in building control rigs for animation. These rigs are crucial for animators to effectively manipulate 3D models.

  2. Custom Control Creations: The module provides tools or functions for creating custom controls in a rig, allowing for more tailored and efficient animation setups.

  3. User-Friendly Interface: eCtrl offers a user-friendly interface to interact with complex rigging and control systems in Maya, making it accessible to users with varying levels of scripting knowledge.

  4. Efficiency in Rigging Process: By automating aspects of control rigging, the module significantly improve workflow efficiency, saving time and effort in the rigging process.

  5. Integration with Maya’s API: It is designed to work seamlessly with Maya’s API, providing a more intuitive and Pythonic approach to rigging and animation tasks.

  6. Enhanced Animation Workflow: eCtrl streamline the animation workflow by simplifying the process of setting up and manipulating control rigs.

  7. Support for Complex Rigs: The module include features that support the creation and management of complex rigs, which are often required in detailed character animations.

eCtrl.__init__(self)#

To Support main auto rig scripts via eCtrl

_images/eCtrl.jpg

as_eCtrlMain_v1.5

About

Author: (Subbaiah) Subbu Addanki
Character Supervisor (Rigging) & Programmer

Visit

http://www.pythonscripting.com
http://subbuadd.blogspot.com

Contact

Mail Id: subbu.add@gmail.com
Mobile No: +91-9741454400 / +91-9949005359

Copyright (c) as_eCtrlMain

** (Subbaiah) Subbu Addanki. All Rights Reserved. **
eCtrl.addAngleAttr(self, nodeList, name, value=0, k=1, h=0, **shArgs)#

[shArgs : nl=nodeList, na=name, v=value, k=keyable, h=hidden]

Purpose:

:: Adds an angle attribute to a specified node in Autodesk Maya.

  • Enhances nodes with angle attributes, useful in rigging and animation processes.

Parameters:
  • nodeList<str/list> # The name or list of names of nodes to which the angle attribute will be added.

  • name<str> # The name of the angle attribute to be added.

  • value<float, optional> # The default value of the angle attribute, set to 0 by default.

  • keyable<int, optional> # Whether the attribute is keyable, set to 1 (True) by default.

  • hidden<int, optional> # Whether the attribute is hidden, set to 0 (False) by default.

Returns:

<pm.Attribute> # The newly added angle attribute on the node.

Code Examples:

>>> node_list = ["pCube1"]
>>> attr_name = "rotationAngle"
>>> default_value = 45.0
>>> keyable = 1
>>> hidden = 0
>>> added_attr = addAngleAttr(node_list, attr_name, default_value, keyable, hidden)
# Adds an angle attribute named 'rotationAngle' with a default value of 45.0 to 'pCube1', making it keyable and visible.
If shArgs Exist
If shArgs Does Not Exist
If Node List Exists
If Node List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Node List
/ Iterate Nodes
/ Select Nodes
/ Add Angle Attribute
/ End
Flow Chart Description:

This flowchart illustrates the addAngleAttr function:

  1. Checks if shArgs exist, and if so, parses the nodeList, name, value, k, and h from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of nodes to which the angle attribute will be added.

  4. Iterates through the node list.

  5. Adds an angle attribute with the specified name, value, k, and h to each node.

  6. Ends the process.

eCtrl.addBoolAttr(self, nodeList, name, value=True, **shArgs)#

[**shArgs : nl=nodeList, n=name, v=value]

Purpose:

:: Adds a boolean attribute to a node in Autodesk Maya.

  • This function is designed to create custom boolean attributes on nodes, allowing for enhanced node interactivity and control.

  • Useful in rigging, custom tools creation, and scene setup where boolean flags are required.

Parameters:
  • nodeList<str/list> # The name or list of names of nodes to which the attribute will be added.

  • name<str> # The name of the boolean attribute to be added.

  • value<bool, optional> # The default value of the boolean attribute. Defaults to True.

Returns:

None # The function does not return a value but adds the attribute to the specified node(s).

Code Examples:

>>> nodes = ["node1", "node2"]
>>> attributeName = "isVisible"
>>> defaultValue = True
>>> addBoolAttr(nodes, attributeName, defaultValue)
# Adds a boolean attribute named 'isVisible' with a default value of True to 'node1' and 'node2'.
If shArgs Exist
If shArgs Does Not Exist
If Node List Exists
If Node List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Node List
/ Iterate Nodes
/ Select Nodes
/ Add Boolean Attribute
/ Set Default Value
/ End
GetDefaultValue
Flow Chart Description:

This flowchart illustrates the addBoolAttr function:

  1. Checks if shArgs exist, and if so, parses the nodeList, name, and value from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of nodes to which the attribute will be added.

  4. Iterates through the node list.

  5. Adds a boolean attribute with the specified name to each node.

  6. Sets the default value of the added boolean attribute.

  7. Ends the process.

eCtrl.addEnumAttr(nodeList, name, enumNames, k=1, h=0, **shArgs)#

[shArgs : n=nodeList, na=name, en=enumNames, k=keyable, h=hidden]

Purpose:

:: Adds an enumeration attribute to a node in Autodesk Maya.

  • Ideal for creating custom dropdown menus or selection options on Maya nodes.

Parameters:
  • nodeList<str> # The node to which the enumeration attribute will be added.

  • name<str> # The name of the enumeration attribute to be added.

  • enumNames<list> # A list of strings representing the names for the enumeration options.

  • keyable<int, optional> # Whether the attribute is keyable, set to 1 (True) by default.

  • hidden<int, optional> # Whether the attribute is hidden, set to 0 (False) by default.

Returns:

<pm.Attribute> # The newly added enumeration attribute on the node.

Code Examples:

>>> node = "pCube1"
>>> attr_name = "colorOptions"
>>> enum_options = ["Red", "Green", "Blue"]
>>> keyable = 1
>>> hidden = 0
>>> addEnumAttr(node, attr_name, enum_options, keyable, hidden)
# Adds an enumeration attribute named 'colorOptions' to 'pCube1' with options 'Red', 'Green', 'Blue'.
If shArgs Exist
If shArgs Does Not Exist
If Node List Exists
If Node List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Node List
/ Add Enum Attribute
/ Select Node
/ End
Flow Chart Description:

This flowchart illustrates the addEnumAttr function:

  1. Checks if shArgs exist, and if so, parses the nodeList, name, enumNames, k, and h from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves the node to which the enumeration attribute will be added.

  4. Adds an enumeration attribute with the specified name, enumNames, k, and h to the node.

  5. Ends the process.

eCtrl.addFloatAttr(self, nodeList, name, value=0, k=1, h=0, minValue=None, maxValue=None, **shArgs)#

[shArgs : nl=nodeList, na=name, v=value, k=keyable, h=hidden, min=minValue, max=maxValue]

Purpose:

:: Adds a floating-point attribute to a node in Autodesk Maya.

  • Useful for adding custom float attributes to nodes, enabling finer control over various attributes and parameters.

Parameters:
  • nodeList<str/list> # The name or list of names of nodes to which the float attribute will be added.

  • name<str> # The name of the float attribute to be added.

  • value<float, optional> # The default value of the float attribute, set to 0 by default.

  • keyable<int, optional> # Whether the attribute is keyable, set to 1 (True) by default.

  • hidden<int, optional> # Whether the attribute is hidden, set to 0 (False) by default.

  • minValue<float, optional> # The minimum value for the attribute.

  • maxValue<float, optional> # The maximum value for the attribute.

Returns:

<pm.Attribute> # The newly added float attribute on the node.

Code Examples:

>>> node_list = ["pCube1"]
>>> attr_name = "customFloat"
>>> default_value = 3.5
>>> keyable = 1
>>> hidden = 0
>>> min_value = 0.0
>>> max_value = 10.0
>>> added_attr = addFloatAttr(node_list, attr_name, default_value, keyable, hidden, min_value, max_value)
# Adds a float attribute named 'customFloat' to 'pCube1' with specified parameters.
If shArgs Exist
If shArgs Does Not Exist
If Node List Exists
If Node List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Node List
/ Iterate Nodes
/ Select Nodes
/ Add Float Attribute
/ End
Flow Chart Description:

This flowchart illustrates the addFloatAttr function:

  1. Checks if shArgs exist, and if so, parses the nodeList, name, value, k, h, minValue, and maxValue from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of nodes to which the float attribute will be added.

  4. Iterates through the node list.

  5. Adds a float attribute with the specified name, value, k, h, minValue, and maxValue to each node.

  6. Ends the process.

eCtrl.addIntAttr(self, nodeList, name, value=0, **shArgs)#

[**shArgs : nl=nodeList, na=name, v=value]

:: Adds an integer attribute to one or more nodes in Autodesk Maya.

Parameters:
  • nodeList – (<type str/list>) # The name or list of names of nodes to which the attribute will be added.

  • name – (<type str>) # The name of the integer attribute to be added.

  • value – (<type int>, optional) # The default value of the integer attribute. Defaults to 0.

Returns:

(<type pm.Attribute>) # The added integer attribute.

If shArgs Exist
If shArgs Does Not Exist
If Node List Exists
If Node List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Node List
/ Iterate Nodes
/ Select Nodes
/ Add Integer Attribute
/ Set Default Value
/ End
GetDefaultValue
Flow Chart Description:

This flowchart illustrates the addIntAttr function:

  1. Checks if shArgs exist, and if so, parses the nodeList, name, and value from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of nodes to which the attribute will be added.

  4. Iterates through the node list.

  5. Adds an integer attribute with the specified name to each node.

  6. Sets the default value of the added integer attribute.

  7. Ends the process.

eCtrl.addMatrixAttr(self, nodeList, name, **shArgs)#

[shArgs : nl=nodeList, na=name]

Purpose:

:: Adds a matrix attribute to a specified node in Autodesk Maya.

  • Facilitates the addition of complex matrix attributes to nodes for advanced operations and transformations.

Parameters:
  • nodeList<str/list> # The name or list of names of nodes to which the matrix attribute will be added.

  • name<str> # The name of the matrix attribute to be added.

Returns:

<pm.Attribute> # The newly added matrix attribute on the node.

Code Examples:

>>> node_list = ["pCube1", "pSphere1"]
>>> attr_name = "transformationMatrix"
>>> added_attr = addMatrixAttr(node_list, attr_name)
# This will add a matrix attribute named 'transformationMatrix' to 'pCube1' and 'pSphere1'.
If shArgs Exist
If shArgs Does Not Exist
If Node List Exists
If Node List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Node List
/ Iterate Nodes
/ Select Nodes
/ Add Matrix Attribute
/ End
Flow Chart Description:

This flowchart illustrates the addMatrixAttr function:

  1. Checks if shArgs exist, and if so, parses the nodeList and name from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of nodes to which the matrix attribute will be added.

  4. Iterates through the node list.

  5. Adds a matrix attribute with the specified name to each node.

  6. Ends the process.

eCtrl.addStringAttr(self, nodeList, name, value='', **shArgs)#

[**shArgs : nl=nodeList, n=name, v=value]

Purpose:

:: Adds a string attribute with a specified name and optional initial value to one or more nodes in Autodesk Maya.

Parameters:
  • nodeList – (<type list>) # List of nodes to which the attribute will be added.

  • name – (<type str>) # Name of the string attribute to be added.

  • value – (<type str>, optional) # Initial value for the string attribute. Defaults to an empty string.

Returns:

(<type pm.Attribute>) # The added string attribute.

If shArgs Exist
If shArgs Does Not Exist
If Node List Exists
If Node List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Node List
/ Iterate Nodes
/ Select Nodes
/ Add String Attribute
/ Set Initial Value
/ End
GetInitialValue
Flow Chart Description:

This flowchart illustrates the addStringAttr function:

  1. Checks if shArgs exist, and if so, parses the nodeList, name, and value from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of nodes to which the attribute will be added.

  4. Iterates through the node list.

  5. Adds a string attribute with the specified name to each node.

  6. Sets the initial value of the added string attribute.

  7. Ends the process.

eCtrl.add_Attrs(self, ctrlList=None, attr='RotateOrder', attrDivider=True, **shArgs)#

[**shArgs : ctrlList =cl, attr =a, attrDivider =ad]

Purpose:

:: Adds specified attributes to a list of controllers in Autodesk Maya.

Parameters:
  • ctrlList – (<type list, optional>) # The list of controllers to add the attribute to. Defaults to None.

  • attr – (<type str>) # The name of the attribute to add.

  • attrDivider – (<type bool, optional>) # Flag to add a divider for the attribute. Defaults to True.

Returns:

(<type None>) # None

If shArgs Exist
If shArgs Does Not Exist
For Each Selected Object
If Control List Exists
If Control List Does Not Exist
If Control is Not a Curve
If Control is a Curve
If Letters are Considered
If Letters are Not Considered
For Each Control
If Control List is Not Empty
If Control List is Empty
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Selected Objects
/ Check Control List
/ Iterate Control List
/ Select Controls
/ Check Control Type
/ Continue Iteration
/ Mirror Control
/ Snap Vertices
/ Mirror Vertices
/ Center Pivot
/ Snap Shape to Opposite
/ Append to Mirrored List
/ Select Vertices
/ Calculate Opposite Position
/ Set Opposite Position
/ Select Mirrored Controls
/ End
Flow Chart Description:

This flowchart illustrates the mirrorCtrlShapes function:

  1. Checks if shArgs exist, and if so, parses the ctrlList, srcStr, repStr, repCount, and letters from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of selected controls (control curves).

  4. For each selected control:
    • Checks if it’s a curve shape (control shape).

    • If it’s not a curve shape, continues to the next control.

    • If it’s a curve shape, proceeds to mirror it.

  5. If letters are considered in the mirroring process:
    • Snaps vertices to their opposite positions.

    • Centers the pivot of the mirrored control.

    • Snaps the shape to the opposite location.

  6. If letters are not considered:
    • Mirrors vertices by changing their X-coordinates to the opposite side.

  7. Appends the mirrored control to the list of mirrored controls.

  8. After processing all controls, selects the mirrored controls if the list is not empty.

eCtrl.applyCtrlColor(self, ctrlList=None, colorNum=None, LPrefix=None, RPrefix=None, CPrefix=None, **shArgs)#

[**shArgs : cl=ctrlList, cn=colorNum, lp=LPrefix, rp=RPrefix, cp=CPrefix]

_images/applyCtrlColor.jpg

Purpose:

:: Changes control colors based on prefix, colorVal

Parameters:
  • ctrlList – (<type list>) # List of control names or a single control name.

  • colorNum – (<type int>) # The color value to set for the controls.

  • LPrefix – ([<type str>, <type int>]) # Left side prefix and its value for controls.

  • RPrefix – ([<type str>, <type int>]) # Right side prefix and its value for controls.

  • CPrefix – ([<type str>, <type int>]) # Custom prefix and its value for controls.

Returns:

(<type None>) # None

Code Examples:

>>> control_list = ['LeftArm_Ctrl', 'RightArm_Ctrl']  # Specify a list of control names
>>> color_number = 17  # Specify the color value
>>> left_prefix = ['L', 6]  # Specify the prefix and color value for controls on the left side
>>> right_prefix = ['R', 13]  # Specify the prefix and color value for controls on the right side
>>> custom_prefix = ['C', 10]  # Specify the prefix and color value for custom controls
If shArgs Exist
If shArgs Does Not Exist
If ctrlList is Not Provided
For Each Ctrl in Ctrl List
If Ctrl Starts With LPrefix
If Ctrl Starts With RPrefix
If Ctrl Starts With CPrefix
If Ctrl Doesn't Match Prefixes
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Selected Objects
/ Select Ctrl List
/ Process Ctrl List
/ Check Ctrl Prefix
/ Set LPrefix Color
/ Set RPrefix Color
/ Set CPrefix Color
/ Set Default Color
/ End
/ Success: Ctrl Color Applied
Flow Chart Description:

This flowchart illustrates the applyCtrlColor function:

  1. Checks if shArgs exist, and if so, parses the arguments.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of control names.

  4. If ctrlList is not provided, selects the control list interactively.

  5. Processes each control in the control list:
    • Checks if the control name matches the specified prefixes (LPrefix, RPrefix, CPrefix).

    • Sets the color of the control based on the prefix or uses the default color.

  6. Prints a success message after applying color to the controls.

eCtrl.arrowCtrl(self, ctrlName=None, grpLevel=3, snapPiv=True, numArrows=4, initRot=[0, 0, 0], ctrlType=1, grpSufxList=None, colorVal=None, **shArgs)#

[**shArgs : ctrlName=n, grpLevel=gl, snapPiv=sp, numArrows=na, initRot=ir, ctrlType=ct, grpSufxList=gs, colorVal=cv]

Purpose:

:: Creates arrow-shaped control objects in Autodesk Maya with customizable properties such as number of arrows, initial rotation, and control type.

  • Ideal for rigging scenarios where arrow-shaped controls are required.

  • Offers a variety of control shapes and configurations for diverse rigging needs.

Parameters:
  • ctrlName<str, optional> #Name for the arrow control. Default naming used if not provided.

  • grpLevel<int, optional> #Specifies the hierarchy level for grouping the control. Default is 3.

  • snapPiv<bool, optional> #Determines whether to snap the pivot of the groups to the control. Default is True.

  • numArrows<int, optional> #Specifies the number of arrows in the control. Default is 4.

  • initRot<list, optional> #Initial rotation of the control, specified as [x, y, z]. Default is [0, 0, 0].

  • ctrlType<int, optional> #Type of arrow control to create, with various shape options. Default is 1.

  • grpSufxList<list, optional> #List of suffixes for the control’s groups. Default is None.

  • colorVal<int, optional> #Color value to apply to the control. Default is None.

Returns:

<list> #A list containing the arrow control and its top group as Maya nodes, based on grpLevel.

If ctrlName is specified
If ctrlName is not specified
Type 1
Type 2
Type 3
Type 4
Type 5
Type 6
Start
/ Check Control Name
/ Create Control
/ Set Default Name
/ Choose Control Type
/ Create Arrow Type 1
/ Create Arrow Type 2
/ Create Arrow Type 3
/ Create Arrow Type 4
/ Create Arrow Type 5
/ Create Arrow Type 6
/ Finalize Control
End
Flow Chart Description:

This flowchart illustrates the arrowCtrl function:

  1. The process starts by checking if a control name is provided.

  2. If not specified, a default control name is set.

  3. The control type is selected from six available options.

  4. Based on the chosen type, an arrow-shaped control is created.

  5. The control is then finalized with initial rotation, group level, pivot snapping, suffix list, and color value.

  6. The function concludes with the return of the control and its top group.

eCtrl.as_eCtrl(self)#

To Support writing main tools while there are repetitive tasks like creating controls with eCtrl module

eCtrl.attrDivider(self, ctrlList=None, dividerName=None, **shArgs)#

[shArgs : cl=ctrlList, dn=dividerName]

Purpose:

:: Adds a divider attribute to a list of controls in Autodesk Maya, enhancing organization and readability.

  • Useful for segregating control attributes in complex rigs or scripts.

  • Adds divider ‘_’ * (4 to 12 range)

Parameters:
  • ctrlList<None/str/list, optional> # The list of control nodes to add the divider to. If None, operates on the selected nodes.

  • dividerName<None/str, optional> # The name of the divider attribute. If None, uses a sequence of underscores.

Returns:

None # This function does not return a value but modifies the control nodes directly.

Code Examples:

>>> control_list = ["ctrl1", "ctrl2"]
>>> divider_name = "SECTION"
>>> attrDivider(control_list, divider_name)
# Adds a divider named 'SECTION' to 'ctrl1' and 'ctrl2'.
If shArgs Exist
If shArgs Does Not Exist
If Control List Exists
If Control List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Control List
/ Add Divider Attribute
/ Select Controls
/ End
Flow Chart Description:

This flowchart illustrates the attrDivider function:

  1. Checks if shArgs exist, and if so, parses the ctrlList and dividerName from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves the list of control nodes to which the divider attribute will be added.

  4. Adds a divider attribute with the specified dividerName or a sequence of underscores to the control nodes.

  5. Ends the process.

eCtrl.ballCtrl(self, ctrlName=None, grpLevel=3, initRot=[0, 0, 0], ctrlType=1, grpSufxList=None, **shArgs)#

[shArgs : ctrlName=n, grpLevel=gl, initRot=ir, ctrlType=ct, grpSufxList=gsl]

Purpose:

:: Generates a ball-shaped control in Autodesk Maya, providing a versatile tool for rigging and animation tasks.

  • Useful for creating controls that require a spherical shape, such as for eye rigs or pivot points in mechanical rigs.

  • The ability to define control types and group suffixes allows for greater adaptability in rig setups.

Parameters:
  • ctrlName<str, optional> # Name for the ball control. If not specified, a default name is used.

  • grpLevel<int, optional> # Specifies the hierarchy level for grouping the control. Default is 3.

  • initRot<list, optional> # Initial rotation of the control, specified as [x, y, z]. Default is [0, 0, 0].

  • ctrlType<int, optional> # Determines the style of the ball control. Default is 1.

  • grpSufxList<list, optional> # List of suffixes for group names, if needed. Default is None.

Returns:

<list> # A list containing the ball control and its top group as Maya nodes, structured as per grpLevel.

Code Examples:

>>> ball_control = ballCtrl(ctrlName="myBallCtrl", grpLevel=2, ctrlType=1)
# Creates a ball control with specified name, group level, and control type.

:param ctrlName : name(str) #_ name for the control which is going to be created :param grpLevl : num(int) #_ Number of top groups on control to be created :param initRot : [float, float, float] #_ Rotates the shape initially :param ctrlType : 1|2 (Max: 2) #_ Shape1 : Single Circle, Shape2 : Dual Circle :param grpSufxList (list, optional): List of suffixes for group names. Defaults to None. :return: List of Nodes (control and top group) as asNodes.

Usage:

ctrl              =eCtrl.ballCtrl(ctrlName)[0]
ctrlGrp           =eCtrl.ballCtrl(ctrlName)[-1]
ctrl, ctrlGrp =eCtrl.ballCtrl(ctrlName)

Returns:

if grpLevel:
        return [ctrl, ctrlGrp(topGrp)]  #_ asNodes
else:
        return [ctrl, ctrl]                     #_ asNodes
If shArgs Exist
If shArgs Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Generate Control
/ Rotate Control
/ Group Control
/ Apply Color
/ End
Flow Chart Description:

This flowchart illustrates the ballCtrl function:

  1. Checks if shArgs exist, and if so, parses the function arguments from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Generates a ball-shaped control in Autodesk Maya based on the specified control type.

  4. Rotates the control based on the initRot parameter.

  5. Groups the control based on the grpLevel and grpSufxList parameters.

  6. Applies color to the control using the applyCtrlColor method.

  7. Ends the process.

eCtrl.boxCtrl(self, ctrlName=None, grpLevel=1, snapPiv=False, grpSufxList=None, grpPrfxList=None, ctrlType=1, ctrl2Axis='x', **shArgs)#

[**shArgs : ctrlName =n, grpLevel =gl, snapPiv =sp, grpSufxList =gsl, grpPrfxList =gpl, ctrlType =ct, ctrl2Axis =c2a]

Purpose:

:: Creates a box-shaped control in Autodesk Maya, offering flexibility in design and application. The control can be customized in terms of size, group level, pivot snapping, and axis orientation.

  • This function is beneficial for rigging and animation where box-shaped controls are needed.

  • It allows for adjustments in grouping, pivot snapping, and control axis to suit various rigging requirements.

Parameters:
  • ctrlName<str, optional> #Name for the control to be created. If not provided, defaults to ‘as_Box_Ctrl’.

  • grpLevel<int, optional> #Number of top groups for the control. Default is 1.

  • snapPiv<bool, optional> #Determines if group’s pivot should snap to the control. Default is False.

  • grpSufxList<list, optional> #List of suffixes for group names. Defaults to None.

  • grpPrfxList<list, optional> #List of prefixes for group names. Defaults to None.

  • ctrlType<int> #Defines the type of the control shape. Default is 1.

  • ctrl2Axis<str> #Axis for the control orientation. Defaults to ‘x’.

Returns:

<list> #List of Nodes (control and top group) as asNodes, depending on the specified grpLevel.

If ctrlName is specified
If ctrlName is not specified
Type 1
Type 2
Axis X
Axis Y
Start
/ Check Control Name
/ Create Control
/ Set Default Name
/ Choose Control Type
/ Create Box Type 1
/ Create Box Type 2
/ Finalize Control
/ Check Axis
/ Align to X-axis
/ Align to Y-axis
End
Flow Chart Description:

This flowchart illustrates the boxCtrl function:

  1. The function starts by checking if a control name is specified.

  2. If not, a default control name is assigned.

  3. The control type is selected between two options.

  4. For Type 1, a simple box control is created.

  5. For Type 2, the function checks the specified axis for alignment.

  6. The control is then aligned according to the chosen axis (X or Y).

  7. The control is finalized with group levels, pivot snapping, suffixes, and prefixes.

  8. The function ends by returning the control and its top group.

eCtrl.bulletCtrl(self, ctrlName=None, grpLevel=1, initRot=[0, 0, 0], ctrlType=1, **shArgs)#

[**shArgs : ctrlName =n, grpLevel =gl, initRot =ir, ctrlType =ct]

Purpose:

:: Creates a bullet-shaped control in Autodesk Maya, ideal for specific rigging needs such as projectiles or fast-moving objects.

  • The bullet control is perfect for animations involving projectiles or for rigging characters with bullet-like features.

  • The control’s shape and size can be adjusted to match various design requirements, making it versatile for different scenarios.

Parameters:
  • ctrlName<str, optional> #Name for the control which is going to be created

  • grpLevel<int, optional> #Number of top groups on control to be created

  • initRot<list, optional> #Rotates the shape initially

  • ctrlType<int, optional> #Shape options. Shape1: Single Circle, Shape2: Dual Circle

Returns:

<list> #A list containing the control and its top group as Maya nodes, based on grpLevel.

If ctrlName is specified
If ctrlName is not specified
Control Type 1
Control Type 2
Start
/ Check Control Name
/ Create Control
/ Set Default Name
/ Check Control Type
/ Create Bullet Curve
/ Create Circle
/ Rotate and Freeze Transform
/ Finalize Control
End
Flow Chart Description:

This flowchart illustrates the bulletCtrl function:

  1. The process starts by checking if a control name is specified.

  2. If not specified, a default control name is set.

  3. Depending on the control type, either a bullet curve or a circle is created.

  4. The control is rotated and its transformations are frozen.

  5. The control is finalized by creating its group and applying color.

  6. The process ends with the creation of the bullet control and its group.

eCtrl.circleCtrl(self, ctrlName=None, grpLevel=2, initRot=[0, 0, 0], ctrlType=1, grpSufxList=None, **shArgs)#

[shArgs : ctrlName=n, grpLevel=gl, initRot=ir, ctrlType=ct, grpSufxList=gsl]

_images/circleCtrl_INF.jpg

Purpose:

:: Efficiently generates a circular control in Autodesk Maya, ideal for rigging and animation purposes.

  • The circle control serves as a versatile rigging element for various animation needs, providing intuitive manipulation for animators.

  • Customizable rotation, group levels, and multiple shape options enhance the utility and adaptability of the control in a rigging context.

Parameters:
  • ctrlName<str, optional> # Name to assign to the circle control. Defaults to ‘as_Circle_Ctrl’ if None.

  • grpLevel<int, optional> # Number of grouping levels for organizing the control in the scene. Default is 2.

  • initRot<list> # Initial rotation of the control, specified as [x, y, z].

  • ctrlType<int, optional> # Type of circle control, with options 1 for a single circle and 2 for a dual circle. Default is 1.

  • grpSufxList<list, optional> # List of suffixes for naming the control groups. Defaults to None.

Returns:

<list> # A list containing the circle control and its top group as asNodes.

Code Examples:

>>> circle_control = circleCtrl(ctrlName="myCircleCtrl", grpLevel=3, initRot=[45, 0, 0], ctrlType=2)
# Creates a dual circle control named "myCircleCtrl" with specific rotation and group level.
_images/circleCtrl_FC.jpg
_images/circleCtrl-MM.png
eCtrl.clavicleCtrl(self, ctrlName=None, sidePos='L_', grpLevel=1, ctrlType=1, initRot=[0, 0, 0], **shArgs)#

[shArgs : cn=ctrlName, sp=sidePos, gl=grpLevel, ct=ctrlType, ir=initRot]

Purpose:

:: Creates a clavicle control in Autodesk Maya, typically used in character rigging for shoulder movement.

  • The clavicle control assists in creating realistic shoulder and upper torso animations.

  • Offers customization in terms of side position, group level, control type, and initial rotation.

Parameters:
  • ctrlName<str, optional> # Name for the clavicle control. Default is generated if not provided.

  • sidePos<str, optional> # Side position for the control, typically ‘L_’ for left or ‘R_’ for right. Default is ‘L_’.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Default is 1.

  • ctrlType<int, optional> # Type of the clavicle control to be created. Default is 1.

  • initRot<list, optional> # Initial rotation of the control, given as [x, y, z]. Default is [0, 0, 0].

Returns:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> control_name = "clavicleControl"
>>> side_position = "L_"
>>> group_level = 1
>>> control_type = 1
>>> initial_rotation = [0, 45, 0]
>>> clavicle_control = clavicleCtrl(control_name, side_position, group_level, control_type, initial_rotation)
# Creates a left-sided clavicle control with specified parameters.
Side Position 'L_' or 'LT_'
Side Position 'R_' or 'RT_'
Start
/ Check Side Position
/ Create Ctrl 'L_'
/ Create Ctrl 'R_'
/ Finalize Ctrl 'L_'
/ Finalize Ctrl 'R_'
End
Flow Chart Description:

This flowchart illustrates the clavicleCtrl function:

  1. The process begins by checking the sidePos (’L_’ or ‘R_’).

  2. Based on the side position, the corresponding clavicle control is created.

  3. The control is then finalized by applying initial rotation, freezing transformations, and setting the group level.

  4. The function concludes by returning the control and its top group as Maya nodes.

eCtrl.cogCtrl(self, ctrlName=None, grpLevel=1, ctrlType=1, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType]

Purpose:

:: Creates a cog control in Autodesk Maya, suitable for Center of Gravity (COG) setups.

  • This control is ideal for rigging characters or objects where a COG control is required.

  • Offers flexibility in control design with options for different types and group levels.

Parameters:
  • ctrlName<str, optional> # Name for the cog control. Default is ‘as_COG_Ctrl’.

  • grpLevel<int> # The number of top groups on the control to be created.

  • ctrlType<int> # Type of COG control to create. Options include 1 for Single Circle, 2 for Dual Circle.

Returns:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> control_name = "COG_Control"
>>> group_level = 2
>>> control_type = 1
>>> cogControl = cogCtrl(control_name, group_level, control_type)
# This creates a COG control with specified name, group level, and type.
If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Create COG Control
Create Control Group
Snap Pivot to Control
Apply Control Color
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create COG Control
/ Create Control Group
/ Snap Pivot to Control
/ Apply Control Color
/ End
Flow Chart Description:

This flowchart illustrates the cogCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName, grpLevel, and ctrlType.

  3. Creates a COG control with the specified ctrlName and ctrlType.

  4. Creates a control group based on the grpLevel.

  5. Snaps the pivot of the control to the control itself.

  6. Applies control color to the control.

eCtrl.coneCtrl(self, ctrlName=None, grpLevel=3, ctrlType=2, initRot=[0, 0, 0], snapPiv=1, grpSufxList=None, colorVal=None, **shArgs)#

[**shArgs : ctrlName =n, grpLevel =gl, ctrlType =ct, initRot =ir, snapPiv =sp, grpSufxList =gsl, colorVal =cv]

Purpose:

:: Creates a cone-shaped control with customization options for initial rotation, type, group suffixes, pivot snapping, and color. :: Useful for rigging and animation control setups in Autodesk Maya.

Parameters:
  • ctrlName – (<str>, optional) # Name for the control. Defaults to ‘as_Cone_Ctrl’ if not provided.

  • grpLevel – (<int>) # Number of top groups on the control to be created.

  • ctrlType – (<int>) # Defines the type of cone control to create.

  • initRot – (<list of floats>, optional) # Initial rotation of the control shape. Defaults to [0, 0, 0] if not provided.

  • snapPiv – (<int>) # Determines if the pivot is snapped (0 or 1).

  • grpSufxList – (<list>, optional) # List of suffixes for the control groups.

  • colorVal – (<any>, optional) # Color value for the control.

Returns:

(<list>) # If grpLevel is provided, returns [ctrl, ctrlGrp(topGrp)] as asNodes; otherwise, returns [ctrl, ctrl].

Code Examples:

>>> ctrl_name = "myConeCtrl"
>>> group_level = 3
>>> control_type = 2
>>> initial_rotation = [45, 0, 0]
>>> snap_pivot = 1
>>> group_suffix_list = ["grp1", "grp2"]
>>> color_value = "red"
>>> ctrl, ctrl_grp = eCtrl.coneCtrl(ctrl_name, group_level, control_type, initial_rotation, snap_pivot, group_suffix_list, color_value)
# Creates a cone control with specified parameters.
If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Create Cone Control
Finalize Control
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create Cone Control
/ Finalize Control
/ End
Flow Chart Description:

This flowchart illustrates the coneCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName, grpLevel, ctrlType, initRot, snapPiv, grpSufxList, and colorVal.

  3. Creates a cone control with the specified parameters.

  4. Finalizes the control by calling the finalizeCtrl function.

  5. Ends the process.

eCtrl.createCtrlDir(self, trgtObj=None, ctrlName=None, **shArgs)#

[shArgs: to=trgtObj, cn=ctrlName]

Purpose:

:: Facilitates the creation of direction controls, essential for rigging joints like eyes, knees, or elbows.

  • Offers a streamlined approach to setting up directional constraints for rigging.

  • Enhances rigging precision, especially for pivotal joints requiring directional guidance.

Parameters:
  • trgtObj<str> #The target object, usually a joint, for the control direction (e.g., eyeJnt, kneeJnt).

  • ctrlName<str, optional> #The name for the control to be created. If not specified, derived from the target object.

Returns:

<Maya Node> #The created control direction node, typically an annotation object.

Code Examples:

>>> createCtrlDir(trgtObj="eyeJnt", ctrlName="eyeDirectionCtrl")
# Creates a direction control for the 'eyeJnt' named 'eyeDirectionCtrl'.

>>> createCtrlDir(trgtObj="kneeJnt")
# Creates a direction control for the 'kneeJnt' with an auto-generated name.
shArgs provided
shArgs not provided
Two objects selected
Invalid or no selection
Start
/ Check shArgs
/ Update Arguments
/ Check Selection
/ Determine Targets
/ Assign Targets
End
/ Create Locator
/ Create Annotation
/ Position Annotation Object
/ Parent Annotation Object
/ Snap Locator
/ Parent Locator
/ Apply Constraints
/ Template Annotation
Return Annotation Object
Flow Chart Description:

This flowchart illustrates the createCtrlDir function:

  1. The function starts by checking if shArgs are provided and updates arguments accordingly.

  2. If no arguments are provided, it checks the current selection and assigns targets if two objects are selected.

  3. Determines the target object and control name, then creates a locator for direction.

  4. An annotation object is created and positioned according to the target.

  5. The annotation object is parented to the target and the locator is snapped and parented to the control.

  6. Constraints are applied to establish the directional relationship.

  7. The annotation is set to template mode for visual guidance.

  8. The function returns the annotation object as the control direction node.

eCtrl.defCtrl(self, ctrlName=None, grpLevel=1, snapPiv=True, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, sp=snapPiv]

Purpose:

:: Creates a control with specified naming, grouping, and pivot snapping options.

Parameters:
  • ctrlName<str, optional> # Name for the control to be created.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Default is 1.

  • snapPiv<bool, optional> # Whether to snap the control’s pivot. Default is True.

Returns:

<list> # If grpLevel is provided, returns [control, top group] as asNodes; otherwise, returns [control, control].

If ctrlName is specified
If ctrlName is not specified
Start
/ Check Control Name
/ Create Control
/ Set Default Name
/ Create Circles
/ Combine Curves into Control
/ Group Control
/ Apply Control Color
End
Flow Chart Description:

This flowchart illustrates the defCtrl function:

  1. The process begins by checking if a control name is specified.

  2. If not specified, a default control name is assigned.

  3. Three circles are created to form the control.

  4. The circles are combined into a single control.

  5. The control is grouped according to the specified group level, with an option to snap the pivot.

  6. The control color is applied.

  7. The process concludes with the return of the control and its group.

eCtrl.dimondCtrl(self, ctrlName=None, grpLevel=3, initRot=[0, 0, 0], ctrlType=3, grpSufxList=None, snapPiv=0, colorVal=None, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ir=initRot, ct=ctrlType, gsl=grpSufxList, sp=snapPiv, cv=colorVal]

Purpose:

:: Constructs a diamond-shaped control in Autodesk Maya, suitable for various rigging applications. Offers customization in terms of control name, group level, initial rotation, control type, group suffixes, pivot snapping, and color.

  • This function is ideal for creating visually distinctive and functional control handles in rigging scenarios.

  • The diamond shape can provide an intuitive and user-friendly control for animators and riggers.

Parameters:
  • ctrlName<str, optional> # Name for the diamond control. Defaults to ‘as_Dimond_Ctrl’.

  • grpLevel<int, optional> # Specifies the hierarchy level for grouping the control. Default is 3.

  • initRot<list of float, optional> # Initial rotation of the control, specified as [x, y, z]. Default is [0, 0, 0].

  • ctrlType<int, optional> # Determines the shape of the diamond control. Options include different diamond shapes. Default is 3.

  • grpSufxList<list of str, optional> # Suffix list for the control’s groups.

  • snapPiv<int> # Determines if the pivot is snapped (0 or 1). Default is 0.

  • colorVal<any, optional> # Color value for the control. Defaults to None.

Returns:

<list of asNode> # A list with the control and its top group as Maya nodes, based on grpLevel.

Usage Examples:

>>> diamond_control = dimondCtrl(ctrlName="myDiamondCtrl", ctrlType=3)[0]
# Creates a diamond control with a specific shape and default settings.

>>> diamond_control, diamond_control_group = dimondCtrl(ctrlName="customDiamond", ctrlType=4, grpLevel=2, colorVal=6)
# Creates a custom diamond control with a specific group level, control type, and color.

:param ctrlName : name(str) #_ name for the control which is going to be created :param grpLevl : num(int) #_ Number of top groups on control to be created :param initRot : [float, float, float] #_ Rotates the shape initially :param ctrlType : 1|2|3 etc #_ One of 5 Shapes can be returned :param grpSufxList (list, optional): List of suffixes for the control groups. :param snapPiv (int): Determines if the pivot is snapped (0 or 1). :param colorVal (any, optional): Color value for the control. :return: If grpLevel is provided, returns [ctrl, ctrlGrp(topGrp)] as asNodes; otherwise, returns [ctrl, ctrl].

If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Rotate Diamond Control
Freeze Diamond Control
Delete History
Create Control Group
Apply Control Color
Finalize Control
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create Diamond Control
/ Rotate Diamond Control
/ Freeze Diamond Control
/ Delete History
/ Create Control Group
/ Apply Control Color
/ Finalize Control
/ End
Flow Chart Description:

This flowchart illustrates the dimondCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName, grpLevel, initRot, ctrlType, grpSufxList, snapPiv, and colorVal.

  3. Creates a diamond control based on the specified ctrlType.

  4. Rotates the diamond control based on the provided initRot values.

  5. Freezes the transformations of the control.

  6. Deletes the history of the control.

  7. Creates a control group based on the grpLevel.

  8. Applies control color to the control.

  9. Finalizes the control by calling finalizeCtrl from the eCtrl module.

eCtrl.edgeLoopCtrl(self, ctrlName=0, closeLoop=1, grpLevel=0, edgeList=0, oneShape=1, curvDegree=1, stepVal=1, offset=0, snapPiv=1, multiCtrls=0, **shArgs)#

[shArgs : n=ctrlName, cl=closeLoop, gl=grpLevel, el=edgeList, os=oneShape, cd=curvDegree, sv=stepVal, sp=snapPiv, o=offset, mc=multiCtrls]

Purpose:

:: Generates a control based on an edge loop in Autodesk Maya, with various customization options for shape, grouping, and pivot settings.

  • This function is particularly useful for rigging and animation tasks where edge loop based controls are needed.

  • Offers flexibility to create single or multiple controls based on edge loops, with adjustable degree, step value, and offset.

Parameters:
  • ctrlName<int/str, optional> # Name for the control to be created. Defaults to 0 if not provided.

  • closeLoop<bool, optional> # Specifies whether to close the first and last edges. Defaults to True.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Defaults to 0.

  • edgeList<list/str, optional> # List of edges or a single edge to create the control from. If None, selection is used.

  • oneShape<bool, optional> # Determines if a single shape or multiple shapes should be created. Defaults to True.

  • curvDegree<int, optional> # Degree of the curve for the control. Ranges from 1 to 5. Defaults to 1.

  • stepVal<int, optional> # Step value to skip vertices. Defaults to 1 (no skip).

  • offset<int, optional> # Offset value for scaling the control. Defaults to 0.

  • snapPiv<bool, optional> # If True, snaps group pivot to the control. Defaults to True.

  • multiCtrls<bool, optional> # If True, creates multiple controls for each edge in edgeList. Defaults to False.

Returns:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> ctrl_name = "myEdgeLoopCtrl"
>>> edge_loop = ["edge1", "edge2", "edge3"]
>>> control, control_group = edgeLoopCtrl(ctrlName=ctrl_name, edgeList=edge_loop, grpLevel=2)
# This will create a control based on the specified edge loop with 2 group levels.

:param ctrlName : name(str) #_ name for the control which is going to be created :param closeLoop : True | False #_ Closes the first and last edges :param grpLevl : num(int) #_ Number of top groups on control to be created :param edgeList : None | strList | str #_ If edgeList is not given, edges are selected from selection

#_ If singe edge is given, edgeLoop will be selected

:param oneShape : True | False #_ If not oneShape, multiple shapes equal to no of edges will be created :param curvDegree : 1|2|3|4|5 #_ Used for the degree of the curve :param stepVal : 1|2|etc #_ Skips number of vertices (stepVal-1), if stepVal is more than 1 :param offset : num(int) #_ Keeps the created ctrl with the offset in scaling :param snapPiv : True | False #_ Snaps Group pivot to ‘edgeLoopCtrl’

CtrlName provided
CtrlName not provided
EdgeList provided
EdgeList not provided
Single Control
Multiple Controls
Start
/ Check Control Name
/ Check Edge List Provided
/ Assign Default Ctrl Name
/ Check Multiple Controls
/ Select Edges from Selection
/ Create Single Control
/ Create Multiple Controls
/ Finalize Control
End
Flow Chart Description:

This flowchart illustrates the edgeLoopCtrl function:

  1. The function starts by checking if a control name is provided. If not, a default name is assigned.

  2. It then checks if an edge list is provided. If not, edges are selected from the current selection.

  3. The function determines whether to create a single control or multiple controls based on the ‘multiCtrls’ parameter.

  4. For a single control, it creates one control based on the provided edge loop.

  5. For multiple controls, it creates individual controls for each edge in the edge list.

  6. Finally, the function finalizes the control with group levels, pivot snapping, and color application.

  7. The process ends by returning the control and its top group.

eCtrl.executeFile(self, filePath, fileName=None, **shArgs)#

[shArgs : fp=filePath, fn=fileName]

Purpose:

:: Executes a script file in Autodesk Maya, allowing for dynamic loading and running of external Python or MEL scripts.

  • Facilitates the execution of external scripts, enhancing the flexibility of workflow in Maya.

Parameters:
  • filePath<str> # Path of the file to execute.

  • fileName<str, optional> # Name of the file to execute, if not included in the filePath.

Returns:

None # This function does not return a value but executes the script and prints any missing lines or execution status.

Code Examples:

>>> file_path = "/path/to/script.py"
>>> executeFile(file_path)
# Executes the script located at '/path/to/script.py'.
If shArgs Exist
If shArgs Does Not Exist
If File Exists
If File Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Check File Existence
/ Open File
/ Missing File Warning
/ Process File
/ End
Flow Chart Description:

This flowchart illustrates the executeFile function:

  1. Checks if shArgs exist, and if so, parses the filePath and fileName from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Checks if the file specified by filePath exists.

  4. If the file exists, opens and processes the file.

  5. If the file does not exist, displays a missing file warning.

  6. Ends the process.

eCtrl.exportCtrlShapes(self, filePath=None, fileName=None, ctrlList=None, sufxList='_Ctrl', exFolder='AHSS_Lib', **shArgs)#

[shArgs : fp=filePath, fn=fileName, cl=ctrlList, sl=sufxList, ef=exFolder]

_images/exportCtrlShapes.jpg

Purpose:

:: Exports control shapes from Autodesk Maya to a specified file, allowing for easy backup and reuse in different projects.

  • Essential for preserving custom control shapes and transferring them between scenes or Maya installations.

Parameters:
  • filePath<str, optional> # Path to the file where control shapes are to be exported.

  • fileName<str, optional> # Name of the file for exporting control shapes.

  • ctrlList<list, optional> # List of controls to export.

  • sufxList<str, optional> # Suffix for the controls to be exported.

  • exFolder<str, optional> # Folder for exporting the control shapes.

Returns:

<str> # The path of the exported control shapes file.

Code Examples:

>>> export_path = "/path/to/export"
>>> export_file = "control_shapes"
>>> control_list = ["ctrl1", "ctrl2"]
>>> exportCtrlShapes(export_path, export_file, control_list)
# Exports control shapes of 'ctrl1' and 'ctrl2' to '/path/to/export/control_shapes_ctrlShapes.mel'.

Returns:

filePath + fileName + '_CtrlShapes.mel'

Usage:

if not ctrlList:
        try:
                mc.select ('*' + ctrlSufx, r=1)
                ctrlList =asN._selected()
        except:
                eRig.error('No Ctrls are selected with this suffix %s' %ctrlSufx)
If shArgs Exist
If shArgs Does Not Exist
If Control List Exists
If Control List Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Check Control List
/ Export Control Shapes
/ Select by Suffix
/ End
Flow Chart Description:

This flowchart illustrates the exportCtrlShapes function:

  1. Checks if shArgs exist, and if so, parses the filePath, fileName, ctrlList, sufxList, and exFolder from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Checks if the ctrlList exists.

  4. If the ctrlList exists, exports control shapes from the specified controls.

  5. If the ctrlList does not exist, selects controls by suffix and then exports their control shapes.

  6. Ends the process.

eCtrl.eyesCtrl(self, ctrlName=None, grpLevel=3, snapPiv=True, ctrlType=2, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, sp=snapPiv, ct=ctrlType]

Purpose:

:: Creates an eye control in Autodesk Maya, allowing for customized group levels, pivot snapping, and control types.

  • This function is essential for rigging eyes in characters, providing a simple way to manage eye movements.

  • The flexibility in control type and group hierarchy makes it suitable for different rigging requirements.

Parameters:
  • ctrlName<str, optional> # Name for the eye control. Defaults to None.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Default is 3.

  • snapPiv<bool, optional> # Determines if the control’s pivot should be snapped. Default is True.

  • ctrlType<int, optional> # Type of eye control to create. Default is 2.

Returns:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> control_name = "myEyeCtrl"
>>> control, control_group = eyesCtrl(ctrlName=control_name, ctrlType=1)
# Creates a type 1 eye control with the specified name.
CtrlName provided
CtrlName not provided
Type 1
Type 2
Start
/ Check Control Name
/ Determine Control Type
/ Assign Default Ctrl Name
/ Create Control Type 1
/ Create Control Type 2
/ Delete History
/ Finalize Control
End
Flow Chart Description:

This flowchart illustrates the eyesCtrl function:

  1. The process starts by checking if a control name is provided. If not, a default name is assigned.

  2. The function then determines the type of eye control to create, based on the ‘ctrlType’ parameter.

  3. For Type 1, a specific eye control shape is created using circle and modification commands.

  4. For Type 2, a different eye control shape is created using curve and closeCurve commands.

  5. After creating the control, the function deletes any history attached to it.

  6. The control is then finalized with group levels, pivot snapping, and color application.

  7. The process ends by returning the control and its top group as Maya nodes.

eCtrl.featherCtrl(self, ctrlName=None, prefixSide='L_', grpLevel=1, snapPiv=1, **shArgs)#

[shArgs : cn=ctrlName, ps=prefixSide, gl=grpLevel, sp=snapPiv]

Purpose:

:: Creates a feather control in Autodesk Maya, offering customization for side prefix, group level, and pivot snapping. :: Ideal for animating feathers or similar elements requiring delicate, articulated movements.

Parameters:
  • ctrlName – (<str>, optional) # Name for the feather control.

  • prefixSide – (<str>, optional) # Side prefix for the control, typically ‘L_’ for left or ‘R_’ for right. Default is ‘L_’.

  • grpLevel – (<int>, optional) # Specifies the hierarchy level for grouping the control. Default is 1.

  • snapPiv – (<bool>, optional) # Determines if the control’s pivot should be snapped. Default is 1.

Returns:

(<list>) # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> control_name = "featherCtrl"
>>> side_prefix = "L_"
>>> group_level = 1
>>> snap_pivot = True
>>> ctrl, ctrl_grp = eCtrl.featherCtrl(control_name, side_prefix, group_level, snap_pivot)
# Creates a feather control with specified parameters.
Prefix Side 'L_' or 'LT_'
Prefix Side 'R_' or 'RT_'
Start
/ Check Prefix Side
/ Create Ctrl 'L_'
/ Create Ctrl 'R_'
/ Group Ctrl 'L_'
/ Group Ctrl 'R_'
/ Apply Color to Ctrl 'L_'
/ Apply Color to Ctrl 'R_'
End
Flow Chart Description:

This flowchart illustrates the featherCtrl function:

  1. The process begins by checking the prefixSide (’L_’ or ‘R_’).

  2. Depending on the side prefix, the corresponding feather control is created.

  3. The control is then grouped according to the specified grpLevel.

  4. Finally, a color is applied to the control, and the process concludes.

eCtrl.finalizeCtrl(self, ctrl, initRot=[0, 0, 0], grpLevel=3, snapPiv=True, grpSufxList=None, colorVal=None, **shArgs)#

[**shArgs : c=ctrl, ir=initRot, gl=grpLevel, sp=snapPiv, gsl=grpSufxList, cv=colorVal]

Purpose:

:: Finalizes a control in Autodesk Maya, setting its initial rotation, group level, pivot snapping, group suffix, and color.

Parameters:
  • node) (ctrl (Maya) – The control to be finalized.

  • optional) (colorVal (color,) – Initial rotation of the control, given as [x, y, z]. Default is [0, 0, 0].

  • optional) – The hierarchy level for the control’s grouping. Default is 3.

  • optional) – Whether to snap the control’s pivot. Default is True.

  • optional) – Suffix list for the control’s groups.

  • optional) – Color value to apply to the control.

Returns:

None. The control is modified in place.

Code Examples:

>>> control_node = 'myCtrl'
>>> initialize_rotation = [90, 0, 0]
>>> group_level = 2
>>> snap_pivot = True
>>> finalizeCtrl(control_node, initialize_rotation, group_level, snap_pivot)

# Modifies ‘myCtrl’, sets its rotation, groups it and snaps its pivot as specified.

_images/finalizeCtrl.jpg
eCtrl.fingerCtrl(self, ctrlName=None, grpLevel=1, ctrlType=1, snapPiv=1, initRot=[0, 0, 0], grpSufxList=None, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType, sp=snapPiv, ir=initRot, gsl=grpSufxList]

Purpose:

:: Creates a finger control in Autodesk Maya, allowing customization for group levels, control type, pivot snapping, initial rotation, and group suffix list. :: Useful for detailed rigging and animation of finger movements.

Parameters:
  • ctrlName – (<str>, optional) # Name for the finger control.

  • grpLevel – (<int>, optional) # Specifies the hierarchy level for grouping the control. Default is 1.

  • ctrlType – (<int>, optional) # Type of the control to be created. Default is 1.

  • snapPiv – (<bool>, optional) # Determines if the control’s pivot should be snapped. Default is 1.

  • initRot – (<list>, optional) # Initial rotation of the control, given as [x, y, z]. Default is [0, 0, 0].

  • grpSufxList – (<list/str>, optional) # Suffix list for the control’s groups.

Returns:

(<list>) # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> control_name = "fingerCtrl"
>>> group_level = 1
>>> control_type = 1
>>> snap_pivot = True
>>> initial_rotation = [0, 0, 0]
>>> group_suffix_list = ["grp1", "grp2"]
>>> ctrl, ctrl_grp = eCtrl.fingerCtrl(control_name, group_level, control_type, snap_pivot, initial_rotation, group_suffix_list)
# Creates a finger control with specified parameters.
If ctrlName is None
If ctrlName is provided
Start
/ Check Ctrl Name
/ Assign Default Name
/ Create Control
/ Apply Initial Rotation
/ Freeze Control
/ Group Control
/ Apply Control Color
End
Flow Chart Description:

This flowchart illustrates the fingerCtrl function:

  1. The process starts by checking if ctrlName is provided. If not, a default name is assigned.

  2. The finger control is created based on the specified ctrlType.

  3. Initial rotation (initRot) is applied to the control, and then the control is frozen to reset transformations.

  4. The control is grouped according to the specified grpLevel and any suffixes provided in grpSufxList.

  5. Control color is applied, and the function returns the control and its top group as Maya nodes.

eCtrl.fistCtrl(self, ctrlName, grpLevel=1, ctrlType=1)#

[shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType]

Purpose:

:: Generates a fist control in Autodesk Maya, ideal for detailed rigging and animation of hand movements. :: Offers flexibility in the design and grouping of the control for complex character rigs.

Parameters:
  • ctrlName<str> # Required name for the fist control.

  • grpLevel<int>, optional # Hierarchy level for grouping the control. Default is 1.

  • ctrlType<int>, optional # Specifies the type of 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 = "fistCtrl"
>>> group_level = 1
>>> control_type = 1
>>> ctrl, ctrl_grp = eCtrl.fistCtrl(control_name, group_level, control_type)
# Creates a fist control with specified parameters.
Ctrl Type 1
Ctrl Type 2
Other Ctrl Types
Start
/ Check Ctrl Type
/ Create Ctrl Type 1
/ Create Ctrl Type 2
/ Create Other Ctrl Types
/ Group Ctrl Type 1
/ Group Ctrl Type 2
/ Group Other Ctrl Types
/ Apply Color to Ctrl Type 1
/ Apply Color to Ctrl Type 2
/ Apply Color to Other Ctrl Types
End
Flow Chart Description:

This flowchart illustrates the fistCtrl function:

  1. The process begins by checking the ctrlType provided.

  2. Based on the ctrlType, the corresponding control is created (Type 1, Type 2, or Other).

  3. Each control type is then grouped according to grpLevel.

  4. Finally, an appropriate color is applied to the control before the function ends.

eCtrl.fkCtrl(self, ctrlName=None, prefixSide='L_', grpLevel=1, ctrlType=1, initRot=[0, 0, 0], snapPiv=1, ctrl3Axis='x', **shArgs)#

[shArgs : cn=ctrlName, ps=prefixSide, gl=grpLevel, ct=ctrlType, ir=initRot, sp=snapPiv, ca=ctrl3Axis]

Purpose:

:: Provides a method to create forward kinematics (FK) controls in Autodesk Maya, allowing customization for various rigging needs.

  • This function is essential for rigging characters, enabling the creation of FK controls that are tailored to specific requirements.

  • The flexibility in specifying parameters like control type, initial rotation, and pivot snapping enhances the rigging process.

Parameters:
  • ctrlName<str, optional> # Name for the FK control. It can be left as None for a default naming convention.

  • prefixSide<str, optional> # Side prefix for the control, indicating left or right side. Defaults to ‘L_’.

  • grpLevel<int, optional> # Group level for organizing the control within the hierarchy. Defaults to 1.

  • ctrlType<int, optional> # Type of control shape to be created. Default value is 1.

  • initRot<list, optional> # Initial rotation of the control, specified as [x, y, z]. Defaults to [0, 0, 0].

  • snapPiv<bool, optional> # Indicates whether the pivot of the control should be snapped. Default is True (1).

  • ctrl3Axis<str, optional> # Defines the 3-axis for the control. Default is ‘x’.

Returns:

<list> # Returns a list containing the control and its top group as Maya nodes, based on the specified group level.

Code Examples:

>>> control_name = "myFKControl"
>>> control, control_group = fkCtrl(ctrlName=control_name, grpLevel=2, ctrlType=3)
# Creates an FK control with a box shape and 2 group levels.
CtrlName provided
CtrlName not provided
Start
/ Check Control Name
/ Create Control Shape
/ Default Naming
/ Rotate Control
/ Group Control
/ Apply Color
End
Flow Chart Description:

This flowchart illustrates the fkCtrl function:

  1. The process starts by checking if a control name (ctrlName) is provided. If not, a default naming convention is applied.

  2. The function then creates the FK control shape based on specified parameters like control type (ctrlType) and prefix side (prefixSide).

  3. The control is rotated to its initial rotation (initRot) if specified.

  4. The control is grouped based on the specified group level (grpLevel), and pivot snapping (snapPiv) is applied.

  5. Finally, color is applied to the control for identification, and the process ends.

  6. The function returns a list containing the FK control and its top group as Maya nodes.

eCtrl.fkJntCtrl(self, jntList=None, ctrlNames=None, prefixSide='L_', grpLevel=4, ctrlType=4, initRot=[0, 0, 0], snapPiv=1, ctrl3Axis='x', jntSuffix='_Jnt', **shArgs)#

[shArgs : jl=jntList, cn=ctrlNames, ps=prefixSide, gl=grpLevel, ct=ctrlType, ir=initRot, sp=snapPiv, ca=ctrl3Axis, js=jntSuffix]

Purpose:

:: Facilitates the creation of FK controls for a series of joints in Autodesk Maya, offering a wide range of customization options for rigging.

  • Ideal for setting up FK rigs on characters or mechanical objects, providing riggers with the flexibility to adapt controls to specific joint chains.

  • The option to specify joint lists, control names, and various control types allows for precise and efficient rig creation.

Parameters:
  • jntList<list, optional> # List of joints for which FK controls are created. If None, selections are used.

  • ctrlNames<list/str, optional> # Names to assign to the FK controls. Can be a single name or a list matching the joint list.

  • prefixSide<str, optional> # Prefix indicating the side of the body (e.g., ‘L_’ for left). Defaults to ‘L_’.

  • grpLevel<int, optional> # Specifies the hierarchy level for control grouping. Default is 4.

  • ctrlType<int, optional> # Determines the shape and style of the FK control. Default is 4.

  • initRot<list, optional> # Initial rotation of each control in [x, y, z] format. Default is [0, 0, 0].

  • snapPiv<bool, optional> # Whether to snap the pivot of the control to the joint. Default is True.

  • ctrl3Axis<str, optional> # Defines the 3-axis direction for the control. Default is ‘x’.

  • jntSuffix<str, optional> # Suffix used in joint names. Default is ‘_Jnt’.

Returns:

<list> # A list of created FK controls and their group nodes, providing a structured rig setup.

Code Examples:

>>> joint_names = ["joint1", "joint2", "joint3"]
>>> control_names = ["ctrl1", "ctrl2", "ctrl3"]
>>> fk_controls = fkJntCtrl(jntList=joint_names, ctrlNames=control_names, grpLevel=3, ctrlType=2)
# Creates FK controls for specified joints with designated control names and properties.

Updates:

1. Support for Multiple joints
2. Orientation of control based on joint dir
JntList provided
JntList not provided
Is Joint
Not a Joint
Start
/ Check Joint List
/ Iterate Joints
/ Select Joints
/ Check Joint Type
/ Create FK Control
/ Skip Joint
/ Set Control Scale
/ Position Control
/ Constrain to Joint
/ Lock Control Attributes
End
Flow Chart Description:

This flowchart illustrates the fkJntCtrl function:

  1. The process starts by checking if a joint list (jntList) is provided. If not, joints are selected.

  2. The function iterates through each joint in the list.

  3. For each joint, it checks if the node is a valid joint.

  4. If it’s a joint, an FK control is created with the specified properties like control type (ctrlType) and side prefix (prefixSide).

  5. The control is scaled to match the joint size and positioned at the joint location.

  6. The control is then constrained to the joint for FK animation.

  7. Attributes like scale and visibility are locked on the control to finalize the setup.

  8. The process repeats for each joint in the list, and the function returns a list of all created FK controls and groups.

eCtrl.footCtrl(self, ctrlName=None, sidePos='L_', grpLevel=3, ctrlType=1, initRot=None, colorVal=None, **shArgs)#

[**shArgs : cn=ctrlName, sp=sidePos, gl=grpLevel, ct=ctrlType, ir=initRot, cv=colorVal]

Purpose:

:: Generates a foot control in Autodesk Maya with options for side position, group level, control type, initial rotation, and color. :: Ideal for rigging and animation in character setup, especially for feet controls.

Parameters:
  • ctrlName – (<str>, optional) # Name for the foot control. If not provided, defaults to ‘as_Foot_Ctrl’.

  • sidePos – (<str>, optional) # Side position for the control, ‘L_’ for left or ‘R_’ for right. Default is ‘L_’.

  • grpLevel – (<int>, optional) # Hierarchy level for grouping the control. Default is 3.

  • ctrlType – (<int>, optional) # Type of foot control to be created (1: Generic, 2: Human, 3: Bird).

  • initRot – (<list>, optional) # Initial rotation of the control, given as [x, y, z].

  • colorVal – (<color>, optional) # Color value to apply to the control.

Returns:

(<list>) # Returns [ctrl, ctrlGrp(topGrp)] as Maya nodes, based on grpLevel.

Code Examples:

>>> ctrl_name = "myFootCtrl"
>>> side_position = "L_"
>>> group_level = 3
>>> control_type = 1
>>> initial_rotation = [0, 90, 0]
>>> color_value = "blue"
>>> ctrl, ctrl_grp = eCtrl.footCtrl(ctrl_name, side_position, group_level, control_type, initial_rotation, color_value)
# Creates a left foot control with specified parameters.
If ctrlName is provided
If ctrlName is not provided
Type 1
Type 2
Type 3
Type 4
Start
/ Check Control Name
/ Create Control
/ Assign Default Name
/ Check Control Type
/ Create Type 1 Control
/ Create Type 2 Control
/ Create Type 3 Control
/ Create Type 4 Control
/ Finalize Control
/ Apply Control Color
/ Group Control
End
Flow Chart Description:

This flowchart illustrates the footCtrl function:

  1. The process begins by checking if a control name (ctrlName) is provided. If not, a default name is assigned.

  2. The control type (ctrlType) determines the shape and style of the foot control.

  3. Depending on the control type, one of four different foot control shapes is created.

  4. The control is finalized, which includes applying color and grouping based on the specified group level (grpLevel).

  5. The function concludes by returning the control and its top group as Maya nodes.

eCtrl.footEndCtrl(self, ctrlName=None, grpLevel=3, initRot=[0, 0, 0], ctrlType=1, grpSufxList=None, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType, ir=initRot, sp=snapPiv, gsl=grpSufxList, cv=colorVal]

Purpose:

:: Creates a foot end control in Autodesk Maya, offering customization for control name, group level, control type, initial rotation, pivot snapping, group suffix list, and color value.

  • Ideal for rigging foot mechanisms in character animation, providing precise control over foot movements.

  • Offers flexibility in control design to match specific rigging requirements.

Parameters:
  • ctrlName<str, optional> #Name for the foot end control. Defaults to None, which assigns a default name.

  • grpLevel<int, optional> #Hierarchy level for grouping the control. Defaults to 3.

  • initRot<list, optional> #Initial rotation of the control, given as [x, y, z]. Defaults to [0, 0, 0].

  • ctrlType<int, optional> #Specifies the type of foot end control to create. Options include different shapes. Defaults to 1.

  • grpSufxList<list/str, optional> #Suffix list for the control’s groups.

  • colorVal<color, optional> #Color value to apply to the control.

Returns:

<list> #A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> ctrl_name = "footEndCtrl"
>>> group_level = 3
>>> initial_rotation = [0, 45, 0]
>>> control_type = 1
>>> group_suffix_list = ["_grp1", "_grp2"]
>>> color_value = 6
>>> foot_end_ctrl, foot_end_grp = footEndCtrl(ctrl_name, group_level, initial_rotation, control_type, group_suffix_list, color_value)
Input Provided
No Input
Start
/ Check Inputs
/ Create Foot End Control
/ Group Control
/ Apply Color
End
Error
Flow Chart Description:

This flowchart illustrates the footEndCtrl function:

  1. The process starts by checking if the necessary inputs are provided for creating a foot end control. These include control name, group level, initial rotation, control type, group suffix list, and color value.

  2. If the inputs are provided, a foot end control is created based on the specified parameters.

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

  4. A color is applied to the control for visual differentiation and ease of use.

  5. The process concludes successfully after the control is created and configured.

  6. In the absence of necessary inputs, an error is indicated, and the process terminates.

eCtrl.gearCtrl(self, ctrlName=None, grpLevel=3, ctrlType=2, initRot=[0, 0, 0], snapPiv=1, grpSufxList=None, colorVal=None, **shArgs)#

[**shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType, ir=initRot, sp=snapPiv, gsl=grpSufxList, cv=colorVal]

Purpose:

:: Creates a gear-shaped control in Autodesk Maya, with customizable group level, control type, initial rotation, pivot snapping, group suffix list, and color.

_images/gearCtrl.jpg
  • Useful for creating visually distinct controls in rigging and animation.

  • Provides options for initial orientation, pivot snapping, and control coloring for better rigging workflow.

Parameters:
  • ctrlName<str, optional> # Name for the gear control. Default is ‘as_Gear_Ctrl’ if not specified.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Defaults to 3.

  • ctrlType<int, optional> # Type of gear control to create, with different shapes corresponding to different integers.

  • initRot<list, optional> # Initial rotation of the control as [x, y, z] values. Defaults to [0, 0, 0].

  • snapPiv<bool, optional> # Whether to snap the control’s pivot to a specific point. Defaults to True.

  • grpSufxList<list/str, optional> # Suffix list for the control’s groups.

  • colorVal<color, optional> # Color value to apply to the control for visual differentiation.

Returns:

<list> # A list containing the control and its top group as Maya nodes, depending on grpLevel.

Code Examples:

>>> control_name = "myGearCtrl"
>>> group_level = 2
>>> control_type = 1
>>> initial_rotation = [45, 0, 0]
>>> gear_control = gearCtrl(control_name, group_level, control_type, initial_rotation)
# Creates a gear-shaped control with specified parameters.
If shArgs Exist
If shArgs Does Not Exist
Finalize Control with Parameters
Start
/ Check Inputs
/ Parse shArgs
/ Initialize Parameters
/ Create Gear Control
/ Finalize Control
End
Flow Chart Description:

This flowchart illustrates the gearCtrl function:

  1. The function begins by checking if shArgs are provided. If they are, it parses arguments like ctrlName, grpLevel, ctrlType, initRot, snapPiv, grpSufxList, and colorVal.

  2. If shArgs are not provided, it initializes parameters with default or provided values.

  3. Creates a gear-shaped control based on the specified or default parameters.

  4. Finalizes the control by applying initial rotation, group level, pivot snapping, group suffix list, and color value.

  5. The function concludes after successfully creating and finalizing the gear control.

eCtrl.generateCurvCMD(self, curvName='as_Curv', deg=3, step=1, objOrPosList=[], showCVs=True, showEditor=False, printCommand=True, **shArgs)#

[**shArgs : cn=curvName, d=deg, s=step, op=objOrPosList, sc=showCVs, se=showEditor, pc=printCommand]

_images/generateCurvCMD.jpg

Purpose:

:: Generates a curve command in Autodesk Maya, allowing for detailed customization of curve degree, step, object or position list, and display options.

  • Ideal for script-based curve creation and manipulation.

  • Offers flexibility in defining curve characteristics and visualization.

Parameters:
  • curvName<str, optional> # Name for the curve. Default is ‘as_Curv’.

  • deg<int, optional> # Degree of the curve. Default is 3.

  • step<int, optional> # Step value for the curve. Default is 1.

  • objOrPosList<list, optional> # List of objects or positions to define the curve.

  • showCVs<bool, optional> # Whether to display the curve’s control vertices (CVs). Default is True.

  • showEditor<bool, optional> # Whether to show the curve editor. Default is False.

  • printCommand<bool, optional> # Whether to print the curve command. Default is True.

Returns:

None # The command generates a curve in the Maya scene.

Code Examples:

>>> curve_name = "customCurve"
>>> degree = 3
>>> step_value = 2
>>> obj_list = ["obj1", "obj2"]
>>> generateCurvCMD(curve_name, degree, step_value, obj_list)
# Generates a custom curve based on the specified parameters.
Input Provided
No Input
Start
/ Check Inputs
/ Process Input
/ Generate Curve Command
/ Execute Command
End
Error
Flow Chart Description:

This flowchart illustrates the generateCurvCMD function:

  1. The function begins by checking if all necessary inputs are provided.

  2. If inputs are provided, it processes them to create a curve command.

  3. The curve command is generated based on the input parameters.

  4. The command is then executed to create the curve in Maya.

  5. The function concludes after successfully executing the curve command.

  6. If any inputs are missing, an error is indicated.

eCtrl.getCurv_FromEdgeLoop(self, deg=3)#

[**shArgs : d=deg]

Purpose:

:: Extracts a curve from an edge loop in Autodesk Maya, converting a polygon edge loop into a NURBS curve.

  • Ideal for creating curves from existing polygon edge loops.

  • Allows for easy conversion of complex edge geometry to smooth curves.

Parameters:

deg<int, optional> # Degree of the curve to be created from the edge loop. Defaults to 3.

Returns:

<str> # The name of the newly created curve as a Maya node.

Code Examples:

>>> degree = 3
>>> curve_name = getCurv_FromEdgeLoop(degree)
# Generates a NURBS curve from an edge loop with the specified degree.
Selected Edges Exist
Conversion Successful
No Edges Selected
Curve Finalized
Start
/ Get Selected Edges
/ Convert Edges to Curve
/ Finalize Curve
Error
End
Flow Chart Description:

This flowchart illustrates the getCurv_FromEdgeLoop function:

  1. Starts by getting the currently selected edges in Maya.

  2. If edges are selected, it converts these edges into a NURBS curve with the specified degree.

  3. Once the curve is created, it finalizes the curve by deleting history and centering its pivot.

  4. If no edges are selected, an error is indicated.

  5. The function concludes after the curve is finalized or if an error occurs due to no selection.

eCtrl.getKnots(self, crvShape=None)#

[**shArgs : cs=crvShape]

Purpose:

:: Retrieves the knot values of a specified NURBS curve shape in Autodesk Maya.

  • Useful for detailed curve editing and manipulation.

  • Provides essential data for advanced rigging and animation techniques.

Parameters:

crvShape<str, optional> # Name of the curve shape whose knots are to be retrieved.

Returns:

<list> # A list of knot values for the specified curve shape.

Code Examples:

>>> curve_shape = "curveShape1"
>>> knot_values = getKnots(curve_shape)
# Retrieves the knot values of the specified NURBS curve shape.
Curve Shape Provided
Knots Retrieved
No Curve Shape Provided
Start
/ Check Curve Shape
/ Retrieve Knots
End
Error
Flow Chart Description:

This flowchart illustrates the getKnots function:

  1. The function starts by checking if a curve shape name is provided.

  2. If a curve shape is provided, it retrieves the knot values of the specified NURBS curve shape.

  3. If no curve shape is provided, an error is indicated.

  4. The function concludes after retrieving the knot values or if an error occurs due to the absence of a curve shape.

eCtrl.getShape(self, curv=None)#

[**shArgs : c=curv]

Purpose:

:: Returns a dictionary containing all necessary information for rebuilding a specified curve in Autodesk Maya.

  • Essential for curve duplication and reconstruction.

  • Provides comprehensive details for curve attributes and geometry.

Parameters:

curv<str, optional> # Name of the curve to retrieve shape information from.

Returns:

<list> # A list of dictionaries, each containing detailed attributes of the curve shapes.

Code Examples:

>>> curve_name = "myCurve"
>>> shape_data = getShape(curve_name)
# Extracts detailed shape information from the specified curve.
Curve Name Provided
Shape Data Retrieved
No Curve Name Provided
Start
/ Check Curve Name
/ Retrieve Shape Data
End
Error
Flow Chart Description:

This flowchart illustrates the getShape function:

  1. The function starts by checking if a curve name is provided.

  2. If a curve name is provided, it retrieves detailed shape information from the specified curve.

  3. If no curve name is provided, an error is indicated.

  4. The function concludes after retrieving the shape information or if an error occurs due to the absence of a curve name.

eCtrl.globalCtrl(self, ctrlName, grpLevel=1, ctrlType=1, **shArgs)#

[**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 Provided
No Input
Start
/ Check Inputs
/ Create Global Control
/ Group Control
/ Apply Color
End
Error
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.

eCtrl.headCtrl(self, ctrlName, grpLevel=1, ctrlType=1, snapPiv=False, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType, sp=snapPiv]

Purpose:

:: Creates a control in Autodesk Maya for animating a character’s head, providing customization in terms of grouping, control type, and pivot snapping.

  • The function allows for the creation of head controls with various shapes and functionalities.

  • It provides options to define the number of group levels, control type for different shapes, and whether to snap the pivot or not.

Parameters:
  • ctrlName<str> # The name to be assigned to the control.

  • grpLevel<int> # The number of top groups on the control. Determines the hierarchical level.

  • ctrlType<int> # The type of control to be created. 1 for standard head control, 2 for an alternative shape.

  • snapPiv<bool> # Determines whether the groups’ pivot should be snapped to the control or not.

Returns:

<list> # Returns a list of nodes, typically including the control and its top group.

Code Examples:

>>> control_name = "headControl"
>>> group_level = 1
>>> control_type = 1
>>> snap_pivot = True
>>> head_ctrl = headCtrl(control_name, group_level, control_type, snap_pivot)
# This will create a head control with specified parameters.
Type 1
Type 2
Start
/ Check Control Type
/ Create Head Control Type 1
/ Create Head Control Type 2
/ Finalize Control
End
Flow Chart Description:

This flowchart illustrates the headCtrl function:

  1. The process begins by determining the type of head control to create.

  2. If Type 1 is selected, a standard head control shape is created.

  3. If Type 2 is selected, an alternative head control shape is created.

  4. The function then finalizes the control with group levels, pivot snapping, and color application.

  5. The process concludes by returning the control and its top group.

eCtrl.ikCtrl(self, ctrlName=None, prefixSide='L_', grpLevel=1, ctrlType=1, snapPiv=1, initRot=[0, 0, 0], **shArgs)#

[**shArgs : cn=ctrlName, ps=prefixSide, gl=grpLevel, ct=ctrlType, sp=snapPiv, ir=initRot]

Purpose:

:: Creates an inverse kinematics (IK) control in Autodesk Maya, offering customization for control name, side prefix, group level, control type, pivot snapping, and initial rotation.

Parameters:
  • ctrlName – (<str, Optional>) # Name for the IK control.

  • prefixSide – (<str, Optional>) # Side prefix for the control, typically ‘L_’ for left or ‘R_’ for right. Default is ‘L_’.

  • grpLevel – (<int, Optional>) # Hierarchy level for grouping the control. Default is 1.

  • ctrlType – (<int, Optional>) # Type of IK control to be created. Default is 1.

  • snapPiv – (<bool, Optional>) # Determines if the control’s pivot should be snapped. Default is True.

  • initRot – (<list, Optional>) # Initial rotation of the control, given as [x, y, z]. Default is [0, 0, 0].

Returns:

(<list>) # A list containing the control and its top group as Maya nodes, based on grpLevel.

Example Usage:

>>> ctrlName = "myIKControl"
>>> prefixSide = "L_"
>>> grpLevel = 2
>>> ctrlType = 2
>>> snapPiv = True
>>> initRot = [45, 0, 0]
>>> ikCtrl(ctrlName, prefixSide, grpLevel, ctrlType, snapPiv, initRot)
# Create an IK control with the specified parameters.

ctrl              =eCtrl.ikCtrl(ctrlName)[0]
ctrlGrp           =eCtrl.ikCtrl(ctrlName)[-1]
ctrl, ctrlGrp =eCtrl.ikCtrl(ctrlName)

Returns:

if grpLevel:
        return [ctrl, ctrlGrp(topGrp)]  #_ asNodes
else:
        return [ctrl, ctrl]                     #_ asNodes
If shArgs Exist
If shArgs Does Not Exist
If ctrlName is None
If ctrlName is Not None
If Object Starts With Prefix
If Prefix is Found in Object
If No Prefix is Found
If Target Object Exists
If Target Object Does Not Exist
Create IK Control Curves
Rotate Control
Freeze Control Transformation
Group Control with Hierarchy Level
Apply Control Color
Return Control and Group
Start
/ Check shArgs
/ Initialize Parameters
/ Check ctrlName
/ Get Selected Objects
/ Create Default ctrlName
/ Check Prefix
/ Split Object Name
/ Replace Prefix
/ Error: No Prefix Found
/ Check Object Exists
/ End
/ Create Curves
/ Error: Target Object Not Found
/ Select Control
/ Rotate Control
/ Freeze Control Transformation
/ Group Control with Hierarchy Level
/ Apply Control Color
/ Return Control and Group
Flow Chart Description:

This flowchart illustrates the ikCtrl function:

  1. It starts by checking if shArgs exist.

  2. If shArgs exist, it initializes parameters like ctrlName, prefixSide, grpLevel, ctrlType, snapPiv, and initRot based on the values provided in shArgs.

  3. If shArgs do not exist, it proceeds to check if ctrlName is None.

  4. If ctrlName is None, it creates a default ctrlName with a naming convention.

  5. If ctrlName is not None, it checks if the object’s name starts with the specified prefix and handles prefix-related operations.

  6. It then checks if the target object exists.

  7. If the target object exists, it creates the IK control curves, selects the control, rotates it based on the initial rotation, and freezes its transformation.

  8. The control is grouped according to the specified hierarchy level, and control color is applied.

  9. Finally, the function returns the control and its group.

eCtrl.ikfkSwitch(self, switchName, sidePos='L_', font='Quaint', grpLevel=1, randomFont=False, **shArgs)#

[shArgs : sn=switchName, sp=sidePos, f=font, gl=grpLevel, rf=randomFont]

Purpose:

:: Creates an IK-FK switch control in Autodesk Maya, customizable with switch name, side position, font style, group level, and random font selection. :: Ideal for rigging setups where seamless transition between IK and FK is required.

Parameters:
  • switchName – (<str>, required) # Name for the IK-FK switch control.

  • sidePos – (<str>, optional) # Side position for the control, typically ‘L_’ for left or ‘R_’ for right. Default is ‘L_’.

  • font – (<str>, optional) # Font style for the switch control. Default is ‘Quaint’.

  • grpLevel – (<int>, optional) # Hierarchy level for grouping the control. Default is 1.

  • randomFont – (<bool>, optional) # Whether to use a random font from a predefined list. Default is False.

Returns:

(<list>) # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> switch_name = "ikfkSwitch"
>>> side_position = "L_"
>>> font_style = "Quaint"
>>> group_level = 1
>>> random_font = False
>>> ctrl, ctrl_grp = eCtrl.ikfkSwitch(switch_name, side_position, font_style, group_level, random_font)
# Creates an IK-FK switch control with specified parameters.

Fonts:

#_ fontList =['Palatino Linotype', 'Bolide', 'Vectroid', 'Snap ITC', 'Quaint', 'Ravie']
#_ ['Outer Sider BRK', 'ChangChangWoodcut']
#_ textCurves(ch=0, t='ikfk', f= 'Quaint|h-16|w700|c0')
#_ font =fontList[rand.randint(0, 5)]
If randomFont is True
If randomFont is False
If Linux
Otherwise
Start
/ Check Random Font
/ Assign Random Font
/ Create Basic Text
/ Check System Platform
/ Box Control
/ Generate Letters
/ Finalize Control
/ Apply Control Color
/ Group Control
End
Flow Chart Description:

This flowchart illustrates the ikfkSwitch function:

  1. The process begins by checking if randomFont is true. If so, a random font is assigned.

  2. Basic text representing ‘ikfk’ is generated with the specified or random font.

  3. The system platform is checked. If Linux, a box control is created; otherwise, the process moves to letter generation.

  4. The letters are finalized into a single control, and control colors are applied.

  5. The control is grouped based on the specified group level (grpLevel).

  6. The function concludes by returning the IK-FK switch control and its top group as Maya nodes.

eCtrl.importCtrlShapes(self, filePath=None, fileName=None, **shArgs)#

[shArgs : fp=filePath, fn=fileName]

Purpose:

:: Imports control shapes into Autodesk Maya from a specified file, streamlining the process of setting up controls in new scenes.

  • Useful for reusing custom control shapes across different Maya projects or scenes.

Parameters:
  • filePath<str, optional> # The directory path from where the control shapes are to be imported.

  • fileName<str, optional> # The name of the file from which the control shapes are imported.

Returns:

<str> # A message indicating successful import of control shapes.

Code Examples:

>>> import_path = "/path/to/import"
>>> import_file = "control_shapes"
>>> importCtrlShapes(import_path, import_file)
# Imports control shapes from '/path/to/import/control_shapes.py' into the current Maya scene.
If shArgs Exist
If shArgs Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Import Control Shapes
/ End
Flow Chart Description:

This flowchart illustrates the importCtrlShapes function:

  1. Checks if shArgs exist, and if so, parses the filePath and fileName from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Imports control shapes from the specified file into the current Maya scene.

  4. Ends the process.

eCtrl.jawCtrl(self, ctrlName, grpLevel=1, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel]

Purpose:

:: Creates a jaw control in Autodesk Maya, with options for control name and group level.

Parameters:
  • ctrlName<str> #Name for the jaw control.

  • grpLevel<int, optional> #Hierarchy level for grouping the control. Default is 1.

Returns:

<list> #A list containing the control and its top group as Maya nodes, based on grpLevel.

Usage:

ctrl                  =eCtrl.jawCtrl(ctrlName)[0]
ctrlGrp       =eCtrl.jawCtrl(ctrlName)[-1]
ctrl, ctrlGrp =eCtrl.jawCtrl(ctrlName)
If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Create Jaw Control
Create Control Group
Apply Control Color
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create Jaw Control
/ Create Control Group
/ Apply Control Color
/ End
Flow Chart Description:

This flowchart illustrates the jawCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName and grpLevel.

  3. Creates a jaw control with the specified ctrlName.

  4. Creates a control group based on the grpLevel.

  5. Applies control color to the control.

eCtrl.locCtrl(self, ctrlName, grpLevel=1, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel]

Purpose:

:: Generates a locator-like control in Autodesk Maya, customizable with control name and group level.

Parameters:
  • ctrlName<str> #Name for the locator control.

  • grpLevel<int, optional> #Specifies the hierarchy level for grouping the control. Default is 1.

Returns:

<list> #A list containing the control and its top group as Maya nodes, based on grpLevel.

Usage:

ctrl                  =eCtrl.locCtrl(ctrlName)[0]
ctrlGrp       =eCtrl.locCtrl(ctrlName)[-1]
ctrl, ctrlGrp =eCtrl.locCtrl(ctrlName)
If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Create Locator Control
Create Control Group
Apply Control Color
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create Locator Control
/ Create Control Group
/ Apply Control Color
/ End
Flow Chart Description:

This flowchart illustrates the locCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName and grpLevel.

  3. Creates a locator-like control using the provided ctrlName.

  4. Creates a control group based on the grpLevel.

  5. Applies control color to the control.

eCtrl.lockAttrs(self, myNode, myAttr, **shArgs)#

[**shArgs : mn=myNode, ma=myAttr]

Purpose:

:: Locks specified attributes on a Maya node to prevent modification.

  • Enhances rig stability by preventing accidental changes to key attributes.

  • Applicable to various types of nodes within Autodesk Maya.

Parameters:
  • myNode<str> # The name of the Maya node whose attributes are to be locked.

  • myAttr<str/list> # The attribute or list of attributes to lock on the node.

Returns:

None # Locks attributes on the specified node but does not return a value.

Code Examples:

>>> node_name = "transform1"
>>> attributes_to_lock = ["translateX", "translateY", "translateZ"]
>>> lockAttrs(node_name, attributes_to_lock)
# Locks the translation attributes of the specified node to prevent editing.
If shArgs Exist
If shArgs Does Not Exist
Lock specified attributes on node
Start
/ Check Inputs
/ Parse shArgs
/ Initialize Parameters
/ Lock Attributes
End
Flow Chart Description:

This flowchart illustrates the lockAttrs function:

  1. The function starts by checking if shArgs are provided. If they are, it parses the myNode and myAttr arguments.

  2. If shArgs are not provided, initializes parameters with default or provided values.

  3. Locks the specified attributes on the given node to prevent any modifications.

  4. The function concludes after successfully locking the attributes.

eCtrl.makeCtrlVisible(self, ctrlCurv=None, meshName=None, counter=1, maxCount=12, clust=None, **shArgs)#

[**shArgs : cc=ctrlCurv, mn=meshName, c=counter, mc=maxCount, cl=clust]

Purpose:

:: Manipulates visibility of a control curve relative to a mesh by adjusting cluster scales.

Parameters:
  • ctrlCurv – (<str, optional>) | Name of the control curve to be made visible. Defaults to the first selected node if not provided.

  • meshName – (<str, optional>) | Name of the mesh to check for control curve visibility.

  • counter – (<int, optional>) | Internal counter for recursive calls, tracking the number of visibility adjustments.

  • maxCount – (<int, optional>) | Maximum number of recursive adjustments allowed to make the control curve visible.

  • clust – (<str, optional>) | Cluster name associated with the control curve. If not provided, it’s derived from the control curve.

Returns:

(<dict>) | A dictionary mapping control curve vertices to their final positions.

If shArgs Exist
If shArgs Does Not Exist
If ctrlCurv is Not Provided
For Each Control Curve Vertex
If Any Vertex is Inside Mesh
If No Vertex is Inside Mesh
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Selected Objects
/ Select Ctrl Curv
/ Process Ctrl Curv
/ Check Mesh Contains Point
/ Scale Cluster Up
/ Scale Cluster Up More
/ Increment Counter
/ Recursive Call
/ End Recursive
/ Success: Control Colors Adjusted
Flow Chart Description:

This flowchart illustrates the makeCtrlVisible function:

  1. Checks if shArgs exist, and if so, parses the arguments.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves the control curve to be made visible.

  4. If ctrlCurv is not provided, selects the first selected node.

  5. Retrieves the list of control curve vertices.

  6. Checks if any vertex is inside the specified mesh.

  7. If any vertex is inside the mesh, scales the cluster up.

  8. If no vertex is inside the mesh, scales the cluster up even more.

  9. Increments the counter for recursive calls.

  10. Recursively calls the function for further adjustments.

  11. Ends the recursion and prints a success message.

eCtrl.mirrorCtrlShapes(self, ctrlList=None, srcStr='L_', repStr='R_', repCount=1, letters=False, **shArgs)#

[**shArgs : cl=ctrlList, ss=srcStr, rs=repStr, rc=repCount, l=letters]

_images/mirrorCtrlShapes.jpg

Purpose:

:: Mirrors control shapes in Autodesk Maya from one side to another, with options for control list, source string, replacement string, replacement count, and letter consideration.

Parameters:
  • ctrlList – (<type list, optional>) # List of control shapes to mirror. If not provided, function relies on the selection list.

  • srcStr – (<type str, optional>) # Source string for identifying the side to mirror from.

  • repStr – (<type str, optional>) # Replacement string for the mirrored side.

  • repCount – (<type int, optional>) # Number of times to replace the string. Default is 1.

  • letters – (<type bool, optional>) # Whether to consider letters in the mirroring process. Default is False.

Returns:

(<type None>) # None. The control shapes are mirrored in the Maya scene.

Code Examples:

>>> ctrl_list = ['LeftArm_Ctrl', 'RightArm_Ctrl']  # Specify a list of control names
>>> source_string = 'L_'  # Specify the source string
>>> replacement_string = 'R_'  # Specify the replacement string
>>> replacement_count = 2  # Specify the replacement count
>>> consider_letters = True  # Specify whether to consider letters in mirroring process
>>> mirrored_controls = mirrorCtrlShapes(ctrl_list, source_string, replacement_string, replacement_count, consider_letters)
If shArgs Exist
If shArgs Does Not Exist
For Each Selected Object
If Control List Exists
If Control List Does Not Exist
If Control is Not a Curve
If Control is a Curve
If Letters are Considered
If Letters are Not Considered
For Each Control
If Control List is Not Empty
If Control List is Empty
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Selected Objects
/ Check Control List
/ Iterate Control List
/ Select Controls
/ Check Control Type
/ Continue Iteration
/ Mirror Control
/ Snap Vertices
/ Mirror Vertices
/ Center Pivot
/ Snap Shape to Opposite
/ Append to Mirrored List
/ Select Vertices
/ Calculate Opposite Position
/ Set Opposite Position
/ Select Mirrored Controls
/ End
Flow Chart Description:

This flowchart illustrates the mirrorCtrlShapes function:

  1. Checks if shArgs exist, and if so, parses the ctrlList, srcStr, repStr, repCount, and letters from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of selected controls (control curves).

  4. For each selected control:
    • Checks if it’s a curve shape (control shape).

    • If it’s not a curve shape, continues to the next control.

    • If it’s a curve shape, proceeds to mirror it.

  5. If letters are considered in the mirroring process:
    • Snaps vertices to their opposite positions.

    • Centers the pivot of the mirrored control.

    • Snaps the shape to the opposite location.

  6. If letters are not considered:
    • Mirrors vertices by changing their X-coordinates to the opposite side.

  7. Appends the mirrored control to the list of mirrored controls.

  8. After processing all controls, selects the mirrored controls if the list is not empty.

eCtrl.moonCtrl(self, ctrlName=None, grpLevel=1, initRot=[0, 0, 0], ctrlType=1, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ir=initRot, ct=ctrlType]

Purpose:

:: Facilitates the creation of a moon-shaped control in Autodesk Maya, offering various customization options like control name, group level, initial rotation, and control type.

  • This function is ideal for rigging scenarios where a unique, moon-shaped control is needed.

  • The moon shape can provide a distinctive and intuitive control for animators and riggers, especially for celestial or thematic character rigs.

Parameters:
  • ctrlName<str, optional> # Name for the moon control. If not provided, defaults to ‘as_Moon_Ctrl’.

  • grpLevel<int, optional> # Specifies the hierarchy level for grouping the control. Default is 1.

  • initRot<list of float, optional> # Initial rotation of the control, specified as [x, y, z]. Default is [0, 0, 0].

  • ctrlType<int, optional> # Type of moon control to be created. Default is 1.

Returns:

<list of asNode> # A list with the control and its top group as Maya nodes, based on grpLevel.

Usage Examples:

>>> moon_control = moonCtrl(ctrlName="myMoonCtrl", ctrlType=1)[0]
# Creates a moon control with specific shape and default settings.

>>> moon_control, moon_control_group = moonCtrl(ctrlName="customMoon", ctrlType=2, grpLevel=2)
# Creates a custom moon control with a specific group level and control type.
If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Rotate Moon Control
Freeze Moon Control
Delete History
Create Control Group
Apply Control Color
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create Moon Control
/ Rotate Moon Control
/ Freeze Moon Control
/ Delete History
/ Create Control Group
/ Apply Control Color
/ End
Flow Chart Description:

This flowchart illustrates the moonCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName, grpLevel, initRot, and ctrlType.

  3. Creates a moon-shaped control based on the specified ctrlType.

  4. Rotates the moon control based on the provided initRot values.

  5. Freezes the transformations of the control.

  6. Deletes the history of the control.

  7. Creates a control group based on the grpLevel.

  8. Applies control color to the control.

eCtrl.multiCurvCtrl(self, curvList=None, ctrlName=None, freezeCurvs=False, **shArgs)#

[**shArgs : cl=curvList, cn=ctrlName, fc=freezeCurvs]

Purpose:

:: Creates a single shape control from multiple curves in Autodesk Maya, with options for curve list, control name, and whether to freeze the curves.

Parameters:
  • curvList – (<type list, optional>) # List of curves needed as input to create the single shape control.

  • ctrlName – (<type str, optional>) # Name for the resulting control.

  • freezeCurvs – (<type bool, optional>) # Determines if the input curves should be frozen (transform reset). Default is False.

Returns:

(<type asNode>) # The control curve created from the multiple input curves as a Maya node.

Usage:

To create single shape control from multiple curves

ctrl              =eCtrl.multiCurvCtrl()[0]
ctrlGrp           =eCtrl.multiCurvCtrl()[-1]
ctrl, ctrlGrp =eCtrl.multiCurvCtrl()

Returns:

return ctrlCurv                         #_ asNode

Fonts:

#_ fontList =['Palatino Linotype', 'Bolide', 'Vectroid', 'Snap ITC', 'Quaint', 'Ravie']
#_ ['Outer Sider BRK', 'ChangChangWoodcut']
#_ textCurves(ch=0, t='ikfk', f= 'Quaint|h-16|w700|c0')
#_ font =fontList[rand.randint(0, 5)]
If shArgs Exist
If shArgs Does Not Exist
For Each Selected Object
If Control List Exists
If Control List Does Not Exist
If Control is Not a Curve
If Control is a Curve
If Letters are Considered
If Letters are Not Considered
For Each Control
If Control List is Not Empty
If Control List is Empty
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Get Selected Objects
/ Check Control List
/ Iterate Control List
/ Select Controls
/ Check Control Type
/ Continue Iteration
/ Mirror Control
/ Snap Vertices
/ Mirror Vertices
/ Center Pivot
/ Snap Shape to Opposite
/ Append to Mirrored List
/ Select Vertices
/ Calculate Opposite Position
/ Set Opposite Position
/ Select Mirrored Controls
/ End
Flow Chart Description:

This flowchart illustrates the mirrorCtrlShapes function:

  1. Checks if shArgs exist, and if so, parses the ctrlList, srcStr, repStr, repCount, and letters from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Retrieves a list of selected controls (control curves).

  4. For each selected control:
    • Checks if it’s a curve shape (control shape).

    • If it’s not a curve shape, continues to the next control.

    • If it’s a curve shape, proceeds to mirror it.

  5. If letters are considered in the mirroring process:
    • Snaps vertices to their opposite positions.

    • Centers the pivot of the mirrored control.

    • Snaps the shape to the opposite location.

  6. If letters are not considered:
    • Mirrors vertices by changing their X-coordinates to the opposite side.

  7. Appends the mirrored control to the list of mirrored controls.

  8. After processing all controls, selects the mirrored controls if the list is not empty.

eCtrl.nailCtrl(self, ctrlName=None, grpLevel=1, snapPiv=True, initRot=[0, 0, 0], ctrlType=1, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, sp=snapPiv, ir=initRot, ct=ctrlType]

Purpose:

:: Designs a nail-shaped control in Autodesk Maya, ideal for various rigging tasks. The control is customizable in terms of name, group level, pivot snapping, initial rotation, and control type.

  • The nail shape can be particularly useful for controls requiring a pointed or directed indication, such as directional markers or pinpoints in a rigging setup.

  • The customization options allow for flexible use across different rigging scenarios and needs.

Parameters:
  • ctrlName<str, optional> # Name for the nail control. Defaults to ‘as_Nail_Ctrl’.

  • grpLevel<int, optional> # Determines the grouping hierarchy level for the control. Default is 1.

  • snapPiv<bool, optional> # Indicates whether the control’s pivot should be snapped. Default is True.

  • initRot<list of float, optional> # Specifies the initial rotation of the control, formatted as [x, y, z]. Default is [0, 0, 0].

  • ctrlType<int, optional> # Defines the type of nail control to be generated. Default is 1.

Returns:

<list of asNode> # A list comprising the control and its top group as Maya nodes, based on the provided group level.

Usage Examples:

>>> nail_control = nailCtrl(ctrlName="myNailCtrl", ctrlType=1)[0]
# Creates a nail control with the default settings.

>>> nail_control, nail_control_group = nailCtrl(ctrlName="customNail", ctrlType=1, grpLevel=2, snapPiv=False)
# Creates a custom nail control with specified group level and pivot snapping settings.
If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Rotate Nail Control
Freeze Nail Control
Delete History
Create Control Group
Apply Control Color
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create Nail Control
/ Rotate Nail Control
/ Freeze Nail Control
/ Delete History
/ Create Control Group
/ Apply Control Color
/ End
Flow Chart Description:

This flowchart illustrates the nailCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName, grpLevel, snapPiv, initRot, and ctrlType.

  3. Creates a nail-shaped control based on the specified ctrlType.

  4. Rotates the nail control based on the provided initRot values.

  5. Freezes the transformations of the control.

  6. Deletes the history of the control.

  7. Creates a control group based on the grpLevel and determines pivot snapping.

  8. Applies control color to the control.

eCtrl.pinCtrl(self, ctrlName=None, grpLevel=3, initRot=[0, 0, 0], ctrlType=1, grpSufxList=None, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ir=initRot, ct=ctrlType, gsl=grpSufxList]

Purpose:

:: Provides a flexible tool for creating pin-shaped controls in Autodesk Maya, ideal for specific rigging requirements.

  • The pin control is versatile for rigging scenarios where a pin-like manipulation is required.

  • Offers customization in terms of control type, initial rotation, and grouping, catering to different rigging needs.

Parameters:
  • ctrlName<str, optional> # Name for the pin control. Defaults to a standard naming convention if not specified.

  • grpLevel<int, optional> # Determines the grouping level of the control, affecting its hierarchy. Default is 3.

  • initRot<list, optional> # Sets the initial rotation of the control, specified as [x, y, z]. Default is [0, 0, 0].

  • ctrlType<int, optional> # Type of pin control, allowing for different shapes and styles. Default is 1.

  • grpSufxList<list/str, optional> # Custom suffixes for group names, enhancing organizational flexibility.

Returns:

<list> # Returns a list containing the pin control and its top group as Maya nodes, structured as per grpLevel.

Code Examples:

>>> pin_control = pinCtrl(ctrlName="myPinCtrl", grpLevel=3, ctrlType=2)
# Creates a pin control with a specific name, group level, and control type.
If shArgs Exist
If shArgs Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Generate Control
/ Rotate Control
/ Group Control
/ Apply Color
/ End
Flow Chart Description:

This flowchart illustrates the pinCtrl function:

  1. Checks if shArgs exist, and if so, parses the function arguments from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Generates a pin-shaped control in Autodesk Maya based on the specified control type.

  4. Rotates the control based on the initRot parameter.

  5. Groups the control based on the grpLevel and grpSufxList parameters.

  6. Applies color to the control using the applyCtrlColor method.

  7. Ends the process.

eCtrl.pistolCtrl(self, ctrlName=None, grpLevel=1, ctrlType=1)#

[**shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType]

Purpose:

:: Creates a pistol-shaped control in Autodesk Maya, customizable with control name, group level, and control type.

  • This control is designed for scenarios where a pistol-like shape is necessary, such as character rigging or prop animation.

  • The customization options allow for a wide range of uses and adjustments to fit specific rigging needs.

Parameters:
  • ctrlName<str, optional> #Name for the pistol control.

  • grpLevel<int, optional> #Specifies the hierarchy level for grouping the control. Default is 1.

  • ctrlType<int, optional> #Type of pistol control to be created. Default is 1.

Returns:

<list> #A list containing the control and its top group as Maya nodes, based on grpLevel.

Control Type 1
Other Control Types
Start
/ Check Control Type
/ Create Curve 1
/ Create Curve 2
/ Combine Curves
/ Apply Control Color
/ Create Control Group
End
Flow Chart Description:

This flowchart illustrates the pistolCtrl function:

  1. The function begins by checking the specified control type.

  2. Based on the control type, it creates one or more curves to form the base of the pistol control.

  3. These curves are then combined to form the final pistol control shape.

  4. The control color is applied to the pistol control for visual identification.

  5. A control group is created at the specified group level to organize the control within the Maya hierarchy.

  6. The process concludes with the creation of the pistol control and its associated group.

eCtrl.pivotCtrl(self, baseCtrl=None, ctrlName=None, grpLevel=1, ctrlType=1, initRot=[0, 0, 0], snapPiv=1, grpSufxList=None, colorVal=None, attrDivider=1, **shArgs)#

[**shArgs : bc=baseCtrl, cn=ctrlName, gl=grpLevel, ct=ctrlType, ir=initRot, sp=snapPiv, gsl=grpSufxList, cv=colorVal, ad=attrDivider]

Purpose:

:: Generates a pivot control in Autodesk Maya, with options for base control, control name, group level, control type, initial rotation, pivot snapping, group suffix list, color value, and attribute divider.

  • Ideal for creating a secondary control that can be used to adjust the pivot of another control, enhancing rig flexibility.

  • The pivot control can be attached to any existing control, allowing for dynamic pivot adjustments during animation.

Parameters:
  • baseCtrl<Maya node, optional> #The base control to which the pivot control is associated.

  • ctrlName<str, optional> #Name for the pivot control.

  • grpLevel<int, optional> #Hierarchy level for grouping the control. Default is 1.

  • ctrlType<int, optional> #Type of pivot control to create. Default is 1.

  • initRot<list, optional> #Initial rotation of the control, given as [x, y, z]. Default is [0, 0, 0].

  • snapPiv<bool, optional> #Whether to snap the control’s pivot. Default is 1.

  • grpSufxList<list/str, optional> #Suffix list for the control’s groups.

  • colorVal<color, optional> #Color value to apply to the control.

  • attrDivider<int, optional> #Attribute divider for the control. Default is 1.

Returns:

<list> #A list containing the pivot control and its top group as Maya nodes, based on grpLevel.

If baseCtrl is specified
If baseCtrl is not specified
Control Type 1
Other Control Types
Base Control Exists
Base Control Not Specified
Start
/ Check Base Control
/ Create Pivot Control
/ Auto Select Base Control
/ Check Control Type
/ Create Curve 1
/ Create Curve 2
/ Combine Curves
/ Scale and Freeze Transform
/ Finalize Control
/ Check Base Control Attribute
/ Snap and Parent Control
/ Lock Attributes
/ Connect Attributes
End
Flow Chart Description:

This flowchart illustrates the pivotCtrl function:

  1. The process starts by checking if a base control is specified.

  2. If not specified, it automatically selects the base control.

  3. A pivot control is created, and its type is checked.

  4. Depending on the control type, appropriate curves are created and combined to form the pivot control.

  5. The pivot control is scaled and its transformations are frozen for clean usage.

  6. The control is finalized, and its position and rotation are set.

  7. The function checks if the base control has the necessary attribute for pivot control.

  8. If the base control exists, the pivot control is snapped and parented to it.

  9. Relevant attributes are locked for the pivot control.

  10. The pivot control’s attributes are connected to the base control’s pivot attributes.

  11. The process ends with the creation of the pivot control and its group.

eCtrl.poleCtrl(self, ctrlName=None, sidePos='L_', grpLevel=3, ctrlType=1, initRot=[0, 0, 0], grpSufxList=None, snapPiv=1, colorVal=None, **shArgs)#

[shArgs : cn=ctrlName, sp=sidePos, gl=grpLevel, ct=ctrlType, ir=initRot, gsl=grpSufxList, sp=snapPiv, cv=colorVal]

Purpose:

:: Creates a pole control in Autodesk Maya, with options for control name, side position, group level, control type, initial rotation, group suffix list, pivot snapping, and color value.

  • Allows for flexible customization of pole controls within Maya, enhancing rigging and animation workflows.

  • Supports different types of control creation, along with side-specific adjustments and color coding for easy identification.

Parameters:
  • ctrlName<str, optional> # Name for the pole control.

  • sidePos<str, optional> # Side position for the control, typically ‘L_’ for left or ‘R_’ for right. Default is ‘L_’.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Default is 3.

  • ctrlType<int, optional> # Type of pole control to be created. Default is 1.

  • initRot<list, optional> # Initial rotation of the control, given as [x, y, z]. Default is [0, 0, 0].

  • grpSufxList<list/str, optional> # Suffix list for the control’s groups.

  • snapPiv<bool, optional> # Whether to snap the control’s pivot. Default is 1.

  • colorVal<color, optional> # Color value to apply to the control.

Returns:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> control_name = "poleControl"
>>> side_position = "L_"
>>> group_level = 3
>>> control_type = 1
>>> initial_rotation = [0, 90, 0]
>>> group_suffix_list = ["_grp1", "_grp2"]
>>> snap_pivot = True
>>> color_value = (1, 0, 0)
>>> pole_control = poleCtrl(control_name, side_position, group_level, control_type, initial_rotation, group_suffix_list, snap_pivot, color_value)
# Creates a left-sided pole control with specified parameters.
Side Position 'L_' or 'LT_'
Side Position 'R_' or 'RT_'
Ctrl Type 1
Ctrl Type 2
Ctrl Type 3
Ctrl Type 1
Ctrl Type 2
Ctrl Type 3
Start
/ Check Side Position
/ Determine Ctrl Type 'L_'
/ Determine Ctrl Type 'R_'
/ Create Ctrl 'L_' Type 1
/ Create Ctrl 'L_' Type 2
/ Create Ctrl 'L_' Type 3
/ Create Ctrl 'R_' Type 1
/ Create Ctrl 'R_' Type 2
/ Create Ctrl 'R_' Type 3
/ Finalize Ctrl 'L_' Type 1
/ Finalize Ctrl 'L_' Type 2
/ Finalize Ctrl 'L_' Type 3
/ Finalize Ctrl 'R_' Type 1
/ Finalize Ctrl 'R_' Type 2
/ Finalize Ctrl 'R_' Type 3
End
Flow Chart Description:

This flowchart illustrates the poleCtrl function:

  1. The process begins by checking the sidePos (’L_’ or ‘R_’).

  2. Based on the side position, the function determines the control type.

  3. Depending on the control type (1, 2, or 3), the corresponding pole control is created for either ‘L_’ or ‘R_’.

  4. Each control type goes through a finalization process which includes setting pivot, group level, color, and other properties.

  5. The process concludes after the control is finalized.

eCtrl.rebuildCurves(self, curvesList=None, multiplyCVs=1, deleteHistory=1, **shArgs)#

[**shArgs : cl=curvesList, mc=multiplyCVs, dh=deleteHistory]

Purpose:

:: Rebuilds a list of curves, modifying their structure based on specified parameters.

  • This function allows for adjusting the complexity and detail of curves in a Maya scene.

  • It is particularly useful for refining the shape and smoothness of curve-based controls or paths.

Parameters:
  • curvesList<list, optional> #List of curve names to be rebuilt. If not provided, defaults to the current selection.

  • multiplyCVs<int, optional> #Factor by which to multiply the number of control vertices (CVs) in each curve.

  • deleteHistory<int, optional> #Flag to determine whether to delete history after rebuilding (1 to delete, 0 to keep).

Returns:

None #No return value, but modifies the curves in place.

Curves List Provided
No Curves List
Delete History
Keep History
Start
/ Check Curves List
/ Rebuild Curves
/ Select Curves
/ Check Delete History
/ Delete History
End
Flow Chart Description:

This flowchart illustrates the rebuildCurves function:

  1. The function begins by checking if a list of curves is provided. If not, it prompts the user to select curves in the scene.

  2. Once the curves list is established, the function rebuilds each curve based on the specified parameters, including the factor by which to multiply the number of control vertices (CVs).

  3. After rebuilding the curves, it checks if the history should be deleted. If yes, the history of the curves is deleted to maintain scene cleanliness.

  4. The process concludes either after deleting the history or directly if the history is to be retained, based on the user’s choice.

eCtrl.rootCtrl(self, ctrlName=None, grpLevel=3, ctrlType=3, initRot=[0, 0, 0], snapPiv=1, grpSufxList=None, colorVal=None, **shArgs)#

[**shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType, ir=initRot, sp=snapPiv, gsl=grpSufxList, cv=colorVal]

Purpose:

:: Creates a root control in Autodesk Maya, offering customizable options for control name, group level, control type, initial rotation, pivot snapping, group suffix list, and color value.

  • This function allows for the dynamic creation of root controls in a 3D scene, aiding in rigging and animation processes.

  • The control’s appearance and behavior can be extensively customized through various parameters.

Parameters:
  • ctrlName<str, optional> # Name for the root control.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Default is 3.

  • ctrlType<int, optional> # Type of root control to be created. Options include different shapes. Default is 3.

  • initRot<list, optional> # Initial rotation of the control, given as [x, y, z]. Default is [0, 0, 0].

  • snapPiv<bool, optional> # Whether to snap the control’s pivot. Default is 1.

  • grpSufxList<list/str, optional> # Suffix list for the control’s groups.

  • colorVal<color, optional> # Color value to apply to the control.

Returns:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Usage Examples:

>>> ctrlName = "myRootCtrl"
>>> grpLevel = 3
>>> ctrlType = 1
>>> initRot = [45, 0, 0]
>>> snapPiv = True
>>> grpSufxList = ["grp1", "grp2"]
>>> colorVal = (1, 0, 0)
>>> ctrl, ctrlGrp = rootCtrl(ctrlName, grpLevel, ctrlType, initRot, snapPiv, grpSufxList, colorVal)
Input Provided
No Input
Start
/ Check Inputs
/ Create Root Control
/ Group Control
/ Apply Color
End
Error
Flow Chart Description:

This flowchart illustrates the rootCtrl function:

  1. The function starts by checking if all necessary inputs like control name, group level, control type, initial rotation, pivot snapping, group suffix list, and color value are provided.

  2. If inputs are provided, it creates a root 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 root control.

  6. If any inputs are missing, an error is indicated.

eCtrl.scaleShape(self, nodesList=None, scale=1.1, **shArgs)#

[shArgs: nl=nodesList, s=scale]

Purpose:

:: Provides functionality to uniformly scale the shapes of specified nodes in Autodesk Maya.

  • Useful in rigging to adjust control shapes for better visibility and interaction.

  • Offers flexibility to scale multiple shapes at once, enhancing efficiency in rig setup.

Parameters:
  • nodesList<list, optional> # List of nodes whose shapes are to be scaled. Defaults to the current selection if not provided.

  • scale<float> # Scaling factor to be applied to the shapes.

Returns:

None # Scales the specified nodes’ shapes in place without returning any value.

Code Examples:

>>> nodes_to_scale = ["ctrl1", "ctrl2"]
>>> scale_factor = 1.5
>>> scaleShape(nodes_to_scale, scale_factor)
# Scales the shapes of 'ctrl1' and 'ctrl2' by a factor of 1.5.

>>> scaleShape(scale=2.0)
# Scales the shapes of currently selected nodes by a factor of 2.0.
shArgs provided
shArgs not provided
Nodes list provided
No nodes list provided
If node type is Transform
If node type is not Transform
If element in node
No element in node
Start
/ Check shArgs
/ Update Arguments
/ Check Nodes List
/ Check Node Type
/ Select Current Nodes
/ Get Shapes
/ Scale Shapes
/ Check Node Element
/ Scale Element
/ Collect CVs
End
Flow Chart Description:

This flowchart illustrates the scaleShape function:

  1. The process starts by checking if shArgs are provided. If so, it updates the arguments for nodes list and scale.

  2. If nodesList is not provided, the function selects the current nodes.

  3. The function then checks if the node type is Transform. If yes, it retrieves the shapes of the nodes.

  4. It scales the shapes based on the provided scale factor.

  5. If the node contains an element, it scales the specific element.

  6. Otherwise, it collects the control vertices (CVs) and scales them.

  7. The function concludes without returning any value, having scaled the specified nodes’ shapes.

eCtrl.setPoseCtrl(self, ctrlName, grpLevel=1, snapPiv=1, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, sp=snapPiv]

Purpose:

:: Creates a set pose control in Autodesk Maya, providing functionality for control naming, grouping, and pivot snapping.

  • Useful for rigging and animation workflows where precise control over set poses is required.

  • Allows for creating neatly organized and easily manageable set pose controls in complex rigs.

param ctrlName:

<str, required> # Name for the set pose control. This is a required argument.

param grpLevel:

<int, optional> # Level of grouping for the control, providing organizational structure. Default is 1.

param snapPiv:

<bool, optional> # Determines if the control’s pivot should be snapped. Default is True (1).

return:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> control_name = "mySetPoseControl"
>>> control, control_group = setPoseCtrl(ctrlName=control_name, grpLevel=2)
# Creates a set pose control with the specified name and 2 group levels.
CtrlName provided
CtrlName not provided
Start
/ Check Control Name
/ Create Control Shape
End
/ Group Control
/ Apply Color
Flow Chart Description:

This flowchart illustrates the setPoseCtrl function:

  1. The process begins by checking if a control name is provided. If not, the function ends immediately.

  2. If a control name is provided, the function proceeds to create the control shape using the ‘curve’ command.

  3. The control is then grouped based on the specified group level and whether the pivot should be snapped.

  4. Finally, a color is applied to the control for easy identification, completing the process.

  5. The function returns a list containing the control and its top group as Maya nodes.

eCtrl.setSafeZone(lenNode, ratio, ctrlList, **shArgs)#

[shArgs: ln=lenNode, r=ratio, cl=ctrlList]

Purpose:

:: Implements dynamic visual feedback on control nodes based on the length of a specified node and a defined ratio.

  • Enhances the rigging process by offering a visual safe zone indication for animators.

  • Dynamically adjusts control node colors to signal when movements are within or exceed safe operational ranges.

Parameters:
  • lenNode<str> #Node that defines the length for the safe zone calculation.

  • ratio<float> #Ratio used to determine the boundaries of the safe zone.

  • ctrlList<list> #List of control nodes to be visually adjusted in response to the safe zone.

Returns:

None. Configures an expression to dynamically update control colors based on the safe zone.

Code Examples:

>>> setSafeZone(lenNode="spineLengthNode", ratio=0.2, ctrlList=["ctrl1", "ctrl2", "ctrl3"])
# Sets a safe zone for the 'spineLengthNode' with a 20% ratio, affecting the colors of 'ctrl1', 'ctrl2', 'ctrl3'.
_images/setSafeZone.jpg
eCtrl.setScale(self, ctrlList=None, refObj=None, refAttr=None, ratio=1.0, refVal=None, freezeIt=True, useShape=False, **shArgs)#

[**shArgs : cl=ctrlList, ro=refObj, ra=refAttr, r=ratio, rv=refVal, fi=freezeIt, us=useShape]

_images/setScale.jpg

Purpose:

:: Adjusts the scale of a list of controls in Autodesk Maya based on a reference object or value.

  • Useful for dynamically scaling controls in relation to another object’s attributes or a specified value.

  • Offers options to freeze transformations and use shape nodes for scaling.

Parameters:
  • ctrlList<list, optional> # List of control names to be scaled. If None, uses the currently selected controls.

  • refObj<str, optional> # Name of the reference object for scaling.

  • refAttr<str, optional> # Name of the attribute on the reference object to use for scaling.

  • ratio<float> # Ratio to apply to the reference attribute value for scaling.

  • refVal<float, optional> # Direct reference value to use for scaling if no reference object is specified.

  • freezeIt<bool> # Whether to freeze transformations after scaling.

  • useShape<bool> # Whether to apply scaling to the shape node instead of the transform node.

Returns:

None # Does not return a value but scales the specified controls.

Code Examples:

>>> control_list = ["ctrl1", "ctrl2"]
>>> reference_object = "locator1"
>>> scale_ratio = 1.5
>>> setScale(control_list, reference_object, ratio=scale_ratio)
# Scales the controls in control_list based on the scale of reference_object with a ratio of 1.5.
If ctrlList is provided
If ctrlList is not provided
Controls selected
No controls selected
Calculate scaling value based on provided parameters
Start
/ Check Inputs
/ Determine Scaling
/ Select Controls
Error: No Controls
/ Apply Scaling
End
Flow Chart Description:

This flowchart illustrates the setScale function:

  1. Starts by checking if a list of controls (ctrlList) is provided.

  2. If ctrlList is provided, the function proceeds to determine the scaling value based on the provided parameters (refObj, refAttr, ratio, refVal).

  3. If ctrlList is not provided, it prompts the user to select controls.

  4. After determining the scaling value, the function applies the scaling to the selected controls.

  5. The function concludes after applying the scaling or encountering an error due to no controls being selected.

eCtrl.setShape(self, curv, crvShapeList, **shArgs)#

[shArgs: c=curv, csl=crvShapeList]

Purpose:

:: Creates a new shape on the specified curve transform, using properties defined in the crvShapeList.

  • Facilitates the modification of curve shapes in Maya.

  • Useful for riggers and animators to customize curve controls in a scene.

Parameters:
  • curv<str> # The name of the curve transform to which the new shapes will be added.

  • crvShapeList<list> # A list of dictionaries, each specifying properties for a new curve shape.

Returns:

None # Modifies the curve by adding new shapes based on the provided properties.

Code Examples:

>>> curve_name = "myCurve"
>>> shape_list = [{"points": [(0,0,1), (1,0,0)], "knots": [0,1], "form": 0, "degree": 1}]
>>> setShape(curve_name, shape_list)
# Adds new shapes to the specified curve based on the properties in shape_list.
Curve Name Provided
For Each Shape in List
No Curve Name Provided
Start
/ Check Curve Name
/ Get Old Shape
/ Delete Old Shape
/ Iterate CrvShapeList
/ Create New Shape
/ Set Shape Attributes
End
Error
Flow Chart Description:

This flowchart illustrates the setShape function:

  1. The function begins by checking if a curve name is provided.

  2. If a curve name is provided, it retrieves the old shape of the curve.

  3. The old shape is then deleted to make way for new shapes.

  4. The function iterates through each dictionary in the crvShapeList.

  5. For each dictionary, it creates a new shape on the curve with the specified properties.

  6. The attributes of the new shapes are set, including color, if specified.

  7. The function concludes after creating and setting attributes for all new shapes.

  8. If no curve name is provided, an error is indicated.

eCtrl.shapeCtrl(self, shapeObj=None, trgt=None, shapeAdd=1, reName=0, deleteShape=1, ctrlName=None, **shArgs)#

[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 provided
shArgs not provided
Both shapeObj and trgt provided
Either not provided
If target has shapes
No shapes in target
deleteShape is True
deleteShape is False
Start
/ 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 Control
End
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.

eCtrl.shiftCtrl(self, ctrlList, shiftType='trans', valList=[0, 0, 0], **shArgs)#

[shArgs: cl=ctrlList, st=shiftType, vl=valList]

Purpose:

:: Provides a versatile tool for adjusting the position, rotation, or scale of control curves in a rigging setup.

  • Enhances rigging efficiency by allowing batch adjustments to multiple controls.

  • Supports diverse rigging requirements with flexible transformation options.

_images/shiftCtrl.jpg
Parameters:
  • ctrlList<list> #List of control curves to be adjusted.

  • shiftType<str, optional> #Type of shift to be applied. Options are ‘trans’, ‘rotate’, or ‘scale’. Default is ‘trans’.

  • valList<list, optional> #Values for the shift operation, applicable to the shiftType. Defaults to [0, 0, 0].

Returns:

None #Modifies the control curves as per the specified parameters.

Code Examples:

>>> controls = ["ctrl1", "ctrl2", "ctrl3"]
>>> shiftCtrl(ctrlList=controls, shiftType='trans', valList=[1, 0, 0])
# Moves 'ctrl1', 'ctrl2', 'ctrl3' by 1 unit along the X-axis.

>>> shiftCtrl(ctrlList=["ctrl4"], shiftType='scale', valList=[1.5, 1.5, 1.5])
# Scales 'ctrl4' by 1.5 times in all directions.
shArgs provided
shArgs not provided
Shapes exist
No shapes
Type is nurbsCurve
Type is not nurbsCurve
trans or t
rotate or r
scale or s
Start
/ Check shArgs
/ Update Arguments
/ Verify Ctrl List
/ Iterate Ctrl List
/ Check Ctrl Shapes
/ Get Object Type
Raise Error
/ Check Object Type
/ Select Curve CVs
/ Apply Shift Type
/ Move Control
/ Rotate Control
/ Scale Control
/ Select Controls
/ Build TranslateMM
End
Flow Chart Description:

This flowchart illustrates the shiftCtrl function:

  1. The process begins with checking if shArgs are provided and updates the arguments accordingly.

  2. It verifies the control list and iterates through each control in the list.

  3. The function checks if the control has shapes and determines the object type.

  4. If the type is not ‘nurbsCurve’, an error is raised.

  5. Curve CVs are selected, and the shift type is applied based on the specified parameters (translation, rotation, or scaling).

  6. After modifying the controls, they are selected and the TranslateMM tool is built.

  7. The process concludes after performing the shift operations on the controls.

eCtrl.snapCurves2Curv(self, srcCurves, destCurv, **shArgs)#

[shArgs: sc=srcCurves, dc=destCurv]

Purpose:

:: Snaps the vertices of source curves to the corresponding vertices of a destination curve in Autodesk Maya.

  • Useful for aligning multiple curves to a single reference curve, ensuring consistent vertex positions across them.

  • Ideal for rigging and animation tasks where precise curve alignment is required.

Parameters:
  • srcCurves<list/str> # Source curves to be snapped. Can be a single curve or a list of curves.

  • destCurv<str> # The destination curve to which the source curves’ vertices will be snapped.

Returns:

None # Modifies the source curves by snapping their vertices to the destination curve without returning any value.

Code Examples:

>>> source_curves = ["curve1", "curve2"]
>>> destination_curve = "mainCurve"
>>> snapCurves2Curv(source_curves, destination_curve)
# Snaps the vertices of 'curve1' and 'curve2' to the corresponding vertices of 'mainCurve'.
_images/snapCurves2Curv.jpg
eCtrl.snapShpTo(self, srcCtrl, destPosOrObj=[0, 0, 0], shapePos=False, **shArgs)#

[shArgs: sc=srcCtrl, dpo=destPosOrObj, sp=shapePos]

Purpose:

:: Allows the snapping of a source control’s shape to a specific position or object in Autodesk Maya.

  • Enhances the precision of positioning control shapes in rigging and animation workflows.

  • Facilitates the alignment of control shapes to objects or coordinates, providing better control over rig behavior.

Parameters:
  • srcCtrl<str> # The source control whose shape is to be snapped.

  • destPosOrObj<list/str, optional> # The destination position as a list or an object to snap to. Defaults to [0, 0, 0].

  • shapePos<bool, optional> # Flag to determine if snapping uses shape position. Defaults to False.

Returns:

None # Modifies the source control by snapping its shape to the specified position or object without returning any value.

Code Examples:

>>> source_control = "ctrl1"
>>> destination_position = [1, 2, 3]
>>> snapShpTo(source_control, destination_position)
# Snaps the shape of 'ctrl1' to the position [1, 2, 3].

>>> destination_object = "targetObj"
>>> snapShpTo(source_control, destination_object, True)
# Snaps the shape of 'ctrl1' to the position of 'targetObj', considering the shape position.
_images/snapShpTo.jpg
eCtrl.snapWithOffset(self, ctrlGrp, refObj, attr, ratio, axisDirList, **shArgs)#

[shArgs: cg=ctrlGrp, ro=refObj, a=attr, r=ratio, adl=axisDirList]

Purpose:

:: Snaps a control group to a reference object with an offset in Autodesk Maya.

  • Facilitates precise positioning of control groups based on the attributes of another object.

  • Allows for customized offsetting along specified axis directions.

Parameters:
  • ctrlGrp<str> # Name of the control group to be snapped.

  • refObj<str> # Name of the reference object used for snapping.

  • attr<str> # Name of the attribute on the reference object to determine the offset.

  • ratio<float> # Ratio to scale the attribute value for offset calculation.

  • axisDirList<list/str> # Axis directions (‘x’, ‘-x’, ‘y’, ‘-y’, ‘z’, ‘-z’) for applying the offset.

Returns:

None # Adjusts the position of the control group but does not return a value.

Code Examples:

>>> control_group = "ctrl_grp"
>>> reference_object = "locator1"
>>> attribute_name = "translateX"
>>> offset_ratio = 2.0
>>> snapWithOffset(control_group, reference_object, attribute_name, offset_ratio, "x")
# Snaps the control group to the reference object with a doubled offset along the X-axis.
If shArgs Exist
If shArgs Does Not Exist
Snap control group to reference object
Calculate offset based on attribute and ratio
Move control group based on calculated offset and axis directions
Start
/ Check Inputs
/ Parse shArgs
/ Initialize Parameters
/ Snap Control Group
/ Calculate Offset
/ Apply Offset
End
Flow Chart Description:

This flowchart illustrates the snapWithOffset function:

  1. Starts by checking if shArgs are provided. If they are, it parses the necessary arguments (ctrlGrp, refObj, attr, ratio, axisDirList).

  2. If shArgs are not provided, initializes parameters with default or provided values.

  3. Snaps the control group to the reference object.

  4. Calculates the offset based on the specified attribute and ratio.

  5. Applies the calculated offset to the control group based on the provided axis directions.

  6. The function concludes after applying the offset to the control group.

eCtrl.spineCtrl(self, ctrlName, grpLevel=1, ctrlShape='circle', **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, cs=ctrlShape]

Purpose:

:: Creates a spine control in Autodesk Maya, offering customization for control name, group level, and control shape.

  • Essential for rigging the spine of characters, providing flexibility and control for animating torso movements.

  • Allows for diverse visual representation of the control through various shape options.

Parameters:
  • ctrlName<str> # The name for the spine control. This is a required parameter.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Default is 1.

  • ctrlShape<str, optional> # Shape of the spine control. Available options include ‘circle’, ‘snake’, ‘gold ring’, ‘star’, ‘one pin’, ‘arrow head’. Default is ‘circle’.

Returns:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Code Examples:

>>> control_name = "spineControl"
>>> group_level = 1
>>> control_shape = "circle"
>>> spine_control = spineCtrl(control_name, group_level, control_shape)
# Creates a spine control with specified name, group level, and shape.
Shape 'circle'
Shape 'snake'
Shape 'gold ring'
Shape 'star'
Shape 'one pin'
Shape 'arrow head'
Start
/ Check Shape
/ Create Circle Shape
/ Create Snake Shape
/ Create Gold Ring Shape
/ Create Star Shape
/ Create One Pin Shape
/ Create Arrow Head Shape
/ Finalize Control
End
Flow Chart Description:

This flowchart illustrates the spineCtrl function:

  1. The process starts by checking the specified ctrlShape.

  2. Depending on the ctrlShape, the function creates the control in the shape of a circle, snake, gold ring, star, one pin, or arrow head.

  3. The control is then finalized by deleting history, grouping at the specified level, and applying control color.

  4. Finally, the function returns a list containing the control and its top group as Maya nodes.

eCtrl.spotCtrl(self, ctrlName=None, grpLevel=3, initRot=None, colorVal=None, ctrlType=1, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ir=initRot, cv=colorVal, ct=ctrlType]

Purpose:

:: Creates a spot control in Autodesk Maya, resembling a locator but made with NURBS curves, customizable with control name, group level, initial rotation, color value, and control type.

Parameters:
  • ctrlName<str, optional> #Name for the spot control. Default is ‘as_Spot_Ctrl’.

  • grpLevel<int, optional> #Specifies the hierarchy level for grouping the control. Default is 3.

  • initRot<list, optional> #Initial rotation of the control, given as [x, y, z].

  • colorVal<color, optional> #Color value to apply to the control.

  • ctrlType<int, optional> #Type of spot control to be created. Options include different shapes. Default is 1.

Returns:

<list> #A list containing the control and its top group as Maya nodes, based on grpLevel.

Usage:

ctrl                  =eCtrl.spotCtrl(ctrlName)[0]
ctrlGrp       =eCtrl.spotCtrl(ctrlName)[-1]
ctrl, ctrlGrp =eCtrl.spotCtrl(ctrlName)
If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Create Spot Control
Rotate Control if initRot Provided
Create Control Group
Apply Control Color
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create Spot Control
/ Rotate Control
/ Create Control Group
/ Apply Control Color
/ End
Flow Chart Description:

This flowchart illustrates the spotCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName, grpLevel, initRot, colorVal, and ctrlType.

  3. Creates a spot control with the specified ctrlName and ctrlType.

  4. Rotates the control if initRot is provided.

  5. Creates a control group based on the grpLevel.

  6. Applies control color to the control.

eCtrl.squareCtrl(self, ctrlName=None, grpLevel=3, initRot=[0, 0, 0], ctrlType=1, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ir=initRot, ct=ctrlType]

Purpose:

:: Provides a straightforward way to create square-shaped controls in Autodesk Maya, useful for various rigging tasks.

  • Square controls are often used for rigging features that require orthogonal or planar manipulation.

  • Customizable to fit different rigging needs through control name, grouping, rotation, and type options.

Parameters:
  • ctrlName<str, optional> # Designates the name for the square control. Defaults to ‘as_Square_Ctrl’ if not provided.

  • grpLevel<int, optional> # Determines the control’s grouping hierarchy level, influencing its organizational structure. Default is 3.

  • initRot<list, optional> # Sets the initial rotation of the control in [x, y, z] format. Default is [0, 0, 0].

  • ctrlType<int, optional> # Specifies the type of square control, allowing for different design variations. Default is 1.

Returns:

<list> # Returns a list comprising the square control and its top group as Maya nodes, determined by grpLevel.

Code Examples:

>>> square_control = squareCtrl(ctrlName="mySquareCtrl", grpLevel=2, ctrlType=1)
# Generates a square control with a specified name, group level, and control type.
If shArgs Exist
If shArgs Does Not Exist
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Generate Control
/ Rotate Control
/ Group Control
/ Apply Color
/ End
Flow Chart Description:

This flowchart illustrates the squareCtrl function:

  1. Checks if shArgs exist, and if so, parses the function arguments from it.

  2. If shArgs do not exist, initializes parameters with default values.

  3. Generates a square-shaped control in Autodesk Maya based on the specified control type.

  4. Rotates the control based on the initRot parameter.

  5. Groups the control based on the grpLevel.

  6. Applies color to the control using the applyCtrlColor method.

  7. Ends the process.

eCtrl.starCtrl(self, ctrlName=None, grpLevel=3, ctrlType=1, initRot=[0, 0, 0], snapPiv=1, grpSufxList=None, colorVal=None, **shArgs)#

[shArgs : cn=ctrlName, gl=grpLevel, ct=ctrlType, ir=initRot, sp=snapPiv, gsl=grpSufxList, cv=colorVal]

Purpose:

:: Creates a star-shaped control in Autodesk Maya, offering options for control name, group level, control type, initial rotation, pivot snapping, group suffix list, and color value.

  • This function provides extensive customization for creating star-shaped controls in Maya, making it versatile for various rigging and animation needs.

  • The function’s flexibility in specifying control type, initial rotation, pivot snapping, and other parameters allows for precise control creation as per user requirements.

Parameters:
  • ctrlName<str, optional> # Name for the star control.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Default is 3.

  • ctrlType<int, optional> # Type of star control to be created. Options include different shapes. Default is 1.

  • initRot<list, optional> # Initial rotation of the control, given as [x, y, z]. Default is [0, 0, 0].

  • snapPiv<bool, optional> # Whether to snap the control’s pivot. Default is 1.

  • grpSufxList<list/str, optional> # Suffix list for the control’s groups.

  • colorVal<color, optional> # Color value to apply to the control.

Returns:

<list> # A list containing the control and its top group as Maya nodes, based on grpLevel.

Input Provided
No Input
Start
/ Check Inputs
/ Create Star Control
/ Group Control
/ Apply Color
End
Error
Flow Chart Description:

This flowchart illustrates the starCtrl function:

  1. The function begins by checking for provided inputs such as control name, group level, control type, initial rotation, pivot snapping, group suffix list, and color value.

  2. If inputs are provided, a star-shaped control is created based on the specified parameters.

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

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

  5. The process ends after successfully creating and configuring the star control.

  6. If required inputs are missing, an error is indicated.

eCtrl.transferAttrConnections(self)#

[shArgs]

Purpose:

:: Facilitates the transfer of attribute connections from one asNode to another within Autodesk Maya. This function is instrumental in duplicating control attributes, transferring rig setups, or managing dynamic attribute links.

  • Essential for maintaining scene integrity during complex rigging or scene modifications.

  • Allows for precise control over attribute connections, ensuring rig consistency and functionality.

Suggested args:

  • sourceNode: <str> # The source asNode from which attribute connections are to be copied.

  • targetNode: <str> # The destination asNode to which attribute connections are to be transferred.

  • attributes: <list of str, optional> # Specific attributes for which connections should be transferred. If omitted, all connections may be transferred.

Returns:

<str/bool> # A status message indicating the outcome of the transfer, or a boolean representing success (True) or failure (False).

Code Examples:

>>> result = transferAttrConnections(sourceNode="sourceCtrl", targetNode="targetCtrl", attributes=["translateX", "translateY"])
# Transfers specific attribute connections from 'sourceCtrl' to 'targetCtrl'.

>>> result = transferAttrConnections(sourceNode="oldRig", targetNode="newRig")
# Transfers all attribute connections from 'oldRig' to 'newRig'.
If shArgs Exist
If shArgs Does Not Exist
For Each Selected Object
If Attribute Exists
If Attribute Does Not Exist
If Attribute Type is String
If Attribute Type is Enum
If Attribute Type is Other
Set String Value
Set Numeric Value
If Connections Exist
If No Connections Exist
Start
/ Check shArgs
/ Initialize Parameters
/ Select Source and Target
/ Get Selected Objects
/ Check Attribute
/ Get Attribute Type
/ Error: Attribute Not Found
/ Create String Attribute
/ Warning: Unable to create Enum Attribute
/ Create Numeric Attribute
/ Set String Value
/ Set Numeric Value
/ End
/ Check Connections
/ Transfer Attribute Connections
Flow Chart Description:

This flowchart illustrates the transferAttrConnections function:

  1. Checks if shArgs exist, and if not, it prompts the user to select source and target nodes.

  2. Initializes parameters and retrieves a list of selected objects.

  3. For each selected object, it checks if the specified attribute exists.

  4. If the attribute exists, it determines its type.

  5. If the attribute type is string, it creates a string attribute and sets its value.

  6. If the attribute type is enum, it issues a warning as enum attributes cannot be transferred.

  7. If the attribute type is other, it creates a numeric attribute and sets its value.

  8. Checks if connections exist between the source and target nodes.

  9. If connections exist, it transfers attribute connections.

  10. If no connections exist, the process ends.

Note: Enum attributes cannot be transferred, and a warning is issued if encountered.

eCtrl.triangleCtrl(self, ctrlName=None, grpLevel=3, initRot=[0, 0, 0], ctrlType=1, **shArgs)#

[shArgs : ctrlName=n, grpLevel=gl, initRot=ir, ctrlType=ct]

Purpose:

:: Constructs a triangle control in Autodesk Maya. Offers customization in control name, group level, initial rotation, and control type for diverse rigging scenarios.

  • Ideal for rig-related applications where triangular shapes are preferred for control handles.

  • Provides flexibility in control appearance and behavior, enhancing user interaction with the rig.

Parameters:
  • ctrlName<str, optional> # Name for the triangle control. Defaults to ‘as_Triangle_Ctrl’.

  • grpLevel<int, optional> # Hierarchy level for grouping the control. Default is 3.

  • initRot<list of float, optional> # Initial rotation of the control, specified as [x, y, z]. Default is [0, 0, 0].

  • ctrlType<int, optional> # Determines the shape of the triangle control. Options include different triangle shapes. Default is 1.

Returns:

<list of asNode> # A list with the control and its top group as Maya nodes, based on grpLevel.

Usage Examples:

>>> triangle_control = triangleCtrl(ctrlName="myTriangleCtrl", ctrlType=1)[0]
# Creates a standard triangle control with default settings.

>>> triangle_control, triangle_control_group = triangleCtrl(ctrlName="customTriangle", ctrlType=2, grpLevel=2)
# Creates a custom triangle control with a specific group level and control type.
If shArgs Exist
If shArgs Does Not Exist
If shArgs Exist
Rotate Triangle Control
Freeze Triangle Control
Delete History
Create Control Group
Apply Control Color
Start
/ Check shArgs
/ Parse shArgs
/ Initialize Parameters
/ Create Triangle Control
/ Rotate Triangle Control
/ Freeze Triangle Control
/ Delete History
/ Create Control Group
/ Apply Control Color
/ End
Flow Chart Description:

This flowchart illustrates the triangleCtrl function:

  1. Checks if shArgs exist and parses them if present.

  2. Initializes parameters for control creation, including ctrlName, grpLevel, initRot, and ctrlType.

  3. Creates a triangle control based on the specified ctrlType.

  4. Rotates the triangle control based on the provided initRot values.

  5. Freezes the transformations of the control.

  6. Deletes the history of the control.

  7. Creates a control group based on the grpLevel.

  8. Applies control color to the control.