tpRigToolkit.libs.controlrig.dccs.maya.controllib module

Module that contains tpRigToolkit-libs-controllib function implementations for Maya

tpRigToolkit.libs.controlrig.dccs.maya.controllib.add_control_tracker_attributes(control_name, control_type='circle', translate=(0.0, 0.0, 0.0), rotate=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0), color=None)

Add control tracker attributes :param control_name: str, name of the control lwe want to track :param control_type: str, control type of the control :param translate: tuple(float, float, float), initial translation value :param rotate: tuple(float, float, float), initial rotation value :param scale: tuple(float, float, float), initial scale value :param color: list(float), initial color as linear color

tpRigToolkit.libs.controlrig.dccs.maya.controllib.create_buffer_groups(target=None, depth=1)

Creates buffer groups for the given target :param target: str :param depth: int :return: list(str)

tpRigToolkit.libs.controlrig.dccs.maya.controllib.create_control_curve(control_name='new_ctrl', control_type='circle', controls_path=None, control_size=1.0, translate_offset=(0.0, 0.0, 0.0), rotate_offset=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0), axis_order='XYZ', mirror=None, color=None, line_width=- 1, create_buffers=False, buffers_depth=0, match_translate=False, match_rotate=False, match_scale=False, parent=None, **kwargs)

Creates a new curve based control :param control_name: str, name of the new control to create :param control_type: str, curve types used by the new control :param controls_path: str or None, path were control curve types can be located :param control_size: float, global size of the control :param translate_offset: tuple(float, float, float), XYZ translation offset to apply to the control curves :param rotate_offset: tuple(float, float, float), XYZ rotation offset to apply to the control curves :param scale: tuple(float, float, float), scale of the control. :param axis_order: str, axis order of the control. Default is XYZ. :param mirror: str or None, axis mirror to apply to the control curves (None, ‘X’, ‘Y’ or ‘Z’) :param color: list(float, float, float), RGB or index color to apply to the control :param line_width: str, If given, the new shapes will be parented to given node :param create_buffers: bool, Whether or not control buffer groups should be created. :param buffers_depth: int, Number of buffers groups to create. :param parent: str, If given, the new shapes will be parented to given node :param match_translate: bool, Whether or not new control root node should match the translate with the

translation of the current DCC selected node

Parameters
  • match_translate – bool, Whether or not new control root node should match the rotate with the rotation of the current DCC selected node

  • match_scale – bool, Whether or not new control root node should match the scale with the scale of the current DCC selected node

Returns

tpRigToolkit.libs.controlrig.dccs.maya.controllib.duplicate_control(control_name, duplicate_name=None, use_selected_name=True, copy_tracker=True, delete_node_shapes=False)

Duplicates the given control transform node to a new transform parented to the world :param control_name: str, name of the control to duplicate :param duplicate_name: str, name of the duplicated control :param use_selected_name: bool, Whether or not :param copy_tracker: :param delete_node_shapes: :return:

tpRigToolkit.libs.controlrig.dccs.maya.controllib.get_control_color(control_name)

Returns the control of the control transform node :param control_name: str, control transform name :return: variant

tpRigToolkit.libs.controlrig.dccs.maya.controllib.get_control_size(control_name)

Returns the size of the given control by checking its bounding box size :param control_name: str, name of the control to get size of :return: float

tpRigToolkit.libs.controlrig.dccs.maya.controllib.get_control_transform_rgb_color(control_transform, linear=True)

Returns the RGB color of the given control, looking in the first shape node :param control_transform: str, name of the control transforms we want to retrieve color of :param linear: bool, Whether or not the RGB should be in linear space (matches viewport color) :return: tuple(float, float, float), new control color in float linear values (between 0.0 and 1.0)

tpRigToolkit.libs.controlrig.dccs.maya.controllib.get_controls(**kwargs)

Returns all controls in current scene Checks for the following info:

  • Check if the controls start with a control prefx or ends with a control suffix

  • Check if the controls have a specific control attribute

  • Check if a transform has an attribute called tag (with value) and the transform has a nurbsCurve at least

Parameters

namespace – str, only controls with the given namespace will be search.

Returns

list(str), list of control names

tpRigToolkit.libs.controlrig.dccs.maya.controllib.is_control(transform_node, only_tagged=False, **kwargs)

Returns whether or not given transform is a rig control :param transform_node: str :param only_tagged: bool :return: bool

tpRigToolkit.libs.controlrig.dccs.maya.controllib.mirror_control(source_control, target_control=None, mirror_axis='X', mirror_mode=0, mirror_color=None, mirror_replace=False, keep_color=True, from_name=None, to_name=None)
Find the right side control of a left side control and mirrors the control following next rules:
  • Mirror only will be applied if corresponding right side name exists

  • Replace left prefix and suffixes checking for validity

Parameters
  • mirror_axis – str

  • mirror_mode – int or None

  • mirror_color – int or list(float, float, float)

  • mirror_replace – bool

  • keep_color – bool

Returns

str, mirrored control

tpRigToolkit.libs.controlrig.dccs.maya.controllib.replace_control_curves(control_name, control_type='circle', controls_path=None, auto_scale=True, maintain_line_width=True, keep_color=True, **kwargs)

Replaces the given control with the given control type deleting the existing control curve shape nodes :param control_name: :param control_type: :param controls_path: :param auto_scale: bool :param maintain_line_width: bool :param keep_color: bool :return:

tpRigToolkit.libs.controlrig.dccs.maya.controllib.set_control_color(control_name, new_color, linear=True)

Sets the control of the given control transform node :param control_name: str, control transform name :param new_color: list(float, float, float) or int, new color to apply to the control :param linear, bool, Whether or not color is set in linear space :return: bool, True if the color is applied successfully; False otherwise

tpRigToolkit.libs.controlrig.dccs.maya.controllib.set_shape(crv, crv_shape_list, size=None, select_new_shape=False, keep_color=False)

Creates a new shape on the given curve :param crv: :param crv_shape_list: :param size: :param select_new_shape: bool :param keep_color: bool