This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sel = cmds.ls(sl=True)[0] | |
currentJoint = 0 | |
joints = cmds.ls("L_chainTank_*_JNT") | |
currentV = 0 | |
allSections = [] | |
print("Script is running, please wait a minute") | |
for n in range(1, len(joints)+1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
for sel in cmds.ls(sl=True): | |
dup = cmds.duplicate(sel) | |
cmds.polySeparate(dup) | |
parts = cmds.ls(sl=True) | |
parentGrp = cmds.listRelatives(p = True) | |
for part in parts: | |
cmds.select(part) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for sel in cmds.ls(sl=True): | |
getMatrix=cmds.xform(sel, query=True, matrix=True, worldSpace=True) | |
cmds.xform(ro=(0,0,0), t=(0,0,0), s=(1,1,1)) | |
cmds.setAttr(sel + ".offsetParentMatrix", getMatrix, type="matrix") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
To use, paste this code into the script window in Maya. Make sure to paste it into a Python panel. | |
You can then mark the entire script with ctrl+a, and middle-mouse drag it onto a shelf to create a shortcut button. | |
Script works with multiple selections. Simply select all the objects that you want to transfer the objects transform to their | |
offset matrices on, and then run the script. | |
@author Frederik N. S. Larsen | |
""" | |
from maya.api.OpenMaya import MEulerRotation, MMatrix |