Wiki / Commands

Command reference

Every public method on mt, with its real signature and defaults, read from the source. Click any row to expand.

117 entries

Tools tools.py#

Controls, attributes, colour, utility nodes, JSON and geometry queries.

mt.assign_color(input='', color='lightBlue')tools.py:267

Assign a color to the desired transform.

signature
mt.assign_color(input='', color='lightBlue')
Args:
        input (str): Input string representing the selection. If not specified, the current selection will be used.
        color (str): Name of the color to assign. Available colors are: 'red', 'blue', 'white', 'purple', 'green',
                                 'lightBlue', 'yellow', 'pink', 'grey', and 'orange'.

Returns:
        None

Notes:
        - This function assigns a color to the transform(s) specified in the input.
        - If `input` != specified, it will use the current selection.
        - The `color` parameter should be a string representing the color name.
        - The available colors and their corresponding values are defined in the `colors` dictionary.

Examples:
        # Example 1: Assign the color 'red' to the current selection
        assign_color()

        # Example 2: Assign the color 'green' to a specific transform
        assign_color(input='transform1', color='green')

        # Example 3: Assign the color 'lightBlue' to multiple transforms
        assign_color(input=['transform1', 'transform2'], color='lightBlue')
mt.assign_color_rgb(input='', color=[1, 1, 1], hsv=False)tools.py:323

Assign an RGB color or HSV color to the desired transform(s).

signature
mt.assign_color_rgb(input='', color=[1, 1, 1], hsv=False)
Args:
        input (str or list): Input string or list representing the selection. If not specified, the current selection
                                                 will be used.
        color (list): List of RGB or HSV values representing the color to assign.
        hsv (bool): True if the color values are in HSV format, False if they are in RGB format.

Returns:
        None

Notes:
        - This function assigns an RGB or HSV color to the transform(s) specified in the input.
        - If `input` != specified, it will use the current selection.
        - The `color` parameter should be a list of three values representing the color channels (R, G, B or H, S, V).
        - If `hsv` is True, the `color` parameter is interpreted as HSV values. Otherwise, it is interpreted as RGB values.

Examples:
        # Example 1: Assign an RGB color to the current selection
        assign_color(color=[1, 0, 0])

        # Example 2: Assign an HSV color to a specific transform
        assign_color(input='transform1', color=[0.5, 1, 1], hsv=True)

        # Example 3: Assign an RGB color to multiple transforms
        assign_color(input=['transform1', 'transform2'], color=[0, 1, 0.5])
mt.bounding_cube(input='', size=1, name='', axis=setup['twist_axis'])tools.py:1321

Create a control cube with coverage for the full limb, resembling a bounding box in length.

signature
mt.bounding_cube(input='', size=1, name='', axis=setup['twist_axis'])
Args:
        input (str or list): Name of the transform(s) to use as input. If not specified, it will use the currently selected object(s).
        size (float): Size of the control cube.
        name (str): Name of the cube. If not specified, a default name will be used.
        axis (str): Axis to aim the control cube towards. Valid values are 'X', 'Y', or 'Z'. By default, it reads the value from the setup dictionary.

Returns:
        str: Name of the created control cube.

Notes:
        - This function creates a control cube that covers the full limb.
        - The 'input' parameter specifies the name of the transform(s) to use as input. If not specified, it will use the currently selected object(s).
        - The 'size' parameter controls the size of the control cube.
        - The 'name' parameter allows specifying a custom name for the control cube. If not specified, a default name will be used.
        - The 'axis' parameter determines the axis to aim the control cube towards. Valid values are 'X', 'Y', or 'Z'. By default, it reads the value from the setup dictionary.
        - The function returns the name of the created control cube.

Examples:
        # Create a control cube with a size of 2, aiming towards the Y axis.
        bounding_cube(input='limb_1', size=2, axis='Y')

        # Create a control cube with the default size, aiming towards the Z axis.
        bounding_cube(input='limb_2', axis='Z')
mt.build_all_curves()tools.py:625

Create all curves to generate icons or images quickly.

signature
mt.build_all_curves()
Args:
        None

Returns:
        None

Notes:
        - This function iterates over the `curve_data` list to create all the curves.
        - Each curve is created using the `curve` function with the specified type.
        - The curve is then renamed to match its type.

Examples:
        # Creates all the curves specified in the `curve_data` list.
        build_all_curves()
mt.calculate_bounding_box_diagonal(geo)tools.py:2541

Calculates the diagonal length of the bounding box of the specified geometry.

signature
mt.calculate_bounding_box_diagonal(geo)
Args:
        geo (str): Name of the geometry.

Returns:
        tuple: A tuple containing the name of the bounding box and the diagonal length.

Example:
        bbox, diagonal_length = calculate_bounding_box_diagonal('pSphere1')
mt.change_curve_shape(input='', new_shape='', size=1)tools.py:651

Change the shape of a curve.

signature
mt.change_curve_shape(input='', new_shape='', size=1)
Args:
        input (str): Name of the curve object to modify. If not provided, the currently selected object will be used.
        new_shape (str): The new shape type to be applied to the curve.
        size (float): Size of the new shape.

Returns:
        bool: False if the new shape or input != specified or if the shapes cannot be retrieved.
        bool: True if the curve shape is successfully changed.

Raises:
        None

Notes:
        - This function changes the shape of a curve by creating a new curve with the specified `new_shape` and `size`.
        - The original curve's shape is replaced with the new shape.
        - The `input` parameter specifies the name of the curve object to modify. If not provided, the currently selected object is used.
        - The `new_shape` parameter specifies the type of shape to be applied to the curve.
        - The `size` parameter specifies the size of the new shape.

Examples:
        # Change the shape of the selected curve to a cube shape with a size of 1.
        change_curve_shape(new_shape='cube', size=1)

        # Change the shape of the curve named 'curve1' to a circle shape with a size of 0.5.
        change_curve_shape(input='curve1', new_shape='circle', size=0.5)
mt.change_default(atrr, default)tools.py:2118

Change the default value of an attribute.

signature
mt.change_default(atrr, default)
This function changes the default value of the specified attribute to the given value.

Args:
        attr (str): Name of the attribute to change.
        default: New default value for the attribute.

Returns:
        None

Notes:
        - The function uses the `cmds.addAttr()` command with the `e` flag to modify the attribute.
        - The `dv` flag is used to set the new default value for the attribute.

Example:
        # Change the default value of an attribute
        change_default('myNode.myAttribute', 10.0)
mt.check_input(func='', print_input=False)tools.py:107

if input is empty uses selection instead, i used to use this but stop becouse != usefull... sorry :)

signature
mt.check_input(func='', print_input=False)
Args:
        func: string: name of the function
        print_input: bool

Returns: None
mt.connect_compose_matrix(ctrl, comp_node, prefix)tools.py:2920

Connects control object attributes (e.g., start_translateX) to a composeMatrix node.

signature
mt.connect_compose_matrix(ctrl, comp_node, prefix)
Args:
    ctrl (str): The control object containing the attributes.
    comp_node (str): The name of the composeMatrix node to connect to.
    prefix (str): Either "start" or "end" — determines attribute naming.
mt.connect_md_node(in_x1='', in_x2=1.0, out_x='', mode='mult', name='', force=False, vector=False)tools.py:1743

Create a multiplyDivide node to connect inputs and outputs.

signature
mt.connect_md_node(in_x1='', in_x2=1.0, out_x='', mode='mult', name='', force=False, vector=False)
Args:
        in_x1 (str or int or float): Attribute or value to connect to input1X.
        in_x2 (str or int or float): Attribute or value to connect to input2X.
        out_x (str): Attribute to connect the multiplyDivide output.
        mode (str): Operation mode of the multiplyDivide node ('mult', 'divide', or 'power').
        name (str): Name of the node (optional).
        force (bool): Force the connection if needed (default: False).
        vector (bool): Connect input and output attributes as vector (default: False).

Returns:
        str: Name of the created multiplyDivide node.

Notes:
        - The created multiplyDivide node can perform multiplication, division, or power operations.
        - The input and output connections can be forced if specified.
        - If `vector` is True, the input and output connections will be treated as vector attributes.

Examples:
        # Create a multiplyDivide node and connect attributes.
        connect_md_node('attr1.attr', 'attr2.attr', 'result.attr', 'mult')

        # Create a multiplyDivide node with constant values and connect attributes.
        connect_md_node(2.0, 0.5, 'result.attr', 'mult')

        # Create a multiplyDivide node with a vector attribute and connect attributes.
        connect_md_node('vector1.attr', 'vector2.attr', 'result.attr', 'mult', vector=True)
mt.connect_object_to_offsets(driver_ctrl='', driven_ctrls=[], offset_name='', auto_root=True, rotation=True, translation=False, scaling=False)tools.py:2635

Description:

signature
mt.connect_object_to_offsets(driver_ctrl='', driven_ctrls=[], offset_name='', auto_root=True, rotation=True, translation=False, scaling=False)
Connect the transformations (rotation, translation, scaling) of a driver controller to multiple driven controllers.

Args:
        driver_ctrl (str): The controller whose transformations will be used as the source.
        driven_ctrls (list): List of controllers to connect to the driver controller.
        offset_name (str): Custom name for the offset groups created for each driven controller.
        rotation (bool): Flag to determine whether to connect rotation attributes.
        translation (bool): Flag to determine whether to connect translation attributes.
        scaling (bool): Flag to determine whether to connect scaling attributes.

Returns:
        list: A list of offset groups created for each driven controller.

Example:
        connect_object_to_offsets(driver_ctrl="source_ctrl", driven_ctrls=["driven_ctrl_1", "driven_ctrl_2"], offset_name="offset_grp", rotation=True, translation=True, scaling=False)
mt.connect_remap_value(input_value, output_value, value=0)tools.py:2178

Connect a remapValue node to remap an input value to an output value.

signature
mt.connect_remap_value(input_value, output_value, value=0)
Args:
        input_value (str): Input value attribute to connect.
        output_value (str): Output value attribute to connect.
        value (float): Default output value.

Returns:
        str: Name of the remapValue node.

Example:
        # Connect remapValue node
        remap_node = connect_remap_value('input.value', 'output.value', value=0)
mt.connect_rotate_order(input='', object='controller')tools.py:1193

Connect the rotate order attribute of the input object(s) to an attribute in the controller object.

signature
mt.connect_rotate_order(input='', object='controller')
Args:
        input (str or list): Name of the transform(s) to connect the rotate order attribute. If not specified, it will use the currently selected object(s).
        object (str): Name of the controller object where the rotate order attribute will be connected.

Returns:
        str: Name of the rotate order attribute in the controller object.

Notes:
        - This function connects the rotate order attribute of the input object(s) to an attribute in the controller object.
        - If 'input' != specified, the function will use the currently selected object(s).
        - The 'object' parameter specifies the name of the controller object where the rotate order attribute will be connected.
        - If the rotate order attribute already exists in the controller object, it will be made keyable.
        - If the rotate order attribute doesn't exist in the controller object, it will be created as an enum attribute with the rotate order values.
        - The function returns the name of the rotate order attribute in the controller object.

Examples:
        # Connect the rotate order attribute of 'object1' to the 'RotateOrder' attribute of 'controller'.
        connect_rotate_order(input='object1', object='controller')

        # Connect the rotate order attribute of multiple objects to the 'RotationOrder' attribute of 'controller'.
        connect_rotate_order(input=['object1', 'object2', 'object3'], object='controller')
mt.connect_with_line(start='', end='')tools.py:1884

Create a non-selectable curve between two objects (Pole Vectors Lines).

signature
mt.connect_with_line(start='', end='')
Args:
        start (str): Name of the start transform (optional).
        end (str): Name of the end transform (optional).

Returns:
        List[str]: List of created assets (curve and clusters).

Notes:
        - If no start and end transforms are provided, it will use the currently selected objects.
        - The curve is created using the `curve_between` function.
        - Clusters are created on CVs 0 and 1 of the curve.
        - Parent constraints are applied to the clusters to attach them to the start and end transforms.
        - The CVs and clusters are cleaned and hidden for a cleaner display.

Example:
        # Create a curve between two transforms
        connect_with_line('joint1', 'joint2')
mt.controller(input='', name='', shape='cube', color=setup['main_color'], size=1, gimbal=True, world=True)tools.py:713

Create a controller.

signature
mt.controller(input='', name='', shape='cube', color=setup['main_color'], size=1, gimbal=True, world=True)
Args:
        input (str): Name of the input object. If None, the controller will be created in the world.
        name (str): Desired name for the controller. If None, the input name will be used.
        shape (str): Desired shape of the controller. See curves.json in the config for available shapes.
        color (str): Desired color of the controller.
        size (int): Desired size of the controller.
        gimbal (bool): If True, creates a gimbal controller under the main controller.
        world (bool): If True, creates a world control oriented to the world.

Returns:
        dict: Dictionary containing the created controllers:
                - 'ctrl': Main controller
                - 'root': Root group
                - 'world': World controller (if world is True)
                - 'gimbal': Gimbal controller (if gimbal is True)

Notes:
        - This function creates a controller with the specified parameters.
        - The 'input' parameter specifies the name of the object where the controller will be created. If None, it will be created in the world.
        - The 'name' parameter specifies the desired name for the controller. If None, the input name will be used.
        - The 'shape' parameter specifies the desired shape of the controller.
        - The 'color' parameter specifies the desired color of the controller.
        - The 'size' parameter specifies the desired size of the controller.
        - The 'gimbal' parameter determines whether a gimbal controller should be created under the main controller.
        - The 'world' parameter determines whether a world controller should be created oriented to the world.

Examples:
        # Create a cube-shaped controller named 'ctrl1' with the default color, size of 1, and gimbal and world controllers.
        controller(input='object1', name='ctrl1', shape='cube', color=setup['main_color'], size=1, gimbal=True, world=True)

        # Create a sphere-shaped controller in the world with the default color, size of 2, and no gimbal or world controllers.
        controller(shape='sphere', color=setup['main_color'], size=2, gimbal=False, world=False)
mt.create_add_double_linear(name=None)tools.py:1980

Create an add node compatible with multiple Maya versions.

signature
mt.create_add_double_linear(name=None)
Returns:
        str: The created node name.
mt.create_ik_spline_twist(start, end, curve)tools.py:1703

Create an IK spline based on two joints and one curve.

signature
mt.create_ik_spline_twist(start, end, curve)
This function creates an IK spline handle using the specified start and end joints
and a curve as the spline shape.

Args:
        start (str): Name of the first joint.
        end (str): Name of the last joint.
        curve (str): Name of the curve to be used as the spline shape.

Returns:
        dict: A dictionary containing the names of the IK handle, effector, and curve.

Notes:
        - The IK handle is created using the 'ikSplineSolver' solver type.
        - The created IK handle, effector, and curve are renamed using the specified naming conventions.

Examples:
        # Create an IK spline handle between two joints using a curve.
        create_ik_spline_twist('joint1', 'joint2', 'curve1')
mt.create_joint_reader(joint, push_joint_name, return_all=False, locator_size=0.5, color='green')tools.py:2717

Creates a reader locator for a given joint and organizes it under a reader group.

signature
mt.create_joint_reader(joint, push_joint_name, return_all=False, locator_size=0.5, color='green')
Args:
    joint (str): The name of the joint to read motion from.
    push_joint_name (str): The base name used to name the reader locator and group.

Returns:
    str: The name of the created reader locator.
mt.create_proxy_attr(original_attr, output_node, line_on_top=False, line_name='', new_name=False, name='')tools.py:2204

Create a proxy attribute from a source node to a target node.

signature
mt.create_proxy_attr(original_attr, output_node, line_on_top=False, line_name='', new_name=False, name='')
This function copies an attribute from a source node to a target node and creates a proxy attribute that mirrors the source attribute's behavior.

Args:
        original_attr (str): Original attribute to copy.
        output_node (str): Node where the new attribute will be created.
        line_on_top (bool, optional): Add a line before the new attribute. Defaults to False.
        line_name (str, optional): Name of the line attribute. Defaults to ''.
        new_name (bool, optional): Rename the new attribute. Defaults to False.
        name (str, optional): Name for the new attribute. Defaults to ''.

Returns:
        str: Name of the new attribute.

Notes:
        - The function creates a proxy attribute by copying the attribute from the source node to the output node.
        - If line_on_top is set to True, a line attribute will be added before the new attribute.
        - If new_name is set to True, the new attribute will be renamed using the specified name. Otherwise, it will retain the original attribute name.
        - The attribute type, minimum and maximum values, and enumeration options (if applicable) will be preserved in the proxy attribute.

Examples:
        1. Copying an attribute without renaming:
                create_proxy_attr(original_attr='L_Shoulder_Jnt_Switch_Loc.FK_Arms', output_node='L_Shoulder_Fk_Ctrl')

        2. Copying an attribute and renaming:
                create_proxy_attr(original_attr='L_Shoulder_Jnt_Switch_Loc.FK_Arms', output_node='L_Shoulder_Fk_Ctrl', new_name=True, name='Follow')

        3. Copying an attribute with a line attribute on top:
                create_proxy_attr(original_attr='L_Shoulder_Jnt_Switch_Loc.FK_Arms', output_node='L_Shoulder_Fk_Ctrl', line_on_top=True, line_name='LineAttr')
mt.create_push_connections(driver_attr, driven, start_val, end_val, start_t=(0, 0, 0), end_t=(0, 0, 0), start_r=(0, 0, 0), end_r=(0, 0, 0), start_s=(1, 1, 1), end_s=(1, 1, 1), attrs_position=None)tools.py:2818

Creates a matrix-based blending system to drive translation, rotation, and scale

signature
mt.create_push_connections(driver_attr, driven, start_val, end_val, start_t=(0, 0, 0), end_t=(0, 0, 0), start_r=(0, 0, 0), end_r=(0, 0, 0), start_s=(1, 1, 1), end_s=(1, 1, 1), attrs_position=None)
of a target object based on an input driver attribute (e.g., rotation).

A remapValue normalizes the input driver range (start_val to end_val) to 0-1,
and uses that to blend between two sets of transform values using blendMatrix.

Args:
    driver_attr (str): Full attribute name (e.g., "Some_Ctrl.rotateZ") to drive the blend.
    driven (str): The object to apply the blended transform to.
    start_val (float): The driver value at which to apply the start transform.
    end_val (float): The driver value at which to apply the end transform.
    start_t (tuple): Translation at start_val as (x, y, z).
    end_t (tuple): Translation at end_val as (x, y, z).
    start_r (tuple): Rotation at start_val as (x, y, z).
    end_r (tuple): Rotation at end_val as (x, y, z).
    start_s (tuple): Scale at start_val as (x, y, z).
    end_s (tuple): Scale at end_val as (x, y, z).
    attrs_position (str, optional): Object (typically a locator) where control attributes
        for start/end transforms will be stored. If None, a new locator is created.

Returns:
    dict: A dictionary of created node names for reference.
mt.create_push_joint(joint_parent=None, reader=None, push_joint_name='Test', custom_position=None)tools.py:2754

Creates a push driver system consisting of:

signature
mt.create_push_joint(joint_parent=None, reader=None, push_joint_name='Test', custom_position=None)
- a control object,
  - a driver joint with root/auto hierarchy,
  - and a bind (skl) joint.

These are aligned to a reader locator and optionally positioned using a custom transform.

Args:
    joint_parent (str, optional): The parent joint for the bind joint. If None, it's parented to world.
    reader (str, optional): The name of the reader locator used for positioning. Required.
    push_joint_name (str, optional): Base name for naming the joints. Default is 'Test'.
    custom_position (str, optional): An object to use for custom positioning. Overrides the reader if provided.

Returns:
    tuple: A tuple containing the control name, driver joint name, and bind joint name.
mt.create_quad_locator(locator, push_joint_name, locator_size=0.5, color='green')tools.py:2680

Creates a secondary locator (quad) to receive clean rotation data using euler-quaternion conversion.

signature
mt.create_quad_locator(locator, push_joint_name, locator_size=0.5, color='green')
This process improves rotational interpolation by converting from euler to quaternion and back.

Args:
    locator (str): The name of the locator to base the quad on (usually the reader).
    push_joint_name (str): Base name used to name the utility nodes and quad locator.

Returns:
    str: The name of the created quad locator.
mt.create_softmod(vertex, name='soft_mod')tools.py:2288

Creates a softMod deformer and adds a custom control structure for controlling the strength, radius, and falloff directions.

signature
mt.create_softmod(vertex, name='soft_mod')
Args:
        vertex (str): Vertex that the softMod will be created on.
        name (str, optional): Name for the softMod. Defaults to 'soft_mod'.

Returns:
        list: SoftMod, SoftMod handle, control, pivot control offset.

Notes:
        - The softMod deformer is created on the specified vertex.
        - A custom control structure is added to control the softMod's attributes.
        - The control structure includes a main control, a pivot control, and a locator.
        - Additional attributes are added to the main control to control the strength, radius, and falloff directions.

Examples:
        1. Create a basic softMod:
                soft_mod, soft_mod_handle, ctrl, pivot_ctrl_offset = create_softmod("pSphere1.vtx[0]", name="sphere_softMod")

        2. Create a softMod with custom attributes:
                soft_mod, soft_mod_handle, ctrl, pivot_ctrl_offset = create_softmod("pSphere1.vtx[0]", name="sphere_softMod")
                # Add custom attributes
                self.new_attr(ctrl, 'customAttr1', 0, 1, 1)
                self.new_attr(ctrl, 'customAttr2', -10, 10, 0)
                self.new_boolean(ctrl, 'customAttr3', 'True')
mt.curve(input='', type='cube', rename=True, custom_name=False, name='', size=1, tag=True, playback=True)tools.py:498

For Controllers this is legacy, use mt.controller

signature
mt.curve(input='', type='cube', rename=True, custom_name=False, name='', size=1, tag=True, playback=True)
Will create a curve on the position of the selected input.
(see curves.json in config for more details of available shapes)

Args:
        input: if not specified, it will use the selection; otherwise, specify the string
        type: string name of the shape (default: 'cube')
        rename: bool to replace namespaces at the end (default: True)
        custom_name: True if you want to assign a new name, False if you want to use the same as the selection (default: False)
        name: string custom name (default: '')
        size: int size (default: 1)
        tag: bool to tag the curve as a controller (default: True)
        playback: bool to hide the curve during playback (default: True)

Returns:
        string ctrl

Examples:
        # Example 1: Create a curve using the default shape type ('cube') and rename it using the namespace of the selected input
        curve()

        # Example 2: Create a curve using the shape type 'circle' and assign a custom name
        curve(type='circle', custom_name=True, name='myCurve')

        # Example 3: Create a curve with a larger size (scale) of 2
        curve(size=2)

        # Example 4: Create a curve and tag it as a controller
        curve(tag=True)

        # Example 5: Create a curve and hide it during playback
        curve(playback=True)

Types:
mt.curve_between(start, end)tools.py:1592

Create a 1D curve between two transforms.

signature
mt.curve_between(start, end)
This function creates a linear curve between two transforms.

Args:
        start (str): Name of the first transform.
        end (str): Name of the second transform.

Returns:
        str: Name of the created curve.

Notes:
        - The created curve is a linear curve with two control points.
        - The curve is created in world space.

Examples:
        # Create a curve between two transforms.
        curve_between('joint1', 'joint2')
mt.duplicate_change_names(input='', hi=True, search='_Jnt', replace='_dup', remove_end_number=True)tools.py:1249

Duplicate the hierarchy with clean names, ensuring no duplicated names in the duplicated hierarchy.

signature
mt.duplicate_change_names(input='', hi=True, search='_Jnt', replace='_dup', remove_end_number=True)
Args:
        input (str or list): Name of the transform(s) to duplicate. If not specified, it will use the currently selected object(s).
        hi (bool): If True, duplicate the entire hierarchy. If False, duplicate only the selected object(s).
        search (str): String to search for in the names of the duplicated objects.
        replace (str): String to replace the search string with in the names of the duplicated objects.

Returns:
        str: Name of the duplicated[0] transform.

Notes:
        - This function duplicates the specified hierarchy or selected objects.
        - The duplicated objects have their names cleaned to ensure no duplicated names in the duplicated hierarchy.
        - The 'input' parameter specifies the name of the transform(s) to duplicate. If not specified, it will use the currently selected object(s).
        - The 'hi' parameter controls whether to duplicate the entire hierarchy (hi=True) or only the selected objects (hi=False).
        - The 'search' parameter is used to find the string to be replaced in the names of the duplicated objects.
        - The 'replace' parameter is the string that will replace the search string in the names of the duplicated objects.
        - The function returns the name of the duplicated[0] transform.

Examples:
        # Duplicate the hierarchy with clean names, replacing '_Jnt' with '_dup'.
        duplicate_change_names(input='rootJoint', hi=True, search='_Jnt', replace='_dup')

        # Duplicate the selected objects with clean names, replacing '_Ctrl' with '_Copy'.
        duplicate_change_names(input=['ctrl1', 'ctrl2', 'ctrl3'], hi=False, search='_Ctrl', replace='_Copy')
mt.find_closest_joint(joint, target_list)tools.py:2594

Find the closest joint in the target_list to the given joint.

signature
mt.find_closest_joint(joint, target_list)
Args:
        joint (str): The name of the joint to which distances are measured.
        target_list (list[str]): List of joint names to compare distances with.

Returns:
        str: The name of the closest joint from the target_list.

Notes:
        This function calculates the distance between the specified joint and a list of target joints.
        It returns the name of the joint in the target_list that is closest to the given joint.

Example:
        self.find_closest_joint('joint1', ['joint2', 'joint3', 'joint4'])
        'joint2'
mt.get_add_double_linear_attrs(node)tools.py:2000

Return input/output attr names for the add node type.

signature
mt.get_add_double_linear_attrs(node)
mt.get_closest_vertex(mesh_fn, point)tools.py:2389

Returns the closest vertex index on the given mesh to the specified point.

signature
mt.get_closest_vertex(mesh_fn, point)
Args:
        mesh_fn (om2.MFnMesh): Mesh function set.
        point (om2.MPoint): Point in world space.

Returns:
        int: Index of the closest vertex.

Example:
        # Get closest vertex on a mesh
        mesh_fn = om2.MFnMesh(get_dag_path('pSphere1'))
        point = om2.MPoint(1, 2, 3)
        closest_vertex = get_closest_vertex(mesh_fn, point)
mt.get_dag_path(obj)tools.py:2369

Returns the DAG path of the specified object.

signature
mt.get_dag_path(obj)
Args:
        obj (str): Name of the object.

Returns:
        om2.MDagPath or None: The DAG path of the object if it exists, None otherwise.

Example:
        dag_path = get_dag_path('pSphere1')
mt.get_orient(obj)tools.py:2426

Returns the world space orientation of the specified object.

signature
mt.get_orient(obj)
Args:
        obj (str): Name of the object.

Returns:
        list: List of three float values representing the x, y, and z rotation angles in degrees.

Example:
        orientation = get_orient('pSphere1')
mt.get_position(obj)tools.py:2412

Returns the world space position of the specified object.

signature
mt.get_position(obj)
Args:
        obj (str): Name of the object.

Returns:
        list: List of three float values representing the x, y, and z coordinates.

Example:
        position = get_position('pSphere1')
mt.get_scale(obj)tools.py:2440

Returns the world space scale of the specified object.

signature
mt.get_scale(obj)
Args:
        obj (str): Name of the object.

Returns:
        list: List of three float values representing the x, y, and z scale values.

Example:
        scale = get_scale('pSphere1')
mt.hide_attr(input='', t=False, r=False, s=False, v=False, rotate_order=False, show=False)tools.py:411

Hide selected attributes or display all attributes if show is True.

signature
mt.hide_attr(input='', t=False, r=False, s=False, v=False, rotate_order=False, show=False)
Args:
        input (str): Input string representing the selection. If not specified, the current selection will be used.
        t (bool): True to hide translate attributes.
        r (bool): True to hide rotate attributes.
        s (bool): True to hide scale attributes.
        v (bool): True to hide visibility attribute.
        rotate_order (bool): True to hide rotate order attribute.
        show (bool): True to show all attributes.

Returns:
        None

Notes:
        - This function hides or displays selected attributes for the specified transform(s).
        - If `input` != specified, it will use the current selection.
        - Set the corresponding flag to True for each attribute you want to hide.
        - If `show` is True, all attributes will be shown and unlocked.

Examples:
        # Example 1: Hide translate and scale attributes for the current selection
        hide_attr(t=True, s=True)

        # Example 2: Hide rotate order attribute for a specific transform
        hide_attr(input='transform1', rotate_order=True)

        # Example 3: Show all attributes for multiple transforms
        hide_attr(input=['transform1', 'transform2'], show=True)
mt.import_configs()tools.py:102

No docstring in the source.

signature
mt.import_configs()
mt.line_attr(input='', name='name', lines=10)tools.py:1123

Create a line attribute with a header. _____________ [Name]

signature
mt.line_attr(input='', name='name', lines=10)
Args:
        input (str): Name of the transform to add the attribute to. If not specified, it will use the currently selected object.
        name (str): Name of the attribute.
        lines (int): Number of lines to create in the attribute's header.

Returns:
        str: Name of the created attribute.

Notes:
        - This function creates a line attribute with a header that consists of a series of dashes followed by the attribute name in brackets.
        - If 'input' != specified, the function will use the currently selected object.
        - The 'name' parameter specifies the name of the attribute.
        - The 'lines' parameter determines the number of lines in the header. If the specified number of lines exceeds the maximum available space, the function will reduce it to fit.
        - The function returns the name of the created attribute.

Examples:
        # Create a line attribute named 'name' with a header of 10 lines.
        line_attr(input='myObject', name='name', lines=10)

        # Create a line attribute named 'description' with a header of 5 lines.
        line_attr(input='myObject', name='description', lines=5)
mt.lock_node(input='', unlock=False)tools.py:1944

Lock or unlock nodes.

signature
mt.lock_node(input='', unlock=False)
This function allows you to lock or unlock nodes. If no input is specified, it will use the currently selected nodes.

Args:
        input (str or List[str]): Node or list of nodes to lock or unlock (optional).
        unlock (bool): True to unlock nodes, False to lock nodes.

Returns:
        None

Notes:
        - If no input is specified, it will use the currently selected nodes.
        - When unlocking nodes, the `lockNode` command is called with `lock=False`.
        - When locking nodes, the `lockNode` command is called with `lock=True`.

Example:
        # Lock selected nodes
        lock_node()

        # Unlock specified nodes
        lock_node(['node1', 'node2'], unlock=True)
mt.match(this='', that='', t=True, r=True, s=True)tools.py:819

Match two transforms with desired transform, rotate, or scale.

signature
mt.match(this='', that='', t=True, r=True, s=True)
Args:
        this (str): Item to move.
        that (str): Item with desired position.
        t (bool): Match translate if True.
        r (bool): Match rotate if True.
        s (bool): Match scale if True.

Returns:
        None

Notes:
        - This function moves the 'this' transform to match the position, rotation, and scale of the 'that' transform.
        - The 't' parameter controls whether translation is matched.
        - The 'r' parameter controls whether rotation is matched.
        - The 's' parameter controls whether scale is matched.

Examples:
        # Match the position and rotation of transform 'obj2' to transform 'obj1'.
        match(this='obj1', that='obj2', t=True, r=True, s=False)

        # Match the scale of transform 'obj3' to transform 'obj4'.
        match(this='obj4', that='obj3', t=False, r=False, s=True)
mt.new_attr(input='', name='switch', min=0, max=1, default=0, keyable=True)tools.py:961

Create a new double attribute on a transform.

signature
mt.new_attr(input='', name='switch', min=0, max=1, default=0, keyable=True)
Args:
        input (str): Name of the transform to add the attribute to. If not specified, it will use the currently selected object.
        name (str): Name of the new attribute.
        min (int/False): Minimum value for the attribute (inclusive). Use False for no minimum.
        max (int/False): Maximum value for the attribute (inclusive). Use False for no maximum.
        default (int): Default value for the attribute.

Returns:
        str: Name of the created attribute.

Notes:
        - This function adds a new double attribute to the specified transform.
        - If 'input' != specified, the function will use the currently selected object.
        - The 'name' parameter specifies the name of the new attribute.
        - The 'min' and 'max' parameters define the range of values for the attribute.
        - The 'default' parameter sets the default value of the attribute.
        - The function sets the added attribute as keyable.
        - Pass min=False and/or max=False to create an unclamped attribute.

Examples:
        # Create a new double attribute named 'switch' with a range of 0 to 1 and a default value of 0.
        new_attr(input='myObject', name='switch', min=0, max=1, default=0)
mt.new_attr_interger(input='', name='switch', min=0, max=1, default=0)tools.py:1000

Create a new integer attribute on a transform.

signature
mt.new_attr_interger(input='', name='switch', min=0, max=1, default=0)
Args:
        input (str): Name of the transform to add the attribute to. If not specified, it will use the currently selected object.
        name (str): Name of the new attribute.
        min (int): Minimum value for the attribute (inclusive).
        max (int): Maximum value for the attribute (inclusive).
        default (int): Default value for the attribute.

Returns:
        str: Name of the created attribute.

Notes:
        - This function adds a new long (integer) attribute to the specified transform.
        - If 'input' != specified, the function will use the currently selected object.
        - The 'name' parameter specifies the name of the new attribute.
        - The 'min' and 'max' parameters define the range of values for the attribute.
        - The 'default' parameter sets the default value of the attribute.
        - The function sets the added attribute as keyable.

Examples:
        # Create a new integer attribute named 'switch' with a range of 0 to 1 and a default value of 0.
        new_attr_interger(input='myObject', name='switch', min=0, max=1, default=0)
mt.new_boolean(input='', name='bool', dv='True')tools.py:1086

Create a new boolean attribute on a transform.

signature
mt.new_boolean(input='', name='bool', dv='True')
Args:
        input (str): Name of the transform to add the attribute to. If not specified, it will use the currently selected object.
        name (str): Name of the new attribute.
        dv (bool): Default value for the attribute (True by default).

Returns:
        str: Name of the created attribute.

Notes:
        - This function adds a new boolean attribute to the specified transform.
        - If 'input' != specified, the function will use the currently selected object.
        - The 'name' parameter specifies the name of the new attribute.
        - The 'dv' parameter sets the default value of the attribute.
        - The function sets the added attribute as a channel box attribute.

Examples:
        # Create a new boolean attribute named 'bool' with a default value of True.
        new_boolean(input='myObject', name='bool', dv=True)

        # Create a new boolean attribute named 'visibility' with a default value of False.
        new_boolean(input='myObject', name='visibility', dv=False)
mt.new_enum(input='', name='switch', enums='Hide:Show', keyable=True, long_name=False, default=0)tools.py:1034

Create a new enum attribute on a transform.

signature
mt.new_enum(input='', name='switch', enums='Hide:Show', keyable=True, long_name=False, default=0)
Args:
        input (str): Name of the transform to add the attribute to. If not specified, it will use the currently selected object.
        name (str): Name of the new attribute.
        enums (str): Enumerated values separated by a colon (':').
        keyable (bool): Specifies if the attribute should be keyable (True by default).
        long_name (bool): Specifies if the attribute name should include the full path (False by default).
        default: Default value for the attribute.

Returns:
        str: Name of the created attribute.

Notes:
        - This function adds a new enum attribute to the specified transform.
        - If 'input' != specified, the function will use the currently selected object.
        - The 'name' parameter specifies the name of the new attribute.
        - The 'enums' parameter defines the enumerated values for the attribute, separated by a colon (':').
        - The 'keyable' parameter determines if the attribute is keyable or not.
        - The 'long_name' parameter specifies if the attribute name should include the full path or not.
        - The 'default' parameter sets the default value of the attribute.
        - The function sets the added attribute as a channel box attribute.
        - If 'keyable' is set to True, the attribute is also set as keyable.

Examples:
        # Create a new enum attribute named 'switch' with values 'Hide' and 'Show'.
        new_enum(input='myObject', name='switch', enums='Hide:Show')

        # Create a new enum attribute named 'status' with values 'Pending', 'Processing', and 'Completed',
        # and make it keyable and a long name attribute.
        new_enum(input='myObject', name='status', enums='Pending:Processing:Completed', keyable=True, long_name=True)
mt.nurbs_between(start, end)tools.py:1624

Create a NURBS plane between two transforms.

signature
mt.nurbs_between(start, end)
This function creates a NURBS plane between two transforms.

Args:
        start (str): Name of the start transform.
        end (str): Name of the end transform.

Returns:
        str: Name of the created NURBS plane.

Notes:
        - The created NURBS plane is a single-span surface.
        - The NURBS plane is created with a degree of 1 (linear).
        - The surface is created without construction history.
        - Two clusters are created to control the surface CVs and are positioned on the start and end transforms.

Examples:
        # Create a NURBS plane between two transforms.
        nurbs_between('joint1', 'joint2')
mt.nurbs_between_trio(start, mid, end)tools.py:1663

Create a NURBS plane between three transforms.

signature
mt.nurbs_between_trio(start, mid, end)
This function creates a NURBS plane between three transforms.

Args:
        start (str): Name of the start transform.
        mid (str): Name of the mid transform.
        end (str): Name of the end transform.

Returns:
        str: Name of the created NURBS plane.

Notes:
        - The created NURBS plane is a single-span surface.
        - The NURBS plane is created with a degree of 1 (linear).
        - The surface is created without construction history.
        - Three clusters are created to control the surface CVs, positioned on the start, mid, and end transforms.

Examples:
        # Create a NURBS plane between three transforms.
        nurbs_between_trio('joint1', 'joint2', 'joint3')
mt.put_inside_rig_container(inputs=[])tools.py:2142

Put nodes inside a rig container.

signature
mt.put_inside_rig_container(inputs=[])
This function adds the specified nodes to a rig container called "Mutant_Rig". If the container does not exist, it will be created.

Args:
        inputs (list): List of nodes to add to the rig container.

Returns:
        None

Notes:
        - The function checks if the "Mutant_Rig" container exists. If it doesn't, a new container is created using the `cmds.container()` command with the "dagContainer" type.
        - The `addNode` flag of the `cmds.container()` command is used to add the specified nodes to the container.
        - The `iconName` attribute of the container is set to a specific icon path.

Example:
        # Put nodes inside a rig container
        put_inside_rig_container(['node1', 'node2', 'node3'])
mt.read_json(path, json_file)tools.py:2087

Read data from a JSON file.

signature
mt.read_json(path, json_file)
This function reads the data from the specified JSON file and returns it as a dictionary.

Args:
        path (str): Path to the folder where the JSON file is located (use '\' to define folders).
        json_file (str): Name of the JSON file.

Returns:
        dict: Dictionary with the data from the JSON file.

Notes:
        - The function uses the `os.path.join()` function to construct the full path of the JSON file.
        - The data is read from the file using the `json.load()` function.
        - The dictionary with the data is returned.

Example:
        # Read data from a JSON file
        data = read_json("C:\data", "input.json")
mt.replace_connection_with_doublelinear(input='', attr='', name='DoubleLinear')tools.py:2012

Add a double linear node between two nodes.

signature
mt.replace_connection_with_doublelinear(input='', attr='', name='DoubleLinear')
This function adds a double linear node between two nodes to replace an existing connection.

Args:
        input (str): Node or attribute to replace the connection (optional).
        attr (str): Attribute to connect the double linear node (optional).
        name (str): Name of the double linear node (optional).

Returns:
        str: Name of the double linear node.

Notes:
        - If no input is specified, it will use the selection.
        - The function creates a double linear node using the 'addDoubleLinear' shading node.
        - It retrieves the connection to replace based on the input node and attribute.
        - The connection is established between the retrieved connection and the input of the double linear node.
        - The output of the double linear node is connected to the specified attribute of the input node.
        - The double linear node is added to the rig container.

Example:
        # Replace connection with a double linear node
        replace_connection_with_doublelinear()

        # Replace connection with a double linear node on a specific attribute
        replace_connection_with_doublelinear(input='node1', attr='translateX', name='DLNode')
mt.replace_name(input='', search='', replace='', hi=False)tools.py:225

Replace names in the selection. Works nicely to change names in hierarchies.

signature
mt.replace_name(input='', search='', replace='', hi=False)
Args:
        input (str): Input string representing the selection. If not specified, the current selection will be used.
        search (str): String to search for in the names.
        replace (str): String to replace the matched search string with.
        hi (bool): True if the change should be applied to the entire hierarchy.

Returns:
        list: List of new names.

Notes:
        - This function replaces occurrences of the `search` string with the `replace` string in the selection.
        - If `input` != specified, it will use the current selection.
        - If `hi` is True, the replacement will be applied to the entire hierarchy under each selected item.

Examples:
        # Replace 'old' with 'new' in the current selection
        replace_name(search='old', replace='new')

        # Replace 'old' with 'new' in a specific item
        replace_name(input='item1', search='old', replace='new')

        # Replace 'old' with 'new' in the entire hierarchy under each selected item
        replace_name(search='old', replace='new', hi=True)
mt.rivet_constraint(faces=None)tools.py:2564

Applies a rivet constraint to the specified faces.

signature
mt.rivet_constraint(faces=None)
Args:
        faces (list[str]): Optional. The faces to which the rivet constraint should be applied.
                If not specified, an error is raised.

Returns:
        list[str]: A list of the rivets objects after applying the rivet constraint.

Raises:
        RuntimeError: If no faces are provided.

Notes:
        This function applies a rivet constraint to the specified faces in Maya. It uses the
        Maya internal nodes and the uvpin.node_interface module to create the rivet.

Example:
        >>> rivet_constraint(['pCube1.f[0]', 'pCube1.f[1]'])
        ['pCube1.f[0]', 'pCube1.f[1]']
mt.root_grp(input='', custom=False, custom_name='customName', autoRoot=False, replace_nc=False)tools.py:132

Create groups.

signature
mt.root_grp(input='', custom=False, custom_name='customName', autoRoot=False, replace_nc=False)
Args:
        input (str): Input string representing the selection. If not specified, the current selection will be used.
        custom (bool): Specify if the new group should have a custom name.
        custom_name (str): Name of the custom group (requires `custom` to be True).
        autoRoot (bool): If True, create two groups instead of one: Root Grp and Auto Grp.
        replace_nc (bool): Try to replace the namespace to match the groups' namespace.

Returns:
        list: List of strings representing the new groups.

Notes:
        - This method creates groups based on the specified arguments.
        - It can create either one group or two groups (Root Grp and Auto Grp).
        - If `custom` is True, the group(s) will have a custom name specified by `custom_name`.
        - The method handles parenting and constraints to create the groups.
        - If `replace_nc` is True, it will attempt to replace the namespace with the groups' namespace.

Examples:
        # Create a single group using the current selection
        root_grp()

        # Create a single group with a custom name
        root_grp(custom=True, custom_name='MyGroup')

        # Create two groups (Root Grp and Auto Grp) using the current selection
        root_grp(autoRoot=True)

        # Create two groups with a custom name
        root_grp(custom=True, custom_name='MyGroup', autoRoot=True)

        # Create groups and replace the namespace
        root_grp(replace_nc=True)
mt.rotate_shape(input=None, x=0, y=0, z=0)tools.py:2454

Rotates the control vertices of the shape nodes of the specified object.

signature
mt.rotate_shape(input=None, x=0, y=0, z=0)
Args:
        input (str): Name of the object.
        x (float): Rotation angle in degrees around the X-axis.
        y (float): Rotation angle in degrees around the Y-axis.
        z (float): Rotation angle in degrees around the Z-axis.

Returns:
        bool: True if successful, False otherwise.

Example:
        # Rotate the shape of a sphere
        rotate_shape('pSphere1', x=45, y=0, z=0)
mt.scale_shape(input=None, x=1, y=1, z=1)tools.py:2483

Scales the control vertices of the shape nodes of the specified object.

signature
mt.scale_shape(input=None, x=1, y=1, z=1)
Args:
        input (str): Name of the object.
        x (float): Scale factor along the X-axis.
        y (float): Scale factor along the Y-axis.
        z (float): Scale factor along the Z-axis.

Returns:
        bool: True if successful, False otherwise.

Example:
        # Scale the shape of a sphere
        scale_shape('pSphere1', x=2, y=1, z=1)
mt.shape_with_attr(input='', obj_name='Switch', attr_name='Switch')tools.py:1409

Create a shape with an attribute and place it inside all the input transforms.

signature
mt.shape_with_attr(input='', obj_name='Switch', attr_name='Switch')
This function is used to have an IK/FK switch on all the controls by adding a shape with the specified attribute.

Args:
        input (str or list): Name of the transform(s) to use as input. If not specified, it will use the currently selected object(s).
        obj_name (str): Name of the transform to put the shape in.
        attr_name (str): Name of the attribute.

Returns:
        str: Name of the created attribute.

Notes:
        - This function creates a shape with the specified attribute and places it inside all the input transforms.
        - The 'input' parameter specifies the name of the transform(s) to use as input. If not specified, it will use the currently selected object(s).
        - The 'obj_name' parameter determines the name of the transform to put the shape in.
        - The 'attr_name' parameter specifies the name of the attribute to create.
        - If the shape already has the attribute, it will not be created again.
        - The function returns the name of the created attribute.

Examples:
        # Create a shape with the 'Switch' attribute and place it inside the 'ctrl' transform.
        shape_with_attr(input='limb_1', obj_name='ctrl', attr_name='Switch')

        # Create a shape with the default attribute name and place it inside the selected transforms.
        shape_with_attr()
mt.smart_assign_color(input='')tools.py:371

Smartly assign predefined colors based on the input.

signature
mt.smart_assign_color(input='')
Args:
        input (str or list): Input string or list representing the selection. If not specified, the current selection
                                                 will be used.

Returns:
        None

Notes:
        - This function automatically assigns predefined colors based on the input string.
        - If `input` != specified, it will use the current selection.
        - The color assignment is determined based on the prefix of the input string.
        - If the input starts with the left prefix, it will assign the left color.
        - If the input starts with the right prefix, it will assign the right color.
        - Otherwise, it will assign the main color.

Examples:
        # Example 1: Smartly assign color to the current selection
        smart_assign_color()

        # Example 2: Smartly assign color to a specific transform
        smart_assign_color(input='transform1')
mt.string_attr(input='', name='name', string='string')tools.py:1160

Create a string attribute to store information.

signature
mt.string_attr(input='', name='name', string='string')
Args:
        input (str): Name of the transform to add the attribute to. If not specified, it will use the currently selected object.
        name (str): Name of the attribute.
        string (str): Initial string value for the attribute.

Returns:
        str: Name of the created attribute.

Notes:
        - This function creates a string attribute that can be used to store information.
        - If 'input' != specified, the function will use the currently selected object.
        - The 'name' parameter specifies the name of the attribute.
        - The 'string' parameter sets the initial string value for the attribute.
        - The function returns the name of the created attribute.

Examples:
        # Create a string attribute named 'name' with the initial value 'John'.
        string_attr(input='myObject', name='name', string='John')

        # Create a string attribute named 'description' with the initial value 'Object description'.
        string_attr(input='myObject', name='description', string='Object description')
mt.switch_blend_colors(this='', that='', main='', attr='')tools.py:909

Create a switch between 3 chains for IK/FK setups using color blending.

signature
mt.switch_blend_colors(this='', that='', main='', attr='')
Args:
        this (str): IK joint (can be any transform).
        that (str): FK joint (can be any transform).
        main (str): Main joint that switches between.
        attr (str): Attribute to use as a switch parent.

Returns:
        None

Notes:
        - This function creates a switch between IK and FK chains in an IK/FK setup using color blending.
        - The 'this' parameter represents the IK joint.
        - The 'that' parameter represents the FK joint.
        - The 'main' parameter represents the IK main joint that switches between IK and FK.
        - The 'attr' parameter specifies the attribute to use as a switch parent.
        - The function creates blendColors nodes to blend the transform attributes of 'this' and 'that' based on the switch attribute.
        - It connects the blended color outputs to the corresponding transform attributes of the 'main' joint.
        - The resulting setup allows switching between IK and FK by controlling the 'attr' attribute.

Examples:
        # Create a switch between IK and FK chains using 'switchAttr' as the switch parent attribute.
        switch_blend_colors(this='ikJoint', that='fkJoint', main='MainJoint', attr='switchAttr')
mt.switch_constraints(this='', that='', main='', attr='')tools.py:856

Create a switch between 3 chains for IK/FK setups.

signature
mt.switch_constraints(this='', that='', main='', attr='')
Args:
        this (str): IK joint (can be any transform).
        that (str): FK joint (can be any transform).
        main (str): Main joint that switches between.
        attr (str): Attribute to use as a switch parent.

Returns:
        None

Notes:
        - This function creates a switch between IK and FK chains in an IK/FK setup.
        - The 'this' parameter represents the IK joint.
        - The 'that' parameter represents the FK joint.
        - The 'main' parameter represents the IK main joint that switches between IK and FK.
        - The 'attr' parameter specifies the attribute to use as a switch parent.
        - The function creates a parent constraint and a scale constraint for the 'main' joint, and connects them to the switch attribute.
        - It also creates a reverse node to invert the switch attribute's value for the parent constraint.
        - The resulting setup allows switching between IK and FK by controlling the 'attr' attribute.

Examples:
        # Create a switch between IK and FK chains using 'switchAttr' as the switch parent attribute.
        switch_constraints(this='ikJoint', that='fkJoint', main='ikMainJoint', attr='switchAttr')
mt.text_curves(name_text='Name', font='Arial', color=setup['main_color'])tools.py:1492

Create text curves.

signature
mt.text_curves(name_text='Name', font='Arial', color=setup['main_color'])
This function creates text curves based on the specified parameters.

Args:
        name_text (str): Text to be curved.
        font (str): Desired font.
        color (str): Color of the curves.

Returns:
        str: Name of the created curve.

Notes:
        - The 'name_text' parameter specifies the text to be curved.
        - The 'font' parameter determines the desired font.
        - The 'color' parameter specifies the color of the curves.
        - The function returns the name of the created curve.

Examples:
        # Create text curves with the specified name, font, and color.
        text_curves(name_text='Hello', font='Arial', color='red')

        # Create text curves with default parameters.
        text_curves()
mt.transform_on_sel(transform='', name='Temp')tools.py:1852

Position a transform node based on the selection.

signature
mt.transform_on_sel(transform='', name='Temp')
This function positions a transform node based on the selected objects.
If no transform node is specified, it will create a joint.

Args:
        transform (str): Name of the transform node to position (optional).
        name (str): Name of the transform node or joint (default: 'Temp').

Returns:
        None

Notes:
        - If no transform node is specified, it will create a joint with the given name.
        - The transform node will be positioned based on the selected objects.
mt.translate_shape(input=None, x=0, y=0, z=0)tools.py:2512

Translates the control vertices of the shape nodes of the specified object.

signature
mt.translate_shape(input=None, x=0, y=0, z=0)
Args:
        input (str): Name of the object.
        x (float): Translation distance along the X-axis.
        y (float): Translation distance along the Y-axis.
        z (float): Translation distance along the Z-axis.

Returns:
        bool: True if successful, False otherwise.

Example:
        # Translate the shape of a sphere
        translate_shape('pSphere1', x=1, y=0, z=0)
mt.write_json(path, json_file, data)tools.py:2053

Write data to a JSON file.

signature
mt.write_json(path, json_file, data)
This function writes the specified data to a JSON file.

Args:
        path (str): Path to the folder where the JSON file will be located (use '\' to define folders).
        json_file (str): Name of the JSON file.
        data (dict): Data to be saved in the JSON file.

Returns:
        str: Full path of the JSON file.

Notes:
        - The function uses the `os.path.join()` function to construct the full path of the JSON file.
        - The data is written to the file using the `json.dump()` function.
        - The `ensure_ascii`, `indent`, and `sort_keys` parameters are set to `False`, `4`, and `False` respectively
          for better formatting and readability of the JSON file.
        - The full path of the JSON file is returned.

Example:
        # Write data to a JSON file
        write_json("C:\data", "output.json", {"name": "John", "age": 30})

Kinematics kinematics.py#

FK and IK systems, twist, ribbons, spines, deformers, LODs.

mt.advance_twist(start='', end='', axis=setup['twist_axis'], amount=4, mode='up', driver='', inverse=False)kinematics.py:1001

Create a twist system for the chain.

signature
mt.advance_twist(start='', end='', axis=setup['twist_axis'], amount=4, mode='up', driver='', inverse=False)
Args:
        start (str): Name of the first joint in the chain. If empty, the first selected joint will be used.
        end (str): Name of the last joint in the chain. If empty, the last selected joint will be used.
        axis (str): Twist axis.
        amount (int): Number of twist joints to create.
        mode (str): Twist mode. Options: 'up' (default), 'down'.
        driver (str): Name of the driver joint for twisting correctly. If empty, no driver will be used.
        inverse (bool): Flag indicating whether to invert the twist direction.

Returns:
        dict: A dictionary containing information about the created twist system:
                - 'twist_grp': Name of the twist group.
                - 'no_twist_grp': Name of the no_twist group.
                - 'joints': List of twist joints.
                - 'curve': Name of the created curve.

Notes:
        - This function creates a twist system for a joint chain.
        - The function assumes that the necessary arguments for the start and end joints, twist axis, and mode are provided.
        - If the 'start' and 'end' arguments are empty, the function will use the first and last selected joints, respectively.
        - The 'amount' argument determines the number of twist joints to create between the start and end joints.
        - The 'mode' argument determines the direction of the twist system. Options: 'up' (default), 'down'.
        - The 'driver' argument specifies the name of the driver joint for twisting correctly. If empty, no driver will be used.
        - The 'inverse' flag can be set to True to invert the twist direction.
        - The function creates twist joints in the middle of the chain using the 'joints_middle' method.
        - It connects the twist locator to the joints using the IK spline twist attribute.
        - A curve is created between the start and end joints using the 'curve_between' method.
        - An IK spline twist setup is created using the 'create_ik_spline_twist' method.
        - The twist rotation is controlled by a multiply-divide node connected to the twist locator's rotation attribute.
        - The twist group's visibility is set to 0.
        - The function returns a dictionary containing information about the created twist system.

Usage:
        # Example usage with default arguments
        twist_system = advance_twist()

        # Example usage with custom arguments
        twist_system = advance_twist(
                start='joint1',
                end='joint2',
                axis='x',
                amount=4,
                mode='up',
                driver='driver_joint',
                inverse=False
        )
mt.base_spline(start='', end='', size=1, name='Spine', twist_axis=setup['twist_axis'], amount=5)kinematics.py:1534

Select the start and end joints and create an IK/FK spline for a character's spine.

signature
mt.base_spline(start='', end='', size=1, name='Spine', twist_axis=setup['twist_axis'], amount=5)
Args:
        start (str): Name of the start joint. If not provided, the first selected joint will be used.
        end (str): Name of the end joint. If not provided, the last selected joint will be used.
        size (float): Size of the controls.
        name (str): Name prefix for the spline controls.
        twist_axis (str): Twist axis for the spline. Can be 'X', 'Y', or 'Z'.
        amount (int): Number of joints to create for the spline.

Returns:
        tuple: A tuple containing lists of FK and IK controllers created for the spline.

Notes:
        - If no start and end joint names are provided, the function assumes that the first and last selected joints are the start and end joints, respectively.
        - The main_joints list contains all the joints in the spline chain.
        - The spline_curve variable represents the spline curve created for the IK handle.
        - The effector_spline variable represents the IK spline effector.
        - The twist_ik_joints list contains the joints used for twisting the IK chain.
        - The ik_joints list contains the joints used for controlling the IK chain.
        - The ik_controllers list contains the IK controllers created.
        - The fk_controllers list contains the FK controllers created.
        - The skinCluster function is used to bind the IK joints to the spline curve.

Examples:
        # Example 1: Create a spine IK/FK spline with default settings
        fk_controllers, ik_controllers = base_spline()

        # Example 2: Create a spine IK/FK spline with custom joint names and size
        fk_controllers, ik_controllers = base_spline(start='spine1_joint', end='spine3_joint', size=0.5)

        # Example 3: Create a spine IK/FK spline with a custom name prefix and twist axis
        fk_controllers, ik_controllers = base_spline(name='Character_Spine', twist_axis='Y', amount=8)
mt.basic_ribbon(start='', end='', divisions=5, name='Ribbon', ctrl_type='circleY', size=1, world_orient=False, start_end_joints=False, orient_like=False)kinematics.py:1712

Create a basic ribbon rig between two objects using a plane and follicles.

signature
mt.basic_ribbon(start='', end='', divisions=5, name='Ribbon', ctrl_type='circleY', size=1, world_orient=False, start_end_joints=False, orient_like=False)
Args:
        start (str): Name of the start object. If not provided, the first selected object will be used.
        end (str): Name of the end object. If not provided, the second selected object will be used.
        divisions (int): Number of divisions or follicles along the ribbon.
        name (str): Name prefix for the ribbon elements.
        ctrl_type (str): Type of control shapes to create for the controllers.
        size (float): Size scale factor for the control shapes.
        world_orient (bool): Specifies whether to set the controllers' rotation to world orientation.

Returns:
        dict: A dictionary containing the created ribbon elements.

Notes:
        - If no start and end object names are provided, the function assumes that the first and second selected
          objects are the start and end objects, respectively.
        - The surface variable represents the created NURBS plane between the start and end objects.
        - The follicles variable contains a list of the created follicles along the ribbon.
        - The fol_joints variable contains a list of joints created for binding to the follicles.
        - The ctrl_joints variable contains a list of joints created as control joints.
        - The controllers variable contains a list of created control shapes.
        - The controllers_grp variable represents the group containing the control shapes.
        - The created ribbon rig includes skinning the surface to the control joints and positioning the controllers.
        - If world_orient is set to True, the controllers' rotation is set to world orientation.
        - The function returns a dictionary with the created ribbon elements.

Examples:
        # Example 1: Create a basic ribbon rig between the first and second selected objects using default settings
        ribbon_elements = basic_ribbon()

        # Example 2: Create a basic ribbon rig with custom settings
        ribbon_elements = basic_ribbon(start='object1', end='object2', divisions=7, name='MyRibbon',
                                                                   ctrl_type='cube', size=2.0, world_orient=True)
mt.bend_and_squash(name='SnS', geo=None, parent_grp=None, squash_enabled=True, bend_enabled=True, ctrl_guide=None, bend_guide=None, squash_guide=None)kinematics.py:2458

No docstring in the source.

signature
mt.bend_and_squash(name='SnS', geo=None, parent_grp=None, squash_enabled=True, bend_enabled=True, ctrl_guide=None, bend_guide=None, squash_guide=None)
mt.bend_and_squash_head(geo, parent_grp)kinematics.py:2382

Add squash and bend deformers to the specified geometry.

signature
mt.bend_and_squash_head(geo, parent_grp)
Args:
   geo (str): Name of the geometry to apply the deformers on.
   parent_grp (str): Name of the parent group for the deformers.

Returns:
   None

Notes:
   - This function adds squash and bend deformers to the specified geometry.
   - It creates control objects for controlling the deformers.
   - The deformers are applied to the geometry using non-linear deformers.
   - The control objects are parented to the specified parent group.
   - The deformers are connected to the control objects to control their attributes.

Examples:
   # Apply bend and squash deformers to the geometry with default settings
   bend_and_squash_head('head_geo', 'head_grp')

   # Apply bend and squash deformers to the geometry with custom settings
   bend_and_squash_head('head_geo', 'head_grp')
mt.blend_between(ctrl=None, blends='', attr_position='ctrl', attr_name='Blends')kinematics.py:1927

Create blend groups and locators for controlling blends.

signature
mt.blend_between(ctrl=None, blends='', attr_position='ctrl', attr_name='Blends')
Args:
        ctrl (str): Name of the main control.
        blends (str): Comma-separated string of blend names.
        attr_position (str): Position to create the blend attributes. Default is 'ctrl'.
        attr_name (str): Name of the blend attributes. Default is 'Blends'.

Returns:
        None

Notes:
        - The function creates a blend group and locators for each blend.
        - The blends are specified as a comma-separated string.
        - The blend group and locators are parented under a 'Blends' group in the 'misc' rig group.
        - If the blend group or 'Blends' group already exists, the function uses the existing groups.
        - The blend group is created as a child of the main control's blend group.
        - Locators are created for each blend and parent-constrained to the respective blend.
        - The blend attributes are created on the specified position (either the main control or a separate group).
        - The blend attributes are named based on the specified attribute name.
        - If no control or blends are provided, an error is raised.

Examples:
        # Example 1: Create blend groups and locators for blends on the main control
        blend_between(ctrl='MainCtrl', blends='Blend1,Blend2,Blend3')

        # Example 2: Create blend groups and locators for blends on a separate group
        blend_between(ctrl='MainCtrl', blends='Blend1,Blend2,Blend3', attr_position='BlendsGroup')

        # Example 3: Create blend groups and locators with custom attribute name
        blend_between(ctrl='MainCtrl', blends='Blend1,Blend2,Blend3', attr_name='MyBlends')
mt.copy_skin_values(vertex_selection)kinematics.py:3344

to be used with: self.create_rivet_skin_constraint

signature
mt.copy_skin_values(vertex_selection)
Copy skinning values from a selected vertex.

Args:
        vertex_selection (list): A list containing the name of a single vertex to copy skinning from.

Returns:
        tuple: A tuple containing two lists - relevant_values and relevant_joints.

Notes:
- This function takes a list with a single vertex name as input.
- It retrieves the skinCluster associated with the vertex and collects skinning information.
- The skinning information is filtered to include only joints with significant influence (value > 0.01).

Usage:
relevant_values, relevant_joints = copy_skin_values(["pSphere1.vtx[10]"])
mt.create_add_compat(name)kinematics.py:2370

No docstring in the source.

signature
mt.create_add_compat(name)
mt.create_auto_rotate_fk(fk_root_ctrl=None, fk_root_ctrl_offset=None, size=1)kinematics.py:2986

Creates an auto-rotate FK setup for a chain of controls in Maya.

signature
mt.create_auto_rotate_fk(fk_root_ctrl=None, fk_root_ctrl_offset=None, size=1)
Parameters:
        fk_root_ctrl (str): The name of the root FK control.
        fk_root_ctrl_offset (str): The name of the offset group for the root FK control.

Returns:
        None

Notes:
        - This function assumes that the chain of controls is connected through parent relationships.
        - It creates a sphere curve as the rotator control.
        - It positions and orients the rotator control's offset group to match the last control in the chain.
        - It parents the rotator control's offset group under the root FK control's offset group.
        - It creates a group for each control in the chain and positions/orients it to match the control.
        - It parents each control under its corresponding group.
        - It connects the rotation attributes of the rotator control to the rotation attributes of each group in the chain.

Example:
        # Without attributes
        create_auto_rotate_fk("FK_Root_Ctrl", "FK_Root_Ctrl_Offset")

        # With attributes
        create_auto_rotate_fk("FK_Root_Ctrl", "FK_Root_Ctrl_Offset")
mt.create_dynamic_fk(joints=[])kinematics.py:3422

No docstring in the source.

signature
mt.create_dynamic_fk(joints=[])
mt.create_lods_containers(lods=['High'])kinematics.py:2641

Create LOD (Level of Detail) containers.

signature
mt.create_lods_containers(lods=['High'])
Args:
        lods (list): List of LOD names.

Returns:
        list: List of LOD nodes.

Notes:
        - This function creates LOD containers for the specified LODs.
        - Each container is named 'Mutant_{lod}'.
        - The function checks if the container already exists before creating it.
        - The function sets the 'iconName' attribute of each container to a specified icon path.
        - If a 'Miscellaneous_Grp' exists, the containers are parented under it.
        - The function returns a list of the created LOD nodes.

Example:
        # Create LOD containers for 'High' and 'Medium' LODs
        lods_created = create_lods_containers(['High', 'Medium'])
mt.create_mdl_compat(name)kinematics.py:2358

No docstring in the source.

signature
mt.create_mdl_compat(name)
mt.create_mid_ribbons(name, first_joint, last_joint, twist_joints, aim, twist_amount, ctrl_size, sec_color, switch_locator)kinematics.py:3027

Creates mid ribbons with bendy functionality.

signature
mt.create_mid_ribbons(name, first_joint, last_joint, twist_joints, aim, twist_amount, ctrl_size, sec_color, switch_locator)
Args:
        name (str): Name prefix for the ribbons and controls.
        first_joint (str): Name of the first joint in the chain.
        last_joint (str): Name of the last joint in the chain.
        twist_joints (list): List of joint names to be included in the twist deformation.
        aim (str): Aim direction for the ribbon controls ('X', 'Y', or 'Z').
        twist_amount (int): Number of subdivisions/twist joints on the ribbon.
        ctrl_size (float): Size of the control objects.
        sec_color (str): Secondary color for the control objects.
        switch_locator (str): Name of the switch locator object.

Notes:
        - This method creates mid ribbons with bendy functionality by creating NURBS planes and follicles.
        - The ribbons are controlled by twist joints and IK handles.
        - The method also creates control objects for tweaking the ribbons and handles for pinning the ribbons.

Examples:
        # Create mid ribbons with bendy functionality
        create_mid_ribbons('arm', 'shoulder', 'wrist', ['elbow1', 'elbow2', 'elbow3'], 'X', 5, 1.0, 'blue', 'switch_locator')
mt.create_rivet_skin_constraint()kinematics.py:3384

Create a parent constraint to skinning for selected elements.

signature
mt.create_rivet_skin_constraint()
Notes:
- This function is designed to be used in Autodesk Maya.
- It assumes you have selected mesh elements (vertices or other components).
- It creates joints at the selected elements' positions and applies a parent constraint with relevant skinning weights.

Usage:
- Select the mesh elements you want to create constraints for.
- Run create_rivet_skin_constraint().

Example:
create_rivet_skin_constraint()
mt.create_wire_system(geo, curve, name='Wire', dropoff=100, axis='Y', scale=1)kinematics.py:2729

Creates a wire system that can be used to control the shape of a mesh.

signature
mt.create_wire_system(geo, curve, name='Wire', dropoff=100, axis='Y', scale=1)
Args:
        geo (str): The name of the mesh that the wire system will be applied to.
        curve (str): The name of the curve that will be used to control the wire system.
        name (str): The prefix for the names of the created objects. Defaults to 'Wire'.
        dropoff (int): The distance from the curve that the wire system will affect the mesh. Defaults to 100.
        axis (str): The axis that the wire system will be aligned to. Defaults to 'Y'.
        scale (float): The scale of the created objects. Defaults to 1.

Returns:
        dict: A dictionary containing the created objects. The keys are:
                'main_ctrl': The main control object for the wire system.
                'ctrls': A list of control objects for the wire system.
                'ctrsl_grp': The group containing the control objects for the wire system.
                'joints': A list of joints that are used to control the wire system.
                'joints_grp': The group containing the joints for the wire system.
                'wireBase': The base object for the wire system.

Notes:
        - The function creates a wire deformer using the specified geometry and curve.
        - It sets the dropoff distance for the wire deformer.
        - It creates control objects for each CV (control vertex) of the curve and assigns them to joints.
        - The control objects are parented under a main control object that acts as the root of the wire system.
        - The function creates a skin cluster to bind the joints to the curve.
        - It returns a dictionary containing the created objects for further manipulation.

Example:
        # Create a wire system with a mesh and a curve
        wire_system = create_wire_system('mesh1', 'curve1')
mt.curve_to_ribbon(curve, amount=5, direction='V', size=1, color='lightBlue')kinematics.py:2225

Create a ribbon system along the given curve.

signature
mt.curve_to_ribbon(curve, amount=5, direction='V', size=1, color='lightBlue')
Args:
        curve (str): Name of the curve to create the ribbon on.
        amount (int): Number of follicles/hairs to generate along the curve.
        direction (str): Direction of the ribbon ('U' or 'V').
        size (float): Size of the main and tweak controls.
        color (str): Color of the controls.

Returns:
        None

Notes:
        - This function creates a ribbon system along the specified curve using follicles and joints.
        - The ribbon surface is created by converting the curve to a NURBS surface using the `bevel` command.
        - Follicles are then created on the ribbon surface, and joints and controls are attached to them.
        - The main controls are placed at the start, middle, and end of the ribbon.
        - The tweak controls are placed on each follicle.

Examples:
        # Create a ribbon system on the selected curve with default settings
        curve_to_ribbon('curve1')

        # Create a ribbon system on a specific curve with custom settings
        curve_to_ribbon('curve2', amount=8, direction='U', size=1.5, color='red')
mt.dinamic_pivot(input, size=1)kinematics.py:2949

Creates a dynamic pivot point for an object in Maya.

signature
mt.dinamic_pivot(input, size=1)
Parameters:
        input (str): The name of the object that the rotate pivot will be connected to.
        size (float): The size of the created cube curve. Defaults to 1.

Returns:
        str: The name of the created cube curve.

Notes:
        - This function creates a cube curve and renames it with a specific naming convention.
        - It creates a group object and moves/orientates the group object to match the position and orientation of the curve.
        - The curve is parented to the group object.
        - It connects the translate attribute of the curve to the rotate pivot of the input object.

Example:
        dinamic_pivot("pCube1")
mt.fk_chain(input='', size=1, color=setup['main_color'], curve_type=setup['fk_ctrl'], scale=True, twist_axis=setup['twist_axis'], world_orient=False, direct_connect=False, direct_scale=False)kinematics.py:93

Create a FK Chain with selected joints.

signature
mt.fk_chain(input='', size=1, color=setup['main_color'], curve_type=setup['fk_ctrl'], scale=True, twist_axis=setup['twist_axis'], world_orient=False, direct_connect=False, direct_scale=False)
Args:
        input (str): The input joint or a string representing the selection. If not specified, it will use the selected joints.
        size (int): The size of the FK controllers.
        color (str): The color of the controllers.
        curve_type (str): The type of curve used for the controllers.
        scale (bool): Whether to add a scale constraint to the controllers.
        twist_axis (str): The aim axis of the joints for creating bounding cubes.
        world_orient (bool): Whether to perform world orientation on the controllers.
        direct_connect (bool): Whether to directly connect the controllers to the joints.

Returns:
        list: A list of FK controllers.

Raises:
        None

This function creates a FK (Forward Kinematics) chain with the selected joints. The settings for the chain can be customized in the setup
JSON file.

The `input` parameter allows specifying the input joint or using the selected joints by leaving it empty. The `size` parameter determines
the size of the FK controllers. The `color` parameter sets the color of the controllers. The `curve_type` parameter determines the type of
curve used for the controllers, which can be customized in the setup JSON file.

The `scale` parameter controls whether a scale constraint is added to the controllers. The `twist_axis` parameter specifies the aim axis
of the joints when creating bounding cubes. The `world_orient` parameter determines whether to perform world orientation on the
controllers.

If `direct_connect` is set to `True`, the controllers will be directly connected to the joints. Otherwise, they will be parented using
constraints.

The function returns a list of FK controllers created.

Note:
        This function assumes the existence of other helper methods such as `check_input`, `bounding_cube`, `curve`, `root_grp`, `assign_color`,
        and `hide_attr`. Please ensure that these methods are implemented and correctly handle their respective functionalities.
mt.get_distance_between(start_node, end_node)kinematics.py:2833

Calculates the distance between two nodes in 3D space.

signature
mt.get_distance_between(start_node, end_node)
Args:
        start_node (str): The name of the starting node.
        end_node (str): The name of the ending node.

Returns:
        float: The distance between the two nodes.

Notes:
        - The function uses the xform command to get the world space translation values of the nodes.
        - It creates MVector objects from the translation values.
        - It subtracts the vectors to get the vector between the two nodes.
        - The length of the vector represents the distance between the nodes.
        - The function returns the distance as a float value.

Example:
        # Calculate the distance between two nodes
        distance = get_distance_between('node1', 'node2')
mt.joints_middle(start='', end='', axis=setup['twist_axis'], amount=4, name='Twist')kinematics.py:661

Create joints in between a joint chain.

signature
mt.joints_middle(start='', end='', axis=setup['twist_axis'], amount=4, name='Twist')
Args:
        start (str): Name of the first joint. If empty, the currently selected joint will be used.
        end (str): Name of the last joint. If empty, the last selected joint will be used.
        axis (str): Twist axis.
        amount (int): Number of joints to create in between.
        name (str): Name prefix for the created joints.

Returns:
        list: A list containing the names of the newly created joints.

Notes:
        - This function creates a series of joints in between a joint chain.
        - The function assumes that the necessary arguments for the start and end joints, twist axis, amount, and name are provided.
        - If the 'start' and 'end' arguments are empty, the function will use the currently selected joints.
        - The function duplicates the start joint and deletes its children to create the middle joints.
        - The names of the middle joints follow the pattern: "startName_nameIndex_joint".
        - The middle joints are parented to each other in order.
        - The function positions the middle joints in the correct spot along the twist axis.
        - The function returns a list of the names of the newly created middle joints.

Usage:
        # Example usage with default arguments
        middle_joints = joints_middle()

        # Example usage with custom arguments
        middle_joints = joints_middle(
                start='joint1',
                end='joint2',
                axis='x',
                amount=3,
                name='TwistChain'
        )
mt.joints_middle_no_chain(start='', end='', axis=setup['twist_axis'], amount=3, name='Mid')kinematics.py:734

Create joints in the middle of two selected objects but without a hierarchy.

signature
mt.joints_middle_no_chain(start='', end='', axis=setup['twist_axis'], amount=3, name='Mid')
Args:
        start (str): Name of the first object. If empty, the first selected object will be used.
        end (str): Name of the second object. If empty, the last selected object will be used.
        axis (str): Twist axis.
        amount (int): Number of joints to create in between.
        name (str): Name prefix for the created joints.

Returns:
        list: A list containing the names of the newly created joints.

Notes:
        - This function creates a series of joints in between two selected objects without creating a hierarchy.
        - The function assumes that the necessary arguments for the start and end objects, twist axis, amount, and name are provided.
        - If the 'start' and 'end' arguments are empty, the function will use the first and last selected objects, respectively.
        - The function temporarily parents the end object under the start object to create the middle joints.
        - The names of the middle joints follow the pattern: "startName_MidIndex_joint".
        - The middle joints are created using the 'joints_middle' function.
        - After creating the middle joints, the end object is restored to its original parent.
        - The function returns a list of the names of the newly created middle joints.

Usage:
        # Example usage with default arguments
        middle_joints = joints_middle_no_chain()

        # Example usage with custom arguments
        middle_joints = joints_middle_no_chain(
                start='object1',
                end='object2',
                axis='x',
                amount=3,
                name='MidJoints'
        )
mt.mirror_group(input='', world=True)kinematics.py:1660

Create a mirrored group for a specified object or the currently selected object.

signature
mt.mirror_group(input='', world=True)
Args:
        input (str): Name of the object to mirror. If not provided, the first selected object will be used.
        world (bool): Specifies whether to mirror the group in world space or maintain the original position.

Returns:
        str: Name of the mirrored group.

Notes:
        - If no input object name is provided, the function assumes that the first selected object is the input.
        - The mirror_grp variable represents the created mirrored group.
        - If world is set to False, the original position of the input object is maintained.
        - If world is set to True, the mirrored group is aligned to the world origin.
        - The scaleX, scaleY, and scaleZ attributes of the mirror_grp are set to -1 to mirror the object.
        - The rotateX attribute of the mirror_grp is set to 180 to rotate the mirrored object.

Examples:
        # Example 1: Create a mirrored group for the selected object using the default settings
        mirrored_group = mirror_group()

        # Example 2: Create a mirrored group for a specific object with world mirroring disabled
        mirrored_group = mirror_group(input='object1', world=False)

        # Example 3: Create a mirrored group for the selected object with world mirroring enabled
        mirrored_group = mirror_group(world=True)
mt.parent_matrix(this=None, that=None, translate=True, rotate=True, scale=True, offset=True)kinematics.py:2008

Parent matrix between two objects, allowing control over translation, rotation, and scale.

signature
mt.parent_matrix(this=None, that=None, translate=True, rotate=True, scale=True, offset=True)
Args:
        this (str): Name of the source object.
        that (str): Name of the target object.
        translate (bool): Whether to connect translation. Default is True.
        rotate (bool): Whether to connect rotation. Default is True.
        scale (bool): Whether to connect scale. Default is True.
        offset (bool): Whether to create an offset matrix for the connection. Default is True.

Returns:
        bool: True if successful.

Notes:
        - If the 'this' and 'that' arguments are not provided, the function will use the selected objects.
        - If 'offset' is True, an offset matrix is created to preserve the relative transform between the objects.
        - The offset matrix is calculated by multiplying the world matrices of 'this' and 'that'.
        - The resulting matrix is stored in a network node and connected to the 'matrixIn' attribute of the multMatrix node.
        - The multMatrix node combines the world matrix of 'this' with the inverse of the parent matrix of 'that',
          resulting in a new world matrix for 'that'.
        - The 'translate', 'rotate', and 'scale' arguments determine which attributes are connected.
        - The decomposeMatrix node extracts the translation, rotation, and scale values from the new world matrix.
        - If the 'offset' argument is True, the offset matrix is connected to the main multMatrix node.
        - The function also puts the created nodes inside the rig container.

Examples:
        # Example 1: Parent matrix with translation, rotation, and scale
        parent_matrix(this='Source', that='Target', translate=True, rotate=True, scale=True, offset=True)

        # Example 2: Parent matrix with translation only
        parent_matrix(this='Source', that='Target', translate=True, rotate=False, scale=False, offset=False)
mt.pole_vector_placement(bone_one='', bone_two='', bone_three='', back_distance=1)kinematics.py:207

Get the perfect Polevector position.

signature
mt.pole_vector_placement(bone_one='', bone_two='', bone_three='', back_distance=1)
Args:
        bone_one (str): The first joint in the chain.
        bone_two (str): The second joint in the chain.
        bone_three (str): The third joint in the chain.
        back_distance (float): The distance to move the pole vector position backward.

Returns:
        str: The name of the temporary locator.

Raises:
        None

The `back_distance` parameter allows adjusting the position backward, which can be useful for animators.

The function returns the name of the temporary locator created.

Note:
        This function relies on the OpenMaya module for vector calculations and transformations. Please ensure that the module is available and
        properly imported before using this function.
mt.proxy_this_attrs(attrs_from=None, attrs_to=None, attrs_to_proxy=[], line_at_end=True, line_at_start=True)kinematics.py:2864

Proxies attributes from one object to another.

signature
mt.proxy_this_attrs(attrs_from=None, attrs_to=None, attrs_to_proxy=[], line_at_end=True, line_at_start=True)
Args:
        attrs_from (str): The source object from which to copy attributes.
        attrs_to (str): The destination object to which the attributes will be copied.
        attrs_to_proxy (list): A list of attributes to proxy from the source object to the destination object.
        line_at_end (bool): Whether to add a separator line attribute at the end. Defaults to True.
        line_at_start (bool): Whether to add a separator line attribute at the start. Defaults to True.

Notes:
        - The function checks if the necessary arguments are provided.
        - It retrieves the user-defined attributes (UDAs) from the source object.
        - For each attribute, it checks if it is in the list of attributes to proxy.
        - If the attribute != in the list, it skips to the next attribute.
        - It gets the attribute type using `cmds.getAttr`.
        - If the attribute type is 'double', it adds a double attribute to the destination object and proxies the attribute value.
        - If the attribute type is 'enum', it adds an enum attribute to the destination object and proxies the attribute value.
        - The minimum and maximum values are also copied for double attributes.
        - If `line_at_end` is True, a separator line attribute is added at the end.

Example:
        # Proxy selected attributes from one object to another
        mt.proxy_this_attrs(attrs_from='|L_Hip_Jnt_Switch_Loc', attrs_to='L_Ankle_Ik_Ctrl', attrs_to_proxy=['HipBend', 'Switch_IK_FK'])
mt.put_inside_lod(nodes=[], lod='High')kinematics.py:2687

Put nodes inside an LOD (Level of Detail) container.

signature
mt.put_inside_lod(nodes=[], lod='High')
Args:
        nodes (list): List of nodes to put inside the container.
        lod (str): LOD name.

Returns:
        str: LOD container name.

Notes:
        - This function puts the specified nodes inside the LOD container.
        - If the LOD container doesn't exist, it creates it using the 'create_lods_containers' function.
        - The function expects a list of nodes to be provided.
        - If 'nodes' != a list, it converts it to a list.
        - The function adds each node to the LOD container using the 'container' command.
        - The function returns the name of the LOD container.

Example:
        # Put selected nodes inside the 'High' LOD container
        lod_container = put_inside_lod(cmds.ls(sl=True), 'High')
mt.remove_rivets_ctrls(selection_ctrls=None)kinematics.py:2182

Remove the rivet system from the specified controllers.

signature
mt.remove_rivets_ctrls(selection_ctrls=None)
Args:
        selection_ctrls (list): List of names of the controllers.

Returns:
        None

Notes:
        If no controllers are specified, the function searches for controllers
        with names ending in "Ctrl_Inverse_Grp" and removes the rivet system
        from them.

Examples:
        # Remove rivet system from selected controllers
        remove_rivets_ctrls()

        # Remove rivet system from specific controllers
        remove_rivets_ctrls(['Ctrl1', 'Ctrl2', 'Ctrl3'])
mt.ribbon_between(start='', end='', divisions=5, name='Ribbon', ctrl_type='circleY', size=1, world_orient=False, orient_like=False)kinematics.py:1839

Create a ribbon rig between two objects using a NURBS plane and follicles.

signature
mt.ribbon_between(start='', end='', divisions=5, name='Ribbon', ctrl_type='circleY', size=1, world_orient=False, orient_like=False)
Args:
        start (str): Name of the start object. If not provided, the first selected object will be used.
        end (str): Name of the end object. If not provided, the second selected object will be used.
        divisions (int): Number of divisions or follicles along the ribbon.
        name (str): Name prefix for the ribbon elements.
        ctrl_type (str): Type of control shapes to create for the controllers.
        size (float): Size scale factor for the control shapes.
        world_orient (bool): Specifies whether to set the controllers' rotation to world orientation.

Returns:
        dict: A dictionary containing the created ribbon elements.

Notes:
        - If no start and end object names are provided, the function assumes that the first and second selected
          objects are the start and end objects, respectively.
        - The basic_ribbon function is used to create the initial ribbon rig.
        - The ctrl_surface variable represents a duplicate of the original surface to drive the control joints.
        - The function creates follicles on the ctrl_surface and parents them to the control joints.
        - The ctrl_fol_grp variable represents the group containing the follicles and control joints.
        - The ribbon rig is bound to the ctrl_surface using skinning.
        - The function returns a dictionary with the created ribbon elements, including the surface, follicles,
          control joints, controllers, and their respective groups.

Examples:
        # Example 1: Create a ribbon rig between the first and second selected objects using default settings
        ribbon_elements = ribbon_between()

        # Example 2: Create a ribbon rig with custom settings
        ribbon_elements = ribbon_between(start='object1', end='object2', divisions=7, name='MyRibbon',
                                                                         ctrl_type='cube', size=2.0, world_orient=True)
mt.rivets_ctrls(geometry=None, selection_ctrls=None)kinematics.py:2088

Create a rivet system for the controllers to follow geometry on the rigs.

signature
mt.rivets_ctrls(geometry=None, selection_ctrls=None)
Args:
        geometry (str): Name of the geometry to attach the controllers to.
        selection_ctrls (list): List of names of the controllers.

Returns:
        None

Example:
        import Mutant_Tools
        from Mutant_Tools.Utils.Rigging import main_mutant
        import imp
        imp.reload(Mutant_Tools.Utils.Rigging.main_mutant)
        mt = main_mutant.Mutant()
        # Select the controllers, then the geometry
        mt.rivets_ctrls()
mt.simple_fk_ik(start='', mid='', end='', size=1, color=setup['main_color'], mode=setup['ik_fk_method'], twist_axis=setup['twist_axis'], use_shared_loc=True)kinematics.py:1285

Create an FK/IK chain with a switch for 3 joints.

signature
mt.simple_fk_ik(start='', mid='', end='', size=1, color=setup['main_color'], mode=setup['ik_fk_method'], twist_axis=setup['twist_axis'], use_shared_loc=True)
Args:
        start (str): Name of the start joint. If not provided, the first selected joint will be used.
        mid (str): Name of the middle joint. If not provided, the second selected joint will be used.
        end (str): Name of the end joint. If not provided, the third selected joint will be used.
        size (float): Size of the controls.
        color (tuple): Color of the controls in RGB format.
        mode (str): IK/FK blending mode. Can be 'blend' or 'constraints'.
        twist_axis (str): Twist axis for the IK chain. Can be 'X', 'Y', or 'Z'.

Returns:
        tuple: A tuple containing the main joints, IK joints, FK joints, FK system, IK system, and return groups.

Notes:
        - This function creates an FK/IK chain with controls and a switch to blend between the two.
        - The FK controls drive the joints directly, while the IK controls use an IK solver.
        - The switch attribute determines the influence of the IK and FK controls on the joints.
        - The visibility of the FK and IK controls is controlled by the switch attribute.

Examples:
        # Example 1: Create an FK/IK chain with default settings
        main_joints, ik_joints, fk_joints, fk_system, ik_system, return_groups = simple_fk_ik()

        # Example 2: Create an FK/IK chain with custom joint names and size
        main_joints, ik_joints, fk_joints, fk_system, ik_system, return_groups = simple_fk_ik(start='arm_01_joint', mid='arm_02_joint', end='arm_03_joint', size=0.5)

        # Example 3: Create an FK/IK chain with custom color and IK/FK blending mode
        main_joints, ik_joints, fk_joints, fk_system, ik_system, return_groups = simple_fk_ik(color=(1, 0.5, 0), mode='constraints')
mt.simple_ik_chain(start='', end='', size=1, color=setup['main_color'], ik_curve=setup['ik_ctrl'], pv_curve=setup['pv_ctrl'], pv=True, top_curve=setup['top_ik_ctrl'])kinematics.py:511

Create a simple IK chain between two joints with controllers.

signature
mt.simple_ik_chain(start='', end='', size=1, color=setup['main_color'], ik_curve=setup['ik_ctrl'], pv_curve=setup['pv_ctrl'], pv=True, top_curve=setup['top_ik_ctrl'])
Args:
        start (string): Name of the first joint. If empty, the currently selected joint will be used.
        end (string): Name of the last joint. If empty, the last selected joint will be used.
        size (string): Size of the controller.
        color (string): Name of the color for the controllers.
        ik_curve (string): Type of controller based on curves.json.
        pv_curve (string): Type of pole vector controller based on curves.json.
        pv (bool): True if pole vector controller should be created.
        top_curve (string): Type of top controller based on curves.json.

Returns:
        list: A list containing the following elements:
                - ik_ctrl: Name of the IK controller.
                - pv_ctrl: Name of the pole vector controller (if created).
                - top_ctrl: Name of the top controller.
                - ik_handle: Name of the IK handle.
                - line: Name of the line connecting the pole vector controller to the end joint.

Notes:
        - This function creates an IK chain between two joints and generates controllers for IK, pole vector, and top control.
        - The function assumes that the necessary arguments for joints, sizes, colors, and curve types are provided.
        - If the 'start' and 'end' arguments are empty, the function will use the currently selected joints.
        - The function creates an IK handle and renames it accordingly.
        - It creates an IK controller with an offset group and clean attributes.
        - The IK controller is aligned with the end joint and can be oriented based on the twist axis.
        - The function creates an IK group and orients the end joint to the IK controller.
        - The IK handle is parent-constrained to the IK controller.
        - If the 'pv' argument is True, a pole vector controller is created.
        - The pole vector controller is positioned correctly and connected to the IK handle.
        - The pole vector controller is cleaned up, and a line is created to connect it to the end joint.
        - A top controller is created and parent-constrained to the start joint.
        - The function organizes all the nodes and controllers under an IK group and assigns colors to the controllers.
        - The function returns a list of the IK system components.

Usage:
        # Example usage with default arguments
        ik_system = simple_ik_chain()

        # Example usage with custom arguments
        ik_system = simple_ik_chain(
                start='joint1',
                end='joint2',
                size='small',
                color='blue',
                ik_curve='curve_type1',
                pv_curve='curve_type2',
                pv=True,
                top_curve='curve_type3'
        )
mt.spline_twist(start='', end='', axis=setup['twist_axis'], amount=4, mode='up', right_side=False)kinematics.py:1104

Create a spline twist system for the chain.

signature
mt.spline_twist(start='', end='', axis=setup['twist_axis'], amount=4, mode='up', right_side=False)
Args:
        start (str): Name of the first joint in the chain. If empty, the first selected joint will be used.
        end (str): Name of the last joint in the chain. If empty, the last selected joint will be used.
        axis (str): Twist axis.
        amount (int): Number of twist joints to create.
        mode (str): Twist mode. Options: 'up' (default), 'down'.
        right_side (bool): Flag indicating whether to set Advance Attrs differently.

Returns:
        dict: A dictionary containing information about the created spline twist system:
                - 'twist_grp': Name of the twist group.
                - 'joints': List of twist joints.
                - 'curve': Name of the created spline curve.
                - 'ik_spline': Name of the IK spline handle.

Notes:
        - This function creates a spline twist system for a joint chain.
        - The function assumes that the necessary arguments for the start and end joints, twist axis, and mode are provided.
        - If the 'start' and 'end' arguments are empty, the function will use the first and last selected joints, respectively.
        - The 'amount' argument determines the number of twist joints to create between the start and end joints.
        - The 'mode' argument determines the direction of the twist system. Options: 'up' (default), 'down'.
        - The 'right_side' flag can be set to True to indicate a right-side setup with different attributes.
        - The function creates twist joints in the middle of the chain using the 'joints_middle' method.
        - It creates twist start and end joints for the twist setup.
        - The twist start joint is positioned at the start joint using a parent constraint.
        - The twist end joint is positioned at the end joint using a parent constraint.
        - A spline curve is created between the twist start and end joints using the 'ikHandle' command.
        - The spline curve is rebuilt using the 'rebuildCurve' command.
        - The twist setup is skinned to the spline curve using the 'skinCluster' command.
        - The twist rotation is controlled by enabling twist control and setting up the world up vectors.
        - The twist group is created and all relevant nodes are grouped under it.
        - The function returns a dictionary containing information about the created spline twist system.

Usage:
        # Example usage with default arguments
        twist_system = spline_twist()

        # Example usage with custom arguments
        twist_system = spline_twist(
                start='joint1',
                end='joint2',
                axis='x',
                amount=4,
                mode='up',
                right_side=False
        )
mt.streatchy_ik(ik='', ik_ctrl='', top_ctrl='', pv_ctrl='', attrs_location='', name='', axis='Y')kinematics.py:302

Generate all the nodes necessary to create an IK stretching system.

signature
mt.streatchy_ik(ik='', ik_ctrl='', top_ctrl='', pv_ctrl='', attrs_location='', name='', axis='Y')
Args:
        ik (string): Name of the IK on the limb.
        ik_ctrl (string): Name of the IK Ctrl.
        top_ctrl (string): Name of the Top IK Ctrl.
        pv_ctrl (string): Name of the PV Ctrl.
        attrs_location (string): Location where to put the attributes.
        name (string): Name of the system.
        axis (string): Name of the twist axis to obtain correct lengths.

Returns:
        tuple: A tuple containing the following nodes and locators:
                - ik_grp: The top-level group node that contains all the created nodes.
                - normalize_loc: The locator used for normalizing the stretch.
                - start_loc: Locator positioned at the base joint of the IK chain.
                - end_loc: Locator positioned at the end joint of the IK chain.
                - pv_loc: Locator positioned at the pole vector control.
                - distance: Distance dimension node representing the length of the IK chain.
                - top_distance: Distance dimension node representing the length between the base joint and the pole vector.
                - ik_distance: Distance dimension node representing the length between the end joint and the pole vector.

Notes:
        - This function generates nodes and connections for a stretchy IK system.
        - The function assumes that the IK chain is already set up and the necessary controls and joints are passed as arguments.
        - The function creates locators to represent the start, end, and pole vector positions of the IK chain.
        - It also creates distance dimension nodes to measure the lengths of different segments.
        - The stretchy math is calculated based on the distances and joint scales.
        - Additional attributes for controlling the system, such as stretchiness, pole vector lock, and volume preservation, are created.
        - The function organizes all the nodes under a top-level group node and returns the necessary nodes and locators.

Usage:
        # Example usage with default arguments
        ik_grp, normalize_loc, start_loc, end_loc, pv_loc, distance, top_distance, ik_distance = streatchy_ik()

        # Example usage with custom arguments
        ik_grp, normalize_loc, start_loc, end_loc, pv_loc, distance, top_distance, ik_distance = streatchy_ik(
                ik='left_arm_ik',
                ik_ctrl='left_arm_ik_ctrl',
                top_ctrl='left_arm_top_ctrl',
                pv_ctrl='left_arm_pv_ctrl',
                attrs_location='left_arm_attrs',
                name='left_arm_stretchy',
                axis='Y'
        )
mt.twist(start='', end='', axis=setup['twist_axis'], amount=4, mode='down')kinematics.py:796

Create a twist setup for limbs using an old method.

signature
mt.twist(start='', end='', axis=setup['twist_axis'], amount=4, mode='down')
Old way of creating twist for limbs, i use this one on RdM Tools v2, recommend to use the new advance one

Args:
        start (str): Name of the first joint in the limb. If empty, the first selected joint will be used.
        end (str): Name of the last joint in the limb. If empty, the last selected joint will be used.
        axis (str): Twist axis.
        amount (int): Number of twist joints to create in between the start and end joints.
        mode (str): Twist mode. Possible values: 'up' or 'down'.

Returns:
        list: A list containing the names of the twist joints.

Notes:
        - This function creates a twist setup for limbs using an old method.
        - The function assumes that the necessary arguments for the start and end joints, twist axis, amount, and mode are provided.
        - If the 'start' and 'end' arguments are empty, the function will use the first and last selected joints, respectively.
        - The twist joints are created using the 'joints_middle' function.
        - The function parents the twist joints to the upnode in the hierarchy if possible.
        - It sets up an IK handle and a pole vector constraint.
        - It creates a locator and positions it based on the specified mode ('up' or 'down').
        - The twist rotation is connected to the twist joints using a multiplyDivide node.
        - The function returns a list of the names of the twist joints.

Usage:
        # Example usage with default arguments
        twist_joints = twist()

        # Example usage with custom arguments
        twist_joints = twist(
                start='joint1',
                end='joint2',
                axis='x',
                amount=4,
                mode='up'
        )
mt.twist_fk_ik(start='', mid='', end='', size=1, color=setup['main_color'], mode=setup['ik_fk_method'], twist_axis=setup['twist_axis'], twist_amount=6, use_shared_loc=True)kinematics.py:1464

Create an FK/IK chain with a switch for 3 joints and add twist functionality for a full limb module.

signature
mt.twist_fk_ik(start='', mid='', end='', size=1, color=setup['main_color'], mode=setup['ik_fk_method'], twist_axis=setup['twist_axis'], twist_amount=6, use_shared_loc=True)
Args:
        start (str): Name of the start joint. If not provided, the first selected joint will be used.
        mid (str): Name of the middle joint. If not provided, the second selected joint will be used.
        end (str): Name of the end joint. If not provided, the third selected joint will be used.
        size (float): Size of the controls.
        color (tuple): Color of the controls in RGB format.
        mode (str): IK/FK blending mode. Can be 'blend' or 'constraints'.
        twist_axis (str): Twist axis for the IK chain. Can be 'X', 'Y', or 'Z'.
        twist_amount (int): Number of twist joints to create for each section of the limb.

Returns:
        dict: A dictionary containing the IK/FK system and the upper and lower twist information.

Notes:
        - This function extends the functionality of the simple_fk_ik function by adding twist joints to the limb.
        - The twist joints allow for smoother deformation during twisting motions.
        - The upper_twist and lower_twist dictionaries contain information about the twist joints created.
        - The scale of the twist joints is connected to the scale of the corresponding main joints.

Examples:
        # Example 1: Create a twist FK/IK chain with default settings
        result = twist_fk_ik()

        # Example 2: Create a twist FK/IK chain with custom joint names and size
        result = twist_fk_ik(start='arm_01_joint', mid='arm_02_joint', end='arm_03_joint', size=0.5)

        # Example 3: Create a twist FK/IK chain with custom color and twist axis
        result = twist_fk_ik(color=(1, 0.5, 0), twist_axis='Y', twist_amount=8)
mt.twist_rotate_info(start='', end='', axis=setup['twist_axis'], driver=False)kinematics.py:898

Create a system to correctly read the twist information for the desired joint.

signature
mt.twist_rotate_info(start='', end='', axis=setup['twist_axis'], driver=False)
Args:
        start (str): Name of the first joint in the chain. If empty, the first selected joint will be used.
        end (str): Name of the last joint in the chain. If empty, the last selected joint will be used.
        axis (str): Twist axis.
        driver (bool): Flag indicating whether to use a driver joint as the parent of the twist group.

Returns:
        dict: A dictionary containing information about the created twist setup:
                - 'ik': Name of the IK handle.
                - 'twist_grp': Name of the twist group.
                - 'locator': Name of the locator.
                - 'joint': Name of the twist root joint.
                - 'offset': Name of the offset group.

Notes:
        - This function creates a system to correctly read the twist information for the desired joint.
        - The function assumes that the necessary arguments for the start and end joints, twist axis, and driver are provided.
        - If the 'start' and 'end' arguments are empty, the function will use the first and last selected joints, respectively.
        - It creates a twist setup by adding a root joint, tip joint, twist group, and a locator.
        - The twist group and locator are positioned along the chain using parent constraints.
        - If the 'driver' flag is set to True, a parent constraint is applied between the driver joint and the twist group.
        - An IK handle is created to make the locator follow the orientation of the twist chain.
        - Offset groups are created using the 'root_grp' method.
        - The function returns a dictionary containing information about the created twist setup.

Usage:
        # Example usage with default arguments
        twist_info = twist_rotate_info()

        # Example usage with custom arguments
        twist_info = twist_rotate_info(
                start='joint1',
                end='joint2',
                axis='x',
                driver=True
        )

Modules modules.py#

Blocks, guides, joint orientation and the base rig hierarchy.

mt.Mutant_logger(mode='create')modules.py:752

Manages the Mutant logger for scriptEditor history.

signature
mt.Mutant_logger(mode='create')
Args:
        mode (str): The mode of operation for the logger. Default is 'create'.

Returns:
        str or None: The path to the Mutant log file if mode != 'create', otherwise None.

Raises:
        None

Note:
        This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.

Example:
        Mutant_logger(mode='create')
mt.ask_name(text='', ask_for='Name', check_split=False, popup=True, allow_name_exists=False)modules.py:445

Asks the user for a block name.

signature
mt.ask_name(text='', ask_for='Name', check_split=False, popup=True, allow_name_exists=False)
Args:
    text (str): The initial text displayed in the prompt dialog. Defaults to an empty string.
    ask_for (str): The message displayed in the prompt dialog, specifying what the name is asked for. Defaults to 'Name'.
    check_split (bool): Specifies whether to check for name existence after splitting the input at a comma. Defaults to False.
    popup (bool): Specifies whether to display a popup dialog for errors and warnings. Defaults to True.
        allow_name_exists (bool) : Allow names in case is used not for a block creation

Returns:
    str or None: The entered block name if the user clicked 'OK' and the name doesn't exist, or None if the user clicked 'Cancel'
                or didn't enter a name.

Raises:
    None

If the 'check_split' parameter is set to True, the function also checks for name existence after splitting the entered name
at a comma (','). If the split name already exists, an error message is printed and a confirmation dialog is displayed.

If the 'popup' parameter is set to True, warning messages are displayed using the 'cmds.warning' function. Otherwise, the
warning messages are printed to the console.

Note:
    This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.

Example:
    name = ask_name(text='Enter block name:', ask_for='Block Name', check_split=True, popup=True)
    if name != None:
        print(f"Entered block name: {name}")
mt.build_baseA(name='Asset_Name', size=1)modules.py:630

Creates the base structure for any kind of rig with the same base structure.

signature
mt.build_baseA(name='Asset_Name', size=1)
Args:
        name (str): The name of the asset. Default is 'Asset_Name'.
        size (float): The size of the base controllers. Default is 1.

Returns:
        tuple: A tuple containing the global controller, mover controller, and gimbal controller.

Raises:
        None

Note:
        This function relies on other methods such as 'curve', 'root_grp', 'new_enum', 'new_attr', 'hide_attr', and specific
        attributes and naming conventions defined in the 'setup' attribute.

Example:
        build_baseA(name='MyCharacter', size=1.5)
mt.check_dev_mode()modules.py:834

Checks if the Mutant Tools is in development mode.

signature
mt.check_dev_mode()
Args:
        None

Returns:
        bool: True if the Mutant Tools is in development mode, False otherwise.

Raises:
        None

If the 'dev_mode' key != set to 'On', the function attempts to import the 'Mutant_Tools' module and reloads the 'helpers'
module from the 'Mutant_Tools.Utils.Helpers' package. It then creates an instance of the 'Helpers' class and checks for the
'dev_mode' key in the 'MutantTools.settings' JSON file. If the 'dev_mode' key is present and set to True, the function returns
True indicating that the Mutant Tools is in development mode.

If any exceptions occur during the process, the function returns False indicating that the Mutant Tools != in development mode.

Note:
        This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software, as well as the 'json'
        module for JSON file handling.

Example:
        check_dev_mode()
mt.check_is_there_is_base(base='BaseA')modules.py:717

Checks if the base structure exists and creates it if not.

signature
mt.check_is_there_is_base(base='BaseA')
Args:
        base (str): The name of the base structure. Default is 'BaseA'.

Returns:
        None

Raises:
        None

Note:
        This function relies on the 'cmds' module from Autodesk Maya or a similar 3D software.

Example:
        check_is_there_is_base(base='BaseA')
mt.create_block(name='Mutant', icon='Limb', attrs={'attrs': 'something'}, build_command='print("Test")', import_command='print("Test2")')modules.py:92

Creates a block with specified attributes and commands.

signature
mt.create_block(name='Mutant', icon='Limb', attrs={'attrs': 'something'}, build_command='print("Test")', import_command='print("Test2")')
Args:
    name (str): The name of the block to create. Defaults to 'Mutant'.
    icon (str): The name of the icon to use for the block. Defaults to 'Limb'.
    attrs (dict): A dictionary containing the attributes to add to the block. Defaults to {'attrs': 'something'}.
    build_command (str): The build command associated with the block. Defaults to 'print("Test")'.
    import_command (str): The import command associated with the block. Defaults to 'print("Test2")'.

Returns:
    tuple: A tuple containing the block and the configuration network node.

Raises:
    None

The function starts by constructing the path to the icon file using the 'os.path.join' function and the provided 'icon' name.

The function calls 'hide_attr' to hide transformation attributes of the block.

If the 'Mutant_Build' group does not exist, the function creates it using the 'group' command.

A network node is created using the 'createNode' command, and the necessary connections between the network node and the container are
established using the 'connectAttr' command.

Next, the function creates various attributes based on the provided 'attrs' dictionary. String attributes are created using the 'string_attr'
function, enum attributes using the 'new_enum' function, float attributes using the 'new_attr_interger' function, and boolean attributes
using the 'new_boolean' function.

Finally, the function creates a 'precode' and 'postcode' attribute using the 'string_attr' function and returns the block and configuration
network node as a tuple.

Note:
    This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.
mt.create_joint_guide(name='Guide')modules.py:246

Creates a joint guide with the specified name.

signature
mt.create_joint_guide(name='Guide')
Args:
        name (str): The name of the joint guide. Defaults to 'Guide'.

Returns:
        str: The name of the created joint guide.

Raises:
        None

The function assigns colors to the components of the joint guide using the 'assign_color' function.

An enumeration attribute called 'Helper' is created on the joint, which can be used to turn on or off the visibility of the joint guide
components. The visibility of each component is connected to this enumeration attribute using the 'connectAttr' function.

The visibility of the joint guide components is controlled based on the value of the 'axis_helper' setup attribute. If 'axis_helper' is set
to 'True', the visibility of the joint guide components is turned on. Otherwise, it is turned off.

The joint guide components are parented under the joint using the 'parent' command.

The sphere, arrow, arrow axis, and arrow front components are deleted after parenting.

Finally, the created joint is selected, and its name is returned.

Note:
        This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.
mt.create_stellar_joint_guide(name=stellar_guide)modules.py:321

Creates a stellar joint guide with the specified name.

signature
mt.create_stellar_joint_guide(name=stellar_guide)
Args:
    name (str): The name of the stellar joint guide. Defaults to 'stellar_guide'.

Returns:
    str: The name of the created joint guide.

Raises:
    None

The function assigns colors to the components of the joint guide using the 'assign_color' function.

An enumeration attribute called 'Helper' is created on the joint, which can be used to turn on or off the visibility of the joint guide
components. The visibility of each component is connected to this enumeration attribute using the 'connectAttr' function.

The visibility of the joint guide components is controlled based on the value of the 'axis_helper' setup attribute. If 'axis_helper' is set
to 'True', the visibility of the joint guide components is turned on. Otherwise, it is turned off.

The joint guide components are parented under the joint using the 'parent' command.

The sphere, arrow, arrow axis, and arrow front components are deleted after parenting.

Finally, the created joint is selected, and its name is returned.

Note:
    This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.
mt.duplicate_and_remove_guides(input='')modules.py:523

Duplicates the top chain joint and changes '_Guide' to '_Jnt' in the name.

signature
mt.duplicate_and_remove_guides(input='')
Renames all children and parent to the world.

Args:
        input (str): The input joint(s) to duplicate. If empty, selects the first item from the current selection.

Returns:
        str: The name of the duplicated joint.

Raises:
        None

Note:
        This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.

Example:
        duplicate_and_remove_guides(input='joint_01_Guide')
mt.duplicate_and_remove_stellar_guides(input='')modules.py:572

Duplicates the top chain joint, changes '_Guide' to '_Jnt' in the name, and renames all children plus parent to the world.

signature
mt.duplicate_and_remove_stellar_guides(input='')
Args:
        input (str): The input joint(s) to duplicate. If empty, selects the first item from the current selection.

Returns:
        list: A list of duplicated joint objects.

Raises:
        None

Note:
        This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.

Example:
        duplicate_and_remove_stellar_guides(input='joint_01_Guide')
mt.move_outliner(input='', up=False, down=False)modules.py:178

Moves the specified object or objects in the outliner hierarchy.

signature
mt.move_outliner(input='', up=False, down=False)
Args:
    input (str or list): The name or list of names of the object(s) to move in the outliner hierarchy. Defaults to an empty string, which
                         selects the currently selected objects in the scene.
    up (bool): Specifies whether to move the object(s) up in the outliner hierarchy. Defaults to False.
    down (bool): Specifies whether to move the object(s) down in the outliner hierarchy. Defaults to False.

Returns:
    None

Raises:
    None

The function first checks if the 'input' argument is empty. If it is empty, it selects the currently selected objects in the scene.

If the 'up' argument is True, the function checks if the input object(s) is the first child in the 'brothers' list. If it is, it prints a
message indicating that the object(s) is already at the top. Otherwise, it uses the 'reorder' command to move the object(s) up by one
position in the outliner hierarchy.

If the 'down' argument is True, the function checks if the input object(s) is the last child in the 'brothers' list. If it is, it prints a
message indicating that the object(s) is already at the bottom. Otherwise, it uses the 'reorder' command to move the object(s) down by one
position in the outliner hierarchy.

If both 'up' and 'down' arguments are False, the function does nothing.

Note:
    This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.
mt.orient_joint(input='')modules.py:400

Orients a joint based on the specified input.

signature
mt.orient_joint(input='')
Args:
    input (str): The name of the joint to orient. If not provided, the currently selected joint is used. Defaults to an empty string.

Returns:
    None

Raises:
    None

If the 'input' parameter != provided, the function uses the currently selected joint as the input.

If an error occurs during the joint orientation process, an error message is printed.

Note:
    This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.

Example:
    orient_joint(input='joint1')
mt.toggle_dev_mode()modules.py:895

Toggles the Mutant Tools development mode.

signature
mt.toggle_dev_mode()
Args:
    None

Returns:
    None

Raises:
    None

If the 'dev_mode' key in the JSON file is currently set to True, the function updates the value to False and displays a
confirmation dialog indicating that the development mode is now turned off. If the 'dev_mode' key is currently set to
False, the function updates the value to True and displays a confirmation dialog indicating that the development mode is
now turned on.

Note:
    This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software, as well as the 'json'
    module for JSON file handling.

Example:
    toggle_dev_mode()
mt.update_icons()modules.py:791

Updates the icons of Mutant build blocks.

signature
mt.update_icons()
Args:
        None

Returns:
        None

Raises:
        None

Note:
        This function assumes the use of the 'cmds' module from Autodesk Maya or a similar 3D software.

Example:
        update_icons()

Mutant main_mutant.py#

Version checks and in-place updates from GitHub.

mt.check_for_updates(silent=True)main_mutant.py:264

Compares the local version against the latest GitHub release. If a newer release

signature
mt.check_for_updates(silent=True)
is available, asks the user if they want to download and install it automatically.

Args:
        silent (bool): If False, also informs the user when no update is needed or the
                check failed. If True (default, used on startup), stays quiet unless an
                update is found.
mt.compare_versions()main_mutant.py:188

Compares the local version with the online version and displays a warning if an update is available.

signature
mt.compare_versions()
Returns:
    None

Raises:
    None

If the tool != in development mode, the function retrieves the local version using the 'get_local_version' method and the online version
using the 'get_online_version' method. It then compares the two versions and displays a warning message if they are different.

Note:
    This function assumes that the 'get_online_version' and 'get_local_version' methods are implemented and correctly retrieve the online
    and local versions, respectively.
mt.get_github_latest_release()main_mutant.py:229

Retrieves the latest release info from the Mutant_Tools GitHub repo's public API.

signature
mt.get_github_latest_release()
Works without any authentication (public repo), so it works on machines that
are not logged into GitHub.

Returns:
        dict: The decoded JSON of the latest release (tag_name, zipball_url, html_url, etc.)
mt.get_local_version()main_mutant.py:164

Retrieves the local version of the tool.

signature
mt.get_local_version()
Returns:
    str or None: The local version of the tool if available, None otherwise.

Raises:
    None

Note:
    This function assumes that the 'read_json' method is implemented and correctly reads the version information from the JSON file.
mt.get_online_version()main_mutant.py:120

Retrieves the online version of a tool from a specified URL.

signature
mt.get_online_version()
Returns:
    str or None: The online version of the tool if available, None otherwise.

Raises:
    None

The extracted online version is then processed to remove any unwanted characters or formatting. If the online version is empty or cannot be
determined, the function returns None. Otherwise, it returns the online version.

Note:
    This function relies on the 'urllib.request' module, so make sure it is imported before using this function.
mt.install_github_release(release)main_mutant.py:306

Downloads a GitHub release's source zip and installs it over the current

signature
mt.install_github_release(release)
Mutant_Tools folder, mirroring the copy done by easy_install.py.

Args:
        release (dict): A release dict as returned by get_github_latest_release().