Ejemplo n.º 1
0
 def loadDrivenCmd(self, *args):
     select_list = cmds.ls(sl = True)
     try:
         cmds.nodeOutliner( self.myoutliner2, e=True, a=select_list[-1] )
     except:
         cmds.confirmDialog( title='No target driver', message='Please select target driver controller in view port and click Load Target Driver button. ', button=['OK'], defaultButton='OK')
         print 'No target controller object Selected!!!'
Ejemplo n.º 2
0
def sceneAnalyzerCreate(*args):
    geoList = populateGeoList
    geoShapeList = populateGeoShapeList
    curveList = populateCurveList
    curveShapeList = populateCurveShapeList
    groupList = populateGroupList
    jointList = populateJointList
    constraintList = populateConstraintList
    lightList = populateLightList
    materialList = populateMaterialList

    if cmds.window('SceneOutliner', ex = True):
        cmds.deleteUI('SceneOutliner')

    SAWindow = cmds.window('SceneOutliner', title = 'Scene Analyzer', wh = (300, 450))
    SAForm = cmds.formLayout(numberOfDivisions=100)

    sceneAnalyzer = cmds.nodeOutliner(showInputs=True, addCommand='print("%node \\n")', ms = True, si = False)

    butGeo = cmds.button(l = 'Geometry', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butGeo, geoList))
    butGeoShape = cmds.button(l = 'Geo Shapes', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butGeoShape, geoShapeList))
    butCurve = cmds.button(l = 'Curves', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butCurve,curveList))
    butCurveShape = cmds.button(l = 'Curve Shapes', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butCurveShape, curveShapeList))
    butGroup = cmds.button(l = 'Groups', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butGroup, groupList))
    butJoint = cmds.button(l = 'Joints', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butJoint, jointList))
    butConstraint = cmds.button(l = 'Constraints', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butConstraint, constraintList))
    butLight = cmds.button(l = 'Lights', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butLight, lightList))
    butMaterial = cmds.button(l = 'Materials', bgc = (.4, .4, .4), c = lambda x: clickOne(sceneAnalyzer, butMaterial, materialList))

    butSave = cmds.button(l = 'Save', bgc = (.4, .4, .4), c = lambda x: SASave(sceneAnalyzer, butLoad))
    butLoad = cmds.button(l = 'Load', bgc = (.4, .4, .4), c = lambda x: SALoad(sceneAnalyzer), en = False)

    butAdd = cmds.button(l = 'Add', bgc = (.4, .4, .4), c = lambda x: SAAdd(sceneAnalyzer))
    butRemove = cmds.button(l = 'Remove', bgc = (.4, .4, .4), c = lambda x: SARemove(sceneAnalyzer))
    butClear = cmds.button(l = 'Clear', bgc = (.4, .4, .4), c = lambda x: SAClear(sceneAnalyzer))

    cmds.nodeOutliner(sceneAnalyzer, e = True, sc = 'selectionSynchronize("' + sceneAnalyzer + '")')
    sceneControl = cmds.nodeOutliner(showInputs=True, addCommand='print("%node \\n")', ms = True, si = False)
    cmds.formLayout(SAForm, e = True, attachForm = [(sceneAnalyzer, 'top', 5), (sceneAnalyzer, 'right', 5), (sceneAnalyzer, 'bottom', 5)], attachPosition = (sceneAnalyzer, 'left', 5, 40))
    cmds.formLayout(SAForm, e = True, attachForm = [(butGeo, 'left', 5),  (butGeo, 'top', 5)], attachPosition = (butGeo, 'right', 5, 40), attachControl = (butGeo, 'bottom', 5, butGeoShape))
    cmds.formLayout(SAForm, e = True, attachForm = (butGeoShape, 'left', 5), attachPosition = [(butGeoShape, 'right', 5, 40), (butGeoShape, 'top', 5, 9)], attachControl = (butGeoShape, 'bottom', 5, butCurve))
    cmds.formLayout(SAForm, e = True, attachForm = (butCurve, 'left', 5), attachPosition = [(butCurve, 'right', 5, 40), (butCurve, 'top', 5, 18)], attachControl = (butCurve, 'bottom', 5, butCurveShape))
    cmds.formLayout(SAForm, e = True, attachForm = (butCurveShape, 'left', 5), attachPosition = [(butCurveShape, 'right', 5, 40), (butCurveShape, 'top', 5, 27)], attachControl = (butCurveShape, 'bottom', 5, butGroup))
    cmds.formLayout(SAForm, e = True, attachForm = (butGroup, 'left', 5), attachPosition = [(butGroup, 'right', 5, 40), (butGroup, 'top', 5, 36)], attachControl = (butGroup, 'bottom', 5, butJoint))
    cmds.formLayout(SAForm, e = True, attachForm = (butJoint, 'left', 5), attachPosition = [(butJoint, 'right', 5, 40), (butJoint, 'top', 5, 45)], attachControl = (butJoint, 'bottom', 5, butConstraint))
    cmds.formLayout(SAForm, e = True, attachForm = (butConstraint, 'left', 5), attachPosition = [(butConstraint, 'right', 5, 40), (butConstraint, 'top', 5, 54)], attachControl = (butConstraint, 'bottom', 5, butLight))
    cmds.formLayout(SAForm, e = True, attachForm = (butLight, 'left', 5), attachPosition = [(butLight, 'right', 5, 40), (butLight, 'top', 5, 63)], attachControl = (butLight, 'bottom', 5, butMaterial))
    cmds.formLayout(SAForm, e = True, attachForm = (butMaterial, 'left', 5), attachPosition = [(butMaterial, 'right', 5, 40), (butMaterial, 'top', 5, 72), (butMaterial, 'bottom', 5, 81)])

    cmds.formLayout(SAForm, e = True, attachForm = (butSave, 'left', 5), attachPosition = (butSave, 'right', 5, 20), attachControl = (butSave, 'bottom', 5, butAdd))
    cmds.formLayout(SAForm, e = True, attachPosition = [(butLoad, 'left', 5, 20), (butLoad, 'right', 5, 40)], attachControl = (butLoad, 'bottom', 5, butRemove))

    cmds.formLayout(SAForm, e = True, attachForm = (butAdd, 'left', 5), attachPosition = (butAdd, 'right', 5, 20), attachControl = (butAdd, 'bottom', 5, butClear))
    cmds.formLayout(SAForm, e = True, attachPosition = [(butRemove, 'left', 5, 20), (butRemove, 'right', 5, 40)], attachControl = (butRemove, 'bottom', 5, butClear))
    cmds.formLayout(SAForm, e = True, attachForm = [(butClear, 'bottom', 5), (butClear, 'left', 5)], attachPosition = (butClear, 'right', 5, 40))

    cmds.showWindow(SAWindow)
Ejemplo n.º 3
0
 def applyBtnCmd(self,*args):
     #Making a progress bar
     self.progressWindow = cmds.window(title = 'Progress', widthHeight = (300, 50))#,tb = False
     cmds.columnLayout()
     self.progressControl = cmds.progressBar(maxValue = 10, width = 300)
     self.text = cmds.text(l = 'Start Progress...')
     cmds.progressBar(self.progressControl, edit=True, pr = 0)
     cmds.showWindow(self.progressWindow)
     
     self.selected = cmds.nodeOutliner(self.myoutliner, q = True, cs = True )
     self.selected2 = cmds.nodeOutliner(self.myoutliner2, q = True, cs = True )
     self.src_text = cmds.textField(self.src, q = True, text = True)
     self.des_text = cmds.textField(self.des, q = True, text = True )
     
     cmds.text(self.text, e = True, l = 'Processing your inputs...')
     cmds.progressBar(self.progressControl, edit=True, pr = 2)
     
     if self.selected == None or self.selected2 == None:
         cmds.deleteUI(self.progressWindow, window = True)
         cmds.confirmDialog( title='No attribute selected', message='Please select one attribute with driven keys in the left node outliner.', button=['OK'], defaultButton='OK')
         print 'Please select one attribute in the node outliner'
         return
     elif self.src_text == '' or self.des_text == '':
         cmds.deleteUI(self.progressWindow, window = True)
         cmds.confirmDialog( title='Missing replacement keywords', message='Please type in the replacements key words. ', button=['OK'], defaultButton='OK')
         print 'Please type in the replacements key words'
         return
     else:
         #Progress 30%
         cmds.text(self.text, e = True, l = 'Processing your inputs...')
         cmds.progressBar(self.progressControl, edit=True, pr = 3)
         flagM = cmds.radioButton(self.mirrorB, q = True, sl = True)
         #Progress 50%
         cmds.text(self.text, e = True, l = 'Finding Drivenkeys...')
         cmds.progressBar(self.progressControl, edit=True, pr = 5)
         resultList = findDrivenKey(self.selected[0], self.src_text, self.des_text) 
         if resultList == False:
             cmds.deleteUI(self.progressWindow, window = True)
             print 'Mirror failed.'   
             return
         # Progress 70%
         cmds.text(self.text, e = True, l = 'Processing valid attribute values, should take a while...')
         cmds.progressBar(self.progressControl, edit=True, pr = 7)
         result = copyDrivenKeyAttr(resultList[0], resultList[1], resultList[2], self.selected[0], self.selected2[0], flagM)
         cmds.text(self.text, e = True, l = 'Done.')
         cmds.progressBar(self.progressControl, edit=True, pr =10)
         cmds.deleteUI(self.progressWindow, window = True)
         if result == 'Success':
             cmds.confirmDialog( title='Mirror Result', message='=====================Mirror Has Done.=======================', button=['OK'], defaultButton='OK')
         elif result == 'Failed':
             cmds.confirmDialog( title='Mirror Result', message='=====================Mirror Failed.=======================', button=['OK'], defaultButton='OK')
         else:
             pass
Ejemplo n.º 4
0
def clickOne(outliner, button, nodeList, *args):
    retrievedList = nodeList()
    fixed = []
    for r in retrievedList:
        name = str(r).replace("[u'", "").replace("']", "")
        fixed.append(name)
    retrievedList = fixed
    cmds.nodeOutliner(outliner, e = True, rma = True)
    for r in retrievedList:
        cmds.nodeOutliner(outliner, e = True, a = r)
    cmds.button(button, e = True, bgc = (.8, .8, .8), c = lambda x: clickTwo(outliner, button, nodeList))
    cmds.select(cl = True)
Ejemplo n.º 5
0
 def editMenuResetCmd(self, *args):
     cmds.nodeOutliner(self.myoutliner, e = True, removeAll = True)
     cmds.nodeOutliner(self.myoutliner2, e = True, removeAll = True)
     cmds.textField(self.src, e = True, text = '')
     cmds.textField(self.des, e = True, text = '')
Ejemplo n.º 6
0
    def create(self):
        if (cmds.window(self.window, exists=True)):
            cmds.deleteUI(self.window, window=True)
        self.window = cmds.window(
            self.window,
            title = self.title,
            widthHeight = self.heightwidth,
            menuBar = True
        )
        self.commonMenuBar()
        
        self.mainForm = cmds.formLayout(nd=100)
        
        self.texthint = cmds.text('   Use buttons below to load mirror source and target controllers : ')
        
        self.buttonhint = cmds.button(
                          label = '?',
                          height = 15,
                          width = 15,
                          c = self.loadHint
        )
        
        cmds.formLayout(self.mainForm, e = True, attachControl = [self.buttonhint, 'left', 5, self.texthint])
        
        self.commonButtons()

        cmds.formLayout(self.mainForm, e = True, attachControl = [self.loadDriver, 'top', 5, self.texthint])
        cmds.formLayout(self.mainForm, e = True, attachControl = [self.loadDriven, 'top', 5, self.texthint])
        
        self.myoutliner = cmds.nodeOutliner(so = True, ms = False, addCommand='print("%node \\n")' )
        self.myoutliner2 = cmds.nodeOutliner(so = True, ms = False, addCommand='print("%node \\n")' )
        
        cmds.formLayout( self.mainForm, edit=True, 
            attachForm=((self.myoutliner, 'left', 5), 
                        (self.myoutliner2, 'right', 5),
                        (self.myoutliner, 'bottom', 150),
                        (self.myoutliner2, 'bottom', 150)),
            attachControl=((self.myoutliner, 'right', 5, self.myoutliner2),
                           (self.myoutliner, 'top', 10, self.loadDriver),
                           (self.myoutliner2, 'top', 10, self.loadDriven)),
            attachPosition=(self.myoutliner2,'left', 0, 50))
        
        self.boarderOptions = cmds.tabLayout(
            scrollable = True,
            height = 1,
            tabsVisible = False
        )
        cmds.formLayout(
            self.mainForm, e=True,
            attachForm = (
                [self.boarderOptions, 'left', 4],
                [self.boarderOptions, 'right', 4]
                
            ),
            attachControl = (
                [self.boarderOptions, 'top', 10, self.myoutliner],
                [self.boarderOptions, 'bottom', 4, self.applyBtn]
            )
        )
        self.optionsForm = cmds.formLayout(nd=100)
        
        self.displayOptions()
        
        cmds.showWindow()
Ejemplo n.º 7
0
def SAClear(outliner, *args):
    cmds.nodeOutliner(outliner, e = True, rma = True)   
Ejemplo n.º 8
0
def SARemove(outliner, *args):
    sel = cmds.ls(sl = True)
    for s in sel:
        cmds.nodeOutliner(outliner, e = True, rm = s)   
Ejemplo n.º 9
0
def SAAdd(outliner, *args):
    sel = cmds.ls(sl = True)
    for s in sel:
        cmds.nodeOutliner(outliner, e = True, a = s)   
Ejemplo n.º 10
0
def SALoad(outliner, *args):
    print SASave.saved
    cmds.nodeOutliner(outliner, e = True, rma = True)
    for s in SASave.saved:
        cmds.nodeOutliner(outliner, e = True, a = s)
Ejemplo n.º 11
0
def SASave(outliner, loadButton, *args):
    list = cmds.nodeOutliner(outliner, q = True, nd = True)
    print list
    cmds.button(loadButton, e = True, en = True)
    SASave.saved = list