Sym

class BlueprintMirrorOperation

Bases: MirrorOperation, ABC

A MirrorOperation that makes use of a Blueprint config

get_config()

Return the Blueprint’s config. Caches the config on the first request.

class MirrorActionUtil(config: dict)

Bases: object

A util class for mirroring BuildAction data.

mirror_action(src_action: BuildActionProxy, dst_action: BuildActionProxy)

Mirror a BuildActionProxy. Does not handle syncing other settings, so the actions are expected to be identical before being mirrored.

class MirrorColors

Bases: BlueprintMirrorOperation

Mirrors the override display color of nodes.

mirror_node(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform, is_new_node: bool)

Implement in subclasses to perform the mirroring operation.

class MirrorCurveShapes

Bases: MirrorOperation

Mirrors the NurbsCurve shapes of a node by simply flipping them, assuming MirrorTransformations would also be run on the mirrored nodes.

static flip_all_curve_shapes(node, axis=0, mirrorMode='simple')

Flip the position of all cvs in all curve shapes of a node in a manner that corresponds to the transformation mirror modes.

Parameters:
  • node (NurbsCurve) – The node to mirror

  • axis (int) – An axis to mirror across

  • mirrorMode – The MirrorMode type to use

static flip_curve_shape(curve_shape, axis=0, mirrorMode='simple')

Flip the position of all cvs in a curve shape in a manner that corresponds to the transformation mirror modes.

Parameters:
  • curve_shape (NurbsCurve) – The curve to mirror

  • axis (int) – An axis to mirror across

  • mirrorMode – The MirrorMode type to use

mirror_node(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform, is_new_node: bool)

Implement in subclasses to perform the mirroring operation.

replace_curve_shapes(source_node, dest_node)

Copy the curve shapes from one node to another, clearing out any curve shapes in the destination node first.

Parameters:
  • source_node (pm.PyNode) – The source node to copy shapes from

  • dest_node (pm.PyNode) – The destination node to copy shapes to

class MirrorData(source_node, dest_node, params: MirrorParams)

Bases: object

Data that represents mirrored matrices and attributes for a node.

class MirrorJointDisplay

Bases: MirrorOperation

Mirrors the display settings of joints

mirror_node(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform, is_new_node: bool)

Implement in subclasses to perform the mirroring operation.

Bases: BlueprintMirrorOperation

Mirrors Blueprint links. See links.py

mirror_node(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform, is_new_node: bool)

Implement in subclasses to perform the mirroring operation.

class MirrorMode

Bases: object

Contains constants representing the available types of mirroring

SIMPLE:

a ctl is mirrored across a single axis in the tranditional sense, this means the non-mirror axis basis vectors are flipped

ALIGNED:

a ctl is mirrored across a single axis in a visual sense, but the relationship between the matrices is more complicated. The result is an orientation that looks the same on both sides of an axis, as if they matched in world space in rest pose

class MirrorNames

Bases: BlueprintMirrorOperation

Mirrors the names of nodes.

mirror_node(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform, is_new_node: bool)

Implement in subclasses to perform the mirroring operation.

class MirrorOperation

Bases: object

An operation that can be performed when mirroring nodes. Receives a call to mirror a source node and target node.

mirror_node(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform, is_new_node: bool)

Implement in subclasses to perform the mirroring operation.

class MirrorParams

Bases: object

Parameters that define how mirroring should be performed.

class MirrorParenting

Bases: MirrorOperation

Mirrors the parenting structure of nodes.

mirror_node(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform, is_new_node: bool)

Change the parent of a dest node to match that of a source node, ensuring the use of paired nodes where possible to preserve a mirrored parenting structure.

Handles joint parenting specially by checking for centered parents along an axis, as well as connecting inverse scales so that segment scale compensate still works.

class MirrorTransforms

Bases: MirrorOperation

Mirrors the transform matrices of nodes. Also provides additional functionality for ‘flipping’ node matrices (simultaneous mirroring on both sides).

flip(source_node, dest_node)

Flip the transforms of two nodes such that each node moves to the mirrored transform of the other.

flip_center(nodes)

Move one or more non-mirrored nodes to the mirrored position of its current transform. The node list should be in order of dependency, where parents are first, followed by children in hierarchical order.

flip_multiple(node_pairs: List[Tuple[pymel.core.nt.Transform, pymel.core.nt.Transform]])

Perform flip on multiple nodes, by gathering first and then applying second, in order to avoid parenting and dependency issues.

Parameters:

node_pairs – A list of (source, dest) node pairs to flip.

mirror_node(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform, is_new_node: bool)

Move a node to the mirrored position of another node.

Parameters:
  • source_node – The node whose position will be used.

  • dest_node – The node to modify.

  • is_new_node – Is the destination node newly created?

class MirrorUtil

Bases: object

A util class for performing MirrorOperations. Provides functionality for duplicating nodes that aren’t paired, as well as performing the operations recursively on a node and all of its children.

configure_operation(operation: MirrorOperation)

Configure a MirrorOperation instance.

create_node_pairs(source_nodes)

Iterate over a list of source nodes and retrieve or create destination nodes using pairing.

gather_nodes(source_nodes)

Return a filtered and expanded list of source nodes to be mirrored, including children if is_recursive is True, and filtering nodes that should not be mirrored.

get_or_create_pair_node(source_node) pymel.core.nt.Transform

Return the pair node of a node, and if none exists, create a new pair node. Does not check is_creation_allowed.

run(source_nodes)

Run all mirror operations on the given source nodes.

should_mirror_node(source_node) bool

Return whether the node sould be mirrored, or skipped.

Accounts for special situations like centered joints, which may be included with recursive operations, but not wanted when mirroring.

apply_mirror_data(mirror_data: MirrorData)

Apply MirrorData matrices or attribute values to it’s destination node.

cleanup_all_mirror_nodes()

Remove mirroring metadata from any nodes in the scene that are no longer valid (missing their counterpart node).

counter_rotate_for_mirrored_joint(matrix)

Essentially rotates 180 on the given axis, this is used to create mirroring when ctls are set up to not be mirrored at rest pose.

counter_rotate_for_non_mirrored(matrix, axis=0)

Essentially rotates 180 on the given axis, this is used to create mirroring when ctls are set up to not be mirrored at rest pose.

duplicate_and_pair_node(source_node)

Duplicate a node, and pair it with the node that was duplicated.

Returns:

The newly created node.

get_all_mirror_nodes()

Return all nodes that have mirroring data

get_best_mirror_mode(node_a, node_b)

Given two nodes, return the mirror mode that matches their current transform relationship.

SIMPLE performs a loose check to see if the nodes are aligned, and if not, returns the SIMPLE mirroring mode.

get_centered_parent(node, axis=0)

Return the closest parent node that is centered. If no parent nodes are centered, return the highest parent.

Parameters:
  • node – A PyNode

  • axis – The axis on which the node is centered.

get_mirror_data(source_node: pymel.core.nt.Transform, dest_node: pymel.core.nt.Transform | None = None, params: MirrorParams | None = None) MirrorData | None

Return a MirrorData object that represents mirroring to apply from a source node to a target node.

Parameters:
  • source_node – The source node of the mirroring.

  • dest_node – The destination node that would be updated to match the source node.

  • params – The parameters controlling how to perform mirroring.

Returns:

A MirrorData object.

get_mirrored_joint_matrices(matrix, r, ra, jo, params: MirrorParams) list

Return the given joint matrices mirrored across the given axis. Returns the full transformation matrix, rotation, rotation axis, and joint orient matrices.

Parameters:

params – The parameters that define how to mirror the matrices.

get_mirrored_matrices(node, params: MirrorParams) dict

Return the mirrored matrix or matrices for the given node Automatically handles Transform vs. Joint differences

Parameters:
  • node – The node whose matrices should be mirrored.

  • params – The params defining how to mirror the node.

Returns:

A dict with a ‘type’ key (‘node’ or ‘joint’), and the corresponding mirrored matrices.

get_mirrored_name(name, config)

Given a string name, return the mirrored version considering all symmetry names defined in the Blueprint config.

get_mirrored_or_centered_parent(node, axis=0)

Return the closest parent node that is either centered, or already paired with another mirroring node.

get_mirrored_parent(node)

Return the closest parent node that has mirroring data.

Parameters:

node – A PyNode

get_mirrored_transform_matrix(matrix, params: MirrorParams)

Return the mirrored version of the given matrix.

Parameters:
  • matrix – The matrix to mirror.

  • params – The parameters that define how to mirror the matrix.

get_paired_node(node, validate=True)

For a node with mirroring data, return the other node.

Parameters:
  • node – A node with mirroring data that references another node

  • validate (bool) – When true, ensures that the pairing is reciprocated by the other node

invert_other_axes(matrix, axis=0)

Invert the other axes of the given rotation matrix based on rows of the matrix.

is_centered(node, axis=0)

Return True if the node is centered on a specific world axis.

is_mirror_node(node)

Return whether a node has mirroring data

Parameters:

node – A PyNode, MObject, or node name

pair_mirror_nodes(node_a, node_b)

Make both nodes associated as mirrors by adding mirroring data and a reference to each other.

Parameters:
  • node_a – A PyNode, MObject, or node name

  • node_b – A PyNode, MObject, or node name

remove_mirroring_data(node)

Remove mirroring data from a node. This does NOT remove mirroring data from the other node, if there is one. See unpair_mirror_node for removing mirroring data from two nodes at once.

Parameters:

node – A PyNode, MObject, or node name

set_mirrored_matrices(node, mirrored_matrices, translate=True, rotate=True, scale=True)

Set the world matrix for the given node using the given mirrored matrices Automatically interprets Transform vs. Joint matrix settings

set_mirroring_data(node, other_node)

Set the mirroring data for a node

Parameters:
  • node – A node on which to set the mirroring data

  • other_node – The counterpart node to be stored in the mirroring data

unpair_mirror_node(node)

Unpair the node from any associated mirror node. This removes mirroring data from both this node and its counterpart.

Parameters:

node – A PyNode, MObject, or node name

validate_mirror_node(node)

Ensure the node still has a valid mirroring counterpart. If it does not, remove the mirror data from the node.

Returns:

True if the node is a valid mirror node