Skip to content

Instantly share code, notes, and snippets.

View Muream's full-sized avatar

Loïc Pinsard Muream

View GitHub Profile
@Muream
Muream / ensure_planar_orientation.py
Created May 3, 2022 13:43
Ensure Planar Orientation Maya
import maya.api.OpenMaya as om2
from maya import cmds
def ensure_planar_orientation(transform_a, transform_b, transform_c):
"""Orients the three given transform based on the plane they form.
X axis aims at the next transform.
Z axis is the normal axis to the plane.
Y axis is the tertiary axis, computed based on the 2 previous ones.
@Muream
Muream / bake_to_opm.py
Last active April 29, 2024 16:50
This script bakes the transformation of a node to its offset parent matrix which then acts as its rest matrix. Only works with maya 2020 and up.
import maya.api.OpenMaya as om
import maya.cmds as cmds
TRANSFORM_NODETYPES = ["transform", "joint"]
def has_non_default_locked_attributes(node):
locked_attributes = []
for attribute in ["translate", "rotate", "scale", "jointOrient"]:
default_value = 1 if attribute == "scale" else 0
for axis in "XYZ":
@Muream
Muream / maya_reorder_deformers.py
Last active May 6, 2019 07:30
Maya Re-order Deformers
import pymel.core as _pymel
expectedOrder = ['cube_dmh', 'cube_ffd', 'cube_skn', 'cube00_twk']
mesh = _pymel.PyNode('cube_geo')
currentIteration = 0
indexToMatch = 0
currentOrder = [x.name() for x in mesh.listHistory(type='geometryFilter')]
deformersInOrder = False