Created
September 30, 2016 19:55
-
-
Save EricTRocks/294a76e2b3cc8e9630e55f54e3d11384 to your computer and use it in GitHub Desktop.
Duplicate, scale -1 in X, unparent, freeze again
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 | |
import pymel.core as pm | |
import pymel.core.datatypes as dt | |
sel = pm.ls(selection=True) | |
shapeNode = pm.listRelatives(sel[0])[0] | |
pm.constructionHistory(shapeNode) | |
pm.makeIdentity(sel[0], apply=True, t=True, r=True, s=True) | |
# Create new group | |
origGrp = pm.group(empty=True, n='original_Group') | |
# Set the new group to be the selected object's parent | |
sel[0].setParent(origGrp) | |
# Duplicate the group | |
dupGrp = pm.duplicate(origGrp)[0] # Get the first duplicated object (even if only 1 exists) | |
# Set Scale | |
dupGrp.setScale(dt.Vector(-1, 1, 1)) | |
# Get duplicated object | |
dupObj = dupGrp.listRelatives(children=True)[0] | |
dupObj.setParent(None) | |
pm.delete(dupGrp) | |
dupShapeNode = pm.listRelatives(dupObj)[0] | |
pm.constructionHistory(dupShapeNode) | |
pm.makeIdentity(dupObj, apply=True, t=True, r=True, s=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment