Editor Utils
A function library of miscellaneous utils usually involving editor selection or interactive work.
Many UI commands are located here, as they can be more specific than the core api but still not dependent on a UI.
- center_selected_joints()
Center the selected joint
- create_offset_for_selected()
Create an offset group for the selected nodes
- disable_segment_scale_compensate_for_selected()
Disable segment scale compensation on the selected joints
- freeze_joints_for_selected_hierarchies()
Freeze rotates and scales on the selected joint hierarchies.
- freeze_scales_for_selected_hierarchies(skip_joints=True)
Freeze scales on the selected transforms and all their descendants. See freeze_scales_for_hierarchy for more details.
- Parameters:
skip_joints (bool) – If true, don’t attempt to freeze joint hierarchies. Does not prevent freezing joints if they are a child of one of the selected transforms.
- get_color_name(color: LinearColor) str | None
Return the name of a color as defined in the config of the editor Blueprint.
- get_detailed_channel_box_attrs(node)
Return the list of attributes that are included when the ‘detailed channel box’ is enabled for a node.
- get_editor_blueprint()
Return the shared Blueprint instance from the default UI model
- get_named_color(name: str) LinearColor | None
Return a color by name from the config of the editor Blueprint
- get_selected_transforms(include_children=False)
Return the currently selected transforms (or joints).
- Parameters:
include_children (bool) – If true, also include all descendants of the selected nodes.
- insert_joint_for_selected(count=1)
Insert joints above the selected joint
- mark_end_joints_for_selected()
Find all end joints, and rename them to END_jnt, and set their override colors
- mirror_selected(recursive=True, create=True, curve_shapes=True, links=True, reparent=True, transform=True, appearance=True, axis=0)
Perform a mirroring operation on the selected nodes.
- Parameters:
recursive (bool) – Mirror the selected nodes and all children
create (bool) – Allow creation of new nodes if a pair is not found
curve_shapes (bool) – Mirror control shape curves
links (bool) – Mirror links. See links.py
reparent (bool) – Mirror the parenting structure of the nodes
transform (bool) – Mirror the transform matrices of the nodes
appearance (bool) – Mirror the name and color of the nodes
axis (int) – The axis to mirror on.
- open_blueprint_config_in_source_editor()
Open the current Blueprint’s config in a source editor.
- open_blueprint_scene()
Open the Maya scene associated with the currently open Blueprint.
- orient_to_world_for_selected(include_children=False, preserve_children=True, preserve_shapes=True, sync_joint_axes=True)
Orient the selected joints or transforms to match the world aligned axes.
- parent_selected()
Parent the selected nodes. Select a leader then followers.
[A, B, C] -> A|B, A|C
- parent_selected_in_order()
Parent the selected nodes to each other in order. Select from top of hierarchy downward, eg. [A, B, C] -> A|B|C
- rotate_orient_or_transform(node: pymel.core.nt.Transform, rotation: pymel.core.dt.Vector, preserve_children=True, preserve_shapes=True, sync_joint_axes=True)
Rotate a node in local space, or if it’s a joint, by modifying the joint orient. Additionally, can preserve child transform positions and/or shapes (such as control cvs).
- Parameters:
node – The node to rotate.
rotation – The delta rotation to apply.
preserve_children – If true, prevent children from moving.
preserve_shapes – If true, prevent child shapes from moving.
sync_joint_axes (bool) – If True, joints will also have their translate and scale axes updated to match the new orientation.
- rotate_selected_components_around_axis(axis, degrees=90)
Rotate the components of a shape by 90 degrees along one axis
- Parameters:
axis – A int representing which axis to rotate around X = 0, Y = 1, Z = 2
degrees – A float, how many degrees to rotate the components on that axis default is 90
- rotate_selected_orients_around_axis(axis, degrees=90, preserve_children=True, preserve_shapes=True, sync_joint_axes=True)
Rotate the selected nodes around the given axis If the node is a joint, its jointOrient will be rotated
- Parameters:
axis – The axis to rotate around.
degrees – The degrees of rotation to apply.
preserve_children – If true, prevent children from moving.
preserve_shapes – If true, prevent child shapes from moving.
sync_joint_axes (bool) – If True, joints will also have their translate and scale axes updated to match the new orientation.
- save_all_skin_weights(file_path=None)
Save skin weights for all skin clusters in the scene.
- Parameters:
file_path (str) – A full path to a .weights file to write. If None, will use the scene name.
- save_scene_if_dirty(prompt=True)
Prompt the user to save if the scene is modified, or has never been saved.
Returns True if the save was successful, or the scene has not been modified.
- Parameters:
prompt (bool) – If True, prompt the user, or attempt to automatically save where possible
- save_skin_weights_for_selected(file_path=None)
Save skin weights for the selected meshes to a file.
- Parameters:
file_path (str) – A full path to a .weights file to write. If None, will use the scene name.
- set_detailed_channel_box_enabled(node, enabled=True)
Set whether a node should display detailed channel box attributes related to transforms and joint orients.
- set_override_color_for_selected(color)
Set the display override color for the selected nodes
- toggle_detailed_channel_box_for_selected()
Toggle the display of detailed channel box attributes for all selected nodes.
- upgrade_all_links()
Update all links in the scene, fixing up old data as necessary.