Created
December 16, 2021 18:10
-
-
Save hotcakesdeluxe/111c2a66edb62e8b098a0effaf417116 to your computer and use it in GitHub Desktop.
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
def shapeReplacer(obj, crv): | |
selection=[] | |
shape=[] | |
if(obj == ""): | |
selection = cmds.ls(sl=True) | |
else: | |
selection = obj | |
shape = cmds.listRelatives(selection, f=True,s=True) | |
#this split to make sure that we don't delete shapes we are using for common controls added from the 'shapeParent' function | |
#those shapes return as separate strings in the same list index for some maya reason | |
x = shape[0].split(",") | |
if(len(shape)>0): | |
cmds.delete(x) | |
replacementShape = cmds.listRelatives(crv, f=True,s=True) | |
cmds.parent(replacementShape, selection, shape = True, add = True) | |
cmds.delete(crv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment