MEL - Set the Driven Key
description
Transcript of MEL - Set the Driven Key
#Name = Mirro Or Copy Set Driven Key##Description:# The script can copy and mirro the setdriven key only by one one ###How to use:# import maya.cmds as cmdsimport maya.mel
###########################################################################Varibel Box ##########################################################################
#Write Yes if minimum = Min vale and No if it hast only defult and max values#Yes or NoNegative = "Yes"
#write the attiribute name Wring Cche spelling,maya always showing big capital in strat of the name in channelbox NameSlid = "tree"#write the vale for sliderMin = -10Default = 0 Max = 10
#Write Mirro or CopyAction = "Copy"
#=========================================================================#=========================================================================
#Selection first make a sets for be easy to selectSelections = cmds.ls(os=1)#to get the first selection HalfSL = len(Selections)/2
#Make ArrayNaObjectOne = []#Get the First half selectionfor N1 in range(1,HalfSL): #Get The name And append in the array NaObject1 = Selections[N1] NaObjectOne.append(NaObject1)
#Make ArrayNaObjectTo = []#Get the Last half selectionfor N2 in range(HalfSL + 1,len(Selections)): #Get The name And append in the array NaObject2= Selections[N2] NaObjectTo.append(NaObject2)
#Set the orginam control to the defult
#the controls namesControl1 = Selections[0]Control2 = Selections[HalfSL]
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#Set the controls values cmds.setAttr( Control1 + "." + NameSlid, Default )cmds.setAttr( Control2 + "." + NameSlid, Default )
for Nr in range (HalfSL-1): Org = NaObjectOne[Nr] New = NaObjectTo[Nr] #Get the translate.rota and scale of the objects #Traslate Get_Trans= cmds.xform(Org, q=1, ws=1, t=1) #Rotate Get_Rotat= cmds.xform(Org, q=1, ws=1, ro=1) #Scale Get_Scale= cmds.xform(Org, q=1, ws=1, s=1) if Action == "Mirro": #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#Set the controls values cmds.setAttr( Control1 + "." + NameSlid, Max )cmds.setAttr( Control2 + "." + NameSlid, Max )
for Nr in range (HalfSL-1): Org = NaObjectOne[Nr] New = NaObjectTo[Nr] #Get the translate.rota and scale of the objects #Traslate Get_Trans= cmds.xform(Org, q=1, ws=1, t=1) #Rotate Get_Rotat= cmds.xform(Org, q=1, ws=1, ro=1) #Scale Get_Scale= cmds.xform(Org, q=1, ws=1, s=1) if Action == "Mirro": #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #Set the controls values cmds.setAttr( Control1 + "." + NameSlid, Min ) cmds.setAttr( Control2 + "." + NameSlid, Min ) for Nr in range (HalfSL-1): Org = NaObjectOne[Nr] New = NaObjectTo[Nr] #Get the translate.rota and scale of the objects #Traslate Get_Trans= cmds.xform(Org, q=1, ws=1, t=1) #Rotate Get_Rotat= cmds.xform(Org, q=1, ws=1, ro=1) #Scale Get_Scale= cmds.xform(Org, q=1, ws=1, s=1) if Action == "Mirro": #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>