Ejemplo n.º 1
0
def ckFidgetBump( fdgAttr, bumpDir):
    """
        ckFidgetBump( fdgAttr, bumpDir )

        description: evaluates fidget for given attribute, adds or subtracts
            by percent or increment

        inputs:
            fdgAttr: the object.attribute that we will be looking for data in

            bumpDir: determines if the operation is add or subtract

        outputs: None

    """
    print "bumping " + str(bumpDir)+ " " + str(fdgAttr)
    bumpBy = pm.getAttr("ckFidget_GRP.bumpBy")
    fdgVal = pm.getAttr( fdgAttr )
    bumpAmt = pm.melGlobals.get('gckFidgetBump')
    # bumping by percentage, figure out percentage and adjust fdgVal attribute
    if(bumpBy == True):
        print " by percent"
        bumpAmt = bumpAmt / 100
        bumpAmt = fdgVal * bumpAmt
    if bumpDir == "Up":
        fdgVal = fdgVal + bumpAmt
    else:
        fdgVal = fdgVal - bumpAmt
    # store adjustment
    pm.setAttr( fdgAttr, fdgVal)
Ejemplo n.º 2
0
    def getImageFiles(self):
        workspaceRoot = pm.workspace(q=True, rootDirectory=True)
        workspacePaths = pm.workspace(q=True, rt=True)
        imgPath = ''
        for i in range(0, len(workspacePaths)):
            if workspacePaths[i] == 'images':
                imgPath = workspacePaths[(i + 1)]
                break

        lastChar = workspaceRoot[-1]
        if lastChar != '/' and lastChar != '\\':
            workspaceRoot = workspaceRoot + '/'
        imagePath = workspaceRoot + imgPath + '/'
        imgExt = pm.getAttr('vraySettings.imageFormatStr')
        if imgExt == '' or imgExt is None:
            imgExt = 'png'
        imgExt = imgExt.split(' ')[0]
        prefix = pm.getAttr('vraySettings.fileNamePrefix')
        if prefix == '(not set; using filename)' or prefix == '' or prefix is None:
            prefix = pm.mel.eval('getSceneName')
        prefix = pm.mel.eval('vrayTransformFilename("' + prefix + '", "persp", "", 0);')
        separate = True
        if pm.getAttr('vraySettings.relements_separateFolders') == 0:
            separate = False
        finalImageName = [imagePath,
         prefix,
         imgExt,
         separate]
        framePadding = pm.getAttr('vraySettings.fileNamePadding')
        if pm.getAttr('defaultRenderGlobals.animation') == 1:
            finalImageName = [imagePath,
             prefix,
             '#' * framePadding + '.' + imgExt,
             separate]
        return finalImageName
 def replaceInstances(self, parentNode, instanceNodes):
     for instanceNode in instanceNodes:
         trans = pm.getAttr(str(instanceNode) + '.translate')
         rot = pm.getAttr(str(instanceNode) + '.rotate')
         scl = pm.getAttr(str(instanceNode) + '.scale')
         pm.delete(instanceNode)
         pm.duplicate(parentNode, name=str(instanceNode))
         pm.setAttr(str(instanceNode) + '.translate', trans)
         pm.setAttr(str(instanceNode) + '.rotate', rot)
         pm.setAttr(str(instanceNode) + '.scale', scl)
     return
Ejemplo n.º 4
0
def arsenal_proxyShaderAutoConnect(ignoreNamespace = False):
    if ignoreNamespace:
        print '[Arsenal ToolBox] Namespace ignored'
    else:
        print '[Arsenal ToolBox] Namespace not ignored'
    proxyMaterialNodes = pm.ls(type='VRayMeshMaterial')
    allMaterials = pm.ls(materials=True)
    materialClean = list(set(allMaterials) - set(proxyMaterialNodes))
    if len(proxyMaterialNodes) == 0:
        OpenMaya.MGlobal.displayWarning('No VRayMeshMaterial in the scene !')
    for proxyMaterialNode in proxyMaterialNodes:
        numberOfSlot = proxyMaterialNode.shaderNames.get(size=True)
        for i in range(numberOfSlot):
            nameSlot = pm.getAttr(proxyMaterialNode + '.shaderNames[' + str(i) + ']')
            if pm.connectionInfo(proxyMaterialNode + '.shaders[' + str(i) + ']', isDestination=True):
                connected = pm.connectionInfo(proxyMaterialNode + '.shaders[' + str(i) + ']', sourceFromDestination=True)
                pm.disconnectAttr(connected, proxyMaterialNode + '.shaders[' + str(i) + ']')
                print '[Arsenal ToolBox] Disconnect ' + proxyMaterialNode + '.shaders[' + str(i) + ']'
            for myMat in materialClean:
                okConnect = False
                if ignoreNamespace:
                    if myMat.split(':')[-1] == nameSlot.split(':')[-1]:
                        okConnect = True
                elif myMat == nameSlot:
                    okConnect = True
                if okConnect:
                    pm.connectAttr(myMat + '.outColor', proxyMaterialNode + '.shaders[' + str(i) + ']', f=True)
                    print '[Arsenal ToolBox] ' + proxyMaterialNode + '.shaders[' + str(i) + '] connected.'
Ejemplo n.º 5
0
 def initialize(self):
     if pm.objExists('vraySettings'):
         if pm.getAttr('defaultRenderGlobals.currentRenderer') == 'vray':
             self.arsenalQuality.initializeSet()
             if not self.initializePythonScript():
                 OpenMaya.MGlobal.displayError('[Arsenal] You must to upgrade your Vray')
                 return False
             self.loadArsenalPlugin()
             return True
         else:
             result = pm.confirmDialog(title='Set Vray', message='Vray is not your current render engine, set Vray to the current engine ?\n', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
             if result == 'OK':
                 self.loadVray()
                 self.arsenalQuality.initializeSet()
                 if not self.initializePythonScript():
                     OpenMaya.MGlobal.displayError('[Arsenal] You must to upgrade your Vray')
                     return False
                 self.loadArsenalPlugin()
                 return True
             OpenMaya.MGlobal.displayError('[Arsenal] Can not switch to Vray engine')
             return False
     elif pm.getAttr('defaultRenderGlobals.currentRenderer') == 'vray':
         result = pm.confirmDialog(title='Vray setting', message='Vray settings not found, reload Vray properly ?\n', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
         if result == 'OK':
             self.loadVray()
             self.arsenalQuality.initializeSet()
             if not self.initializePythonScript():
                 OpenMaya.MGlobal.displayError('[Arsenal] You must to upgrade your Vray')
                 return False
             self.loadArsenalPlugin()
             return True
         else:
             OpenMaya.MGlobal.displayError('[Arsenal] vraySetting not found')
             return False
     else:
         result = pm.confirmDialog(title='Load Vray', message='Vray is not your current render engine, load Vray ?\n(take some seconds)', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
         if result == 'OK':
             self.loadVray()
             self.arsenalQuality.initializeSet()
             if not self.initializePythonScript():
                 OpenMaya.MGlobal.displayError('[Arsenal] You must to upgrade your Vray')
                 return False
             self.loadArsenalPlugin()
             return True
         else:
             OpenMaya.MGlobal.displayError('[Arsenal] Vray not loaded')
             return False
Ejemplo n.º 6
0
    def backSetting(self, *args):
        if pm.attributeQuery('deeXVrayFastActualSettings', n='vraySettings', ex=True):
            if pm.objExists('deeXVrayFastExpression'):
                pm.delete('deeXVrayFastExpression')
                print '[Arsenal Quality] OdeeXVrayFastExpression deleted.'
            lines = pm.getAttr('vraySettings.deeXVrayFastActualSettings')
            dico = eval(lines)
            for myAttr in dico:
                value = dico[myAttr]
                if type(dico[myAttr]) == list:
                    value = dico[myAttr][0]
                if value:
                    try:
                        locked = 0
                        if pm.getAttr('vraySettings.' + myAttr, lock=True) == 1:
                            pm.setAttr('vraySettings.' + myAttr, lock=False)
                            locked = 1
                        pm.setAttr('vraySettings.' + myAttr, value)
                        if locked == 1:
                            pm.setAttr('vraySettings.' + myAttr, lock=True)
                    except:
                        print '[Arsenal Quality] ' + myAttr + ' value can not be setted.'

            locked = False
            if pm.lockNode('vraySettings', query=True, lock=True)[0]:
                locked = True
                pm.lockNode('vraySettings', lock=False)
            attToDelete = ['deeXVrayFastLastQuality',
             'deeXVrayFastOptimized',
             'deeXVrayFastActualSettings',
             'deeXVrayFastoptimizationChooserSettings',
             'deeXVrayFastLastTypePreset',
             'deeXVrayFastLastPresetPreComp']
            for myAttr in attToDelete:
                if pm.attributeQuery(myAttr, n='vraySettings', ex=True):
                    pm.deleteAttr('vraySettings.' + myAttr)

            if locked:
                pm.lockNode('vraySettings', lock=True)
            print '[Arsenal Quality] Original settings applied.'
        else:
            print '[Arsenal Quality] deeXVrayFastActualSettings attribute not found'
Ejemplo n.º 7
0
 def removeMultimatteMask(self, layer = None, number = None):
     if layer is None:
         OpenMaya.MGlobal.displayError('[Arsenal] You must to select a pass')
         return 
     actualList = pm.getAttr(layer + '_arsenalPass.multimatteMaskName')
     if actualList in ('default', '', ' '):
         actualList = '{}'
     actualList = eval(actualList)
     if number in actualList:
         actualList.pop(number)
     pm.setAttr(layer + '_arsenalPass.multimatteMaskName', str(actualList))
Ejemplo n.º 8
0
 def initAttributes(self, attribut = None, renderPass = None, connection = False, fromRenderGlobal = False):
     if attribut is None and renderPass is None:
         OpenMaya.MGlobal.displayError('[Arsenal] You must to select a pass')
         return 
     arsenalPass = pm.PyNode(renderPass + '_arsenalPass')
     if not connection:
         if fromRenderGlobal:
             value = pm.getAttr('vraySettings.' + attribut)
         else:
             value = pm.getAttr(arsenalPass.name() + '.' + attribut)
     elif fromRenderGlobal:
         value = pm.listConnections('vraySettings.' + attribut, destination=False, source=True)
     else:
         value = pm.listConnections(arsenalPass.name() + '.' + attribut, destination=False, source=True)
     if renderPass not in self.passName:
         self.passName[renderPass] = ArsenalPass()
         self.passName[renderPass].passName = renderPass
         self.multiMatteAttributes(myRenderLayer=renderPass)
     cmd = 'self.passName[renderPass].' + str(attribut) + ' = ' + str(value).replace('nt.', 'pm.nt.')
     exec cmd
Ejemplo n.º 9
0
def sd_list_attr():
    o_sel = pm.ls(sl=True)

    for obj in o_sel:
        attr_list = pm.listAttr()

        for attr in attr_list:

            try:
                val = pm.getAttr('{}.{}'.format(obj, attr))
                print attr, val
            except AttributeError:
                continue
Ejemplo n.º 10
0
def ckSavRst(fdgAttr, fdgOps ):
    """
        ckSavRst()

        description: saves or restores values from fidget data

        inputs:
            fdgAttr: the object.attribute pair we will be working with

            fdgOps: the operation to complete, save or restore

        outputs: None

    """
    print str(fdgOps) + "ing entry for, ", fdgAttr
    fdgGrp = fdgAttr.split(".")

    if fdgOps == "save":
        fdgSav = pm.getAttr(fdgAttr)
        pm.setAttr(str("ckFidget_GRP|"+fdgGrp[0]+"_"+fdgGrp[1]+"_SAV0.fdgSave"), str(fdgSav) )
    else:
        fdgSav = pm.getAttr(str("ckFidget_GRP|"+fdgGrp[0]+"_"+fdgGrp[1]+"_SAV0.fdgSave"))
        pm.setAttr(fdgAttr, float(fdgSav))
Ejemplo n.º 11
0
    def optimizeMat(self, layerMode = False, minSub = 8, maxSubd = 92):
        maxGlo = 1
        minGlo = 0
        allMaterials = pm.ls(type=['VRayCarPaintMtl', 'VRayFastSSS2', 'VRayMtl'])
        for myMat in allMaterials:
            reflectanceAttributes = {'["reflectionGlossiness"]': 'reflectionSubdivs',
             '["refractionGlossiness"]': 'refractionSubdivs',
             '["glossiness"]': 'reflectionSubdivs',
             '["coat_glossiness", "base_glossiness"]': 'subdivs'}
            for gloAttList in reflectanceAttributes:
                if pm.objExists(myMat + '.' + reflectanceAttributes[gloAttList]):
                    if not pm.getAttr(myMat + '.' + reflectanceAttributes[gloAttList], lock=True) and len(pm.listConnections(myMat + '.' + reflectanceAttributes[gloAttList], d=False, s=True)) == 0:
                        lastMoyeneValue = 1
                        first = True
                        go = False
                        for gloAtt in eval(gloAttList):
                            if pm.objExists(myMat + '.' + gloAtt) and len(pm.listConnections(myMat + '.' + gloAtt, d=False, s=True)) == 0:
                                gloValue = pm.getAttr(myMat + '.' + gloAtt)
                                if first:
                                    lastMoyeneValue = gloValue
                                    first = False
                                else:
                                    lastMoyeneValue = (lastMoyeneValue + gloValue) / 2
                                go = True

                        if go:
                            value = (lastMoyeneValue - maxGlo) * (maxSubd - minSub) / (minGlo - maxGlo) + minSub
                            if layerMode:
                                if pm.editRenderLayerGlobals(query=True, currentRenderLayer=True) == 'defaultRenderLayer':
                                    OpenMaya.MGlobal.displayError('[Arsenal Quality] You can not use layerMode if you are on masterLayer')
                                    return 
                                pm.editRenderLayerAdjustment(myMat + '.' + reflectanceAttributes[str(gloAttList)])
                            pm.setAttr(myMat.name() + '.' + reflectanceAttributes[str(gloAttList)], value)
                            print '[Arsenal Quality] ' + str(value) + ' setted on attribute ' + reflectanceAttributes[str(gloAttList)] + ' for material ' + myMat.name()


        print '[Arsenal Quality] All materials optimized.'
Ejemplo n.º 12
0
    def at_selection(self, **kwargs):
        # get inputs
        setup_name = kwargs.get("name", None)
        path_name = kwargs.get("path", None)
        sample_obj = kwargs.get("sample", None)
        obj_lst = kwargs.get("selection_list", None)
        full_length = pm.arclen(path_name)
        paramVal = []
        uVal = []
        for obj in obj_lst:
            pos = pm.xform(obj, query=True, translation=True, worldSpace=True)
            param = self.getuParamVal(pnt=pos, crv=path_name)
            paramVal.append(param)
        crv_shp = pm.listRelatives(path_name, shapes=True)[0]
        arcLen = pm.arcLengthDimension(crv_shp + ".u[0]")
        for val in paramVal:
            pm.setAttr(str(arcLen) + ".uParamValue", val)
            len_at_pos = pm.getAttr(str(arcLen) + ".arcLength")
            uVal.append(len_at_pos / full_length)
        pm.delete(arcLen)
        path_anim_list = []
        if not self.get_use_selection():
            obj_lst = []
            if sample_obj:
                for i in uVal:
                    obj_lst.append(
                        pm.duplicate(sample_obj,
                                     name=setup_name + str(i + 1) + "_OBJECT"))
            else:
                for i in uVal:
                    pm.select(clear=True)
                    obj_lst.append(
                        pm.joint(name=setup_name + str(i + 1) + "_JNT"))

        index = 0
        for u in uVal:
            pm.select(clear=True)
            pathanim = pm.pathAnimation(obj_lst[index],
                                        curve=path_name,
                                        fractionMode=True,
                                        follow=True,
                                        followAxis="x",
                                        worldUpType="vector",
                                        worldUpVector=(0, 1, 0))
            index += 1
            path_anim_list.append(pathanim)
            pm.setAttr(str(pathanim) + ".uValue", u)
            pm.disconnectAttr(str(pathanim) + ".u")
        return (obj_lst, path_anim_list)
Ejemplo n.º 13
0
 def initializePythonScript(self):
     if not pm.objExists('vraySettings.postTranslatePython'):
         return False
     pm.setAttr('vraySettings.postTranslatePython', lock=False)
     actualValue = pm.getAttr('vraySettings.postTranslatePython')
     toAdd = ''
     if 'import arsenalFunction;' not in actualValue:
         toAdd += 'import arsenalFunction;'
     if 'reload(arsenalFunction);' not in actualValue:
         toAdd += 'reload(arsenalFunction);'
     if 'arsenalFunction.arsenalFunction();' not in actualValue:
         toAdd += 'arsenalFunction.arsenalFunction();'
     pm.setAttr('vraySettings.postTranslatePython', toAdd + actualValue)
     if pm.control('vrayPostTranslatePythonCallbackControl', query=True, ex=True):
         pm.scrollField('vrayPostTranslatePythonCallbackControl', edit=True, text=toAdd)
     return True
Ejemplo n.º 14
0
def ckGetList( fdgAttr ):
    """
        ckGetList( fdgAttr )

        description: returns list from the fidget data
            assumes list always ends with ;

        inputs:
            fdgAttr: the object.attribute that we will be looking for data in

        outputs: returns list of data that lives in fdgAttr
    """
    ckList = pm.getAttr(fdgAttr)
    ckList =  ckList.split(";")
    ckList.pop()
    return ckList
Ejemplo n.º 15
0
def ckAddToList(fdgAttr, fdgVal):
    """
        ckAddToList(fdgAttr, fdgVal):

        description: adds value in fdgVal to the list located at fdgAttr
            assumes the list always ends with ;

        inputs:
            fdgAttr: the object.attribute that we will be looking for data in

            fdgVal: the data we will be adding to the list

        outputs: None
    """
    ckAttr = pm.getAttr(fdgAttr)
    ckAttr = ckAttr + str(fdgVal) + ";"
    pm.setAttr(fdgAttr, ckAttr )
Ejemplo n.º 16
0
    def saveSetting(self, *args):
        dicoAttr = {}
        for myAttr in pm.listAttr(self.vraySettings.name()):
            try:
                dicoAttr[myAttr] = pm.getAttr('vraySettings.' + myAttr)
            except:
                OpenMaya.MGlobal.displayInfo('[Arsenal Quality] ' + myAttr + ' value can not be saved or have not value.')

        if not pm.attributeQuery('deeXVrayFastActualSettings', n=self.vraySettings.name(), ex=True):
            locked = False
            if pm.lockNode(self.vraySettings.name(), query=True, lock=True)[0]:
                locked = True
                pm.lockNode(self.vraySettings.name(), lock=False)
            pm.addAttr(self.vraySettings.name(), ln='deeXVrayFastActualSettings', dt='string')
            if locked:
                pm.lockNode(self.vraySettings.name(), lock=True)
        self.vraySettings.deeXVrayFastActualSettings.set(str(dicoAttr))
Ejemplo n.º 17
0
 def createTreadExpression(self, **kwargs):
     motionpaths = kwargs.get("mtnPth", [])
     run_ip = kwargs.get("runAttr", "")
     speed_ip = kwargs.get("speedAttr", "")
     expression_name = kwargs.get("exp_nm", "")
     ip_str = "float $ipVal = " + run_ip + "*" + speed_ip + ";\n"
     computeOffset = ""
     counter = 1
     for mp in motionpaths:
         offset = pm.getAttr(str(mp) + ".uValue")
         computeOffset += "float $newVal" + str(counter) + " = " + str(
             offset) + "+($ipVal - floor(" + str(offset) + "+$ipVal));\n"
         computeOffset += str(mp) + ".uValue = $newVal" + str(
             counter) + ";\n"
         counter += 1
     expression_string = ip_str + computeOffset
     pm.expression(name=expression_name, string=expression_string)
def createTreadExpression(**kwargs):
    motionpaths = kwargs.get("mtnPth", [])
    run_ip = kwargs.get("runAttr", "")
    speed_ip = kwargs.get("speedAttr", "")
    expression_name = kwargs.get("exp_nm", "")
    #ip_str = "float $ipVal = nurbsCircle1.motion_path*0.05;\n"
    ip_str = "float $ipVal = " + run_ip + "*" + speed_ip + ";\n"
    print ip_str
    computeOffset = ""
    id = 1
    for mp in motionpaths:
        offset = pm.getAttr(str(mp) + ".uValue")
        computeOffset += "float $newVal" + str(id) + " = " + str(
            offset) + "+($ipVal - floor(" + str(offset) + "+$ipVal));\n"
        computeOffset += str(mp) + ".uValue = $newVal" + str(id) + ";\n"

    expression_string = ip_str + computeOffset
    pm.expression(name=expression_name, string=expression_string)
Ejemplo n.º 19
0
 def refreshArsenalPassMember(self, myRenderLayer = None, progressBarUpdate = None):
     if myRenderLayer.name() != 'defaultRenderLayer':
         if pm.getAttr(myRenderLayer.name() + '.global') == 0:
             myMemberRenderLayer = myRenderLayer.listMembers(fullNames=True)
             if myMemberRenderLayer is None:
                 return 
             myMemberRenderLayer = list(set(myMemberRenderLayer))
             myMemberArsenalPass = pm.PyNode(myRenderLayer.name() + '_arsenalPass.passMembers').inputs(shapes=True)
             difference = list(set(myMemberRenderLayer).symmetric_difference(set(myMemberArsenalPass)))
             if difference:
                 for (i, myMember,) in enumerate(difference):
                     if not pm.PyNode(myMember + '.message').isConnectedTo(myRenderLayer.name() + '_arsenalPass.passMembers', checkOtherArray=True):
                         if progressBarUpdate is not None:
                             progressBarUpdate(numStep=len(difference), value=i, text='Pass ' + myRenderLayer.name() + ' step 1 : connect passMembers %v of %m ...')
                         pm.connectAttr(myMember + '.message', myRenderLayer.name() + '_arsenalPass.passMembers', force=True, nextAvailable=True)
                     else:
                         if progressBarUpdate is not None:
                             progressBarUpdate(numStep=len(difference), value=i, text='Pass ' + myRenderLayer.name() + ' step 1 : disconnect passMembers %v of %m ...')
                         pm.PyNode(myMember + '.message').disconnect(destination=myRenderLayer.name() + '_arsenalPass.passMembers', nextAvailable=True)
Ejemplo n.º 20
0
 def writeMultimatteMask(self, name = None, layer = None, number = None):
     if layer is None:
         OpenMaya.MGlobal.displayError('[Arsenal] You must to select a pass')
         return 
     actualList = pm.getAttr(layer + '_arsenalPass.multimatteMaskName')
     if actualList in ('default', '', ' '):
         actualList = '{}'
     actualList = eval(actualList)
     if len(actualList) != 0:
         if name in actualList.values() and number not in actualList:
             OpenMaya.MGlobal.displayError('[Arsenal] You must to choose an another name')
             return False
         if not self.checkStringName(text=name):
             OpenMaya.MGlobal.displayError('[Arsenal] You must to choose a valid name')
             return False
     actualList[number] = name
     pm.setAttr(layer + '_arsenalPass.multimatteMaskName', str(actualList))
     self.passName[pm.PyNode(layer)].multimatteMaskName = actualList
     return True
Ejemplo n.º 21
0
def ckAddFidget():
    """
        ckAddFidget( )

        description: this function collects the selected attribute and adds it
          to the list of data that fidget will work with

        inputs: None

        outputs: None

        CK - this would be a great place to add data to a persistent node in the
        maya file(working)
    """

    # fist we are collecting the selected attribute
    atribSel = pm.mel.eval('selectedChannelBoxAttributes();')
    # then we get the object said attribute belongs to
    slectItm = pm.ls( selection = True )
    # the two are added together so we can work with the information
    # inside the maya context
    newAttr =  slectItm.pop() + '.' + atribSel.pop()

    # this is a test to ensure that we are in fact getting some kind of data from
    # the attribute
    newVal = pm.getAttr( newAttr )
    print newVal

    pm.select( clear = True )
    # given that has worked  we will add the data to the lists
    ckAddToList( "ckFidget_GRP.ckFidgetList", newAttr)
    ckAddToList( "ckFidget_GRP.ckFidgetSav", newVal)
    pm.group(name = str(newAttr+"_SAV0" ))
    pm.addAttr( longName="fdgSave", dataType="string", keyable=False)
    newAttr = newAttr.split(".")
    pm.setAttr( str(newAttr[0]+"_"+newAttr[1]+"_SAV0.fdgSave"), str(newVal))
    pm.select( "ckFidget_GRP")
    pm.parent( str(newAttr[0]+"_"+newAttr[1]+"_SAV0") )
    pm.select( clear = True )
    pm.select(newAttr[0])
    # now issue the call to rebuild the interface
    ckFidgetWin()
Ejemplo n.º 22
0
def ckFidgetInit():
    """
        ckFidgetInit()

        description: this function should initialize ckFidget
            it should check for existing persistent data
            and create a new node if none exists
            then it creates the interface

        inputs: None

        outputs: initializes ckFidget
    """
    try:
        print "checking for persistent fidget data"
        pm.select("ckFidget_GRP")
        isFidget = pm.getAttr("ckFidget_GRP.ckIsFidget")
        if isFidget == True:
            print "Data Found!"
            pm.setAttr("ckFidget_GRP.bumpBy", False)
    except:
        print "data not found initializing new ckFidget instance"
        pm.group(empty=True, name="ckFidget_GRP")
        pm.addAttr( longName="ckIsFidget", attributeType='bool', keyable=False )
        pm.setAttr("ckFidget_GRP.ckIsFidget", True)
        pm.addAttr( longName="bumpBy", attributeType='bool', keyable=False )
        pm.setAttr("ckFidget_GRP.bumpBy", False)
        pm.addAttr( longName="ckFidgetBump", attributeType='float', keyable=False, defaultValue=0.1 )
        pm.addAttr( longName="numSaves", attributeType="short", keyable=False, defaultValue=0 )

        print "here is where I should ask about starting a new fidget"
        # should pop up a dialog and ask the name of the new fidget
        pm.addAttr( longName="ckFidgetList", dataType='string', keyable=False )
        pm.addAttr( longName="ckFidgetSav", dataType='string', keyable=False )
        pm.setAttr( "ckFidget_GRP.ckFidgetList","" )
        pm.setAttr( "ckFidget_GRP.ckFidgetSav","" )
        pm.select( clear = True )
    ckFidgetWin()
Ejemplo n.º 23
0
def loadeRenderGlobal():
    if not pm.objExists('renderInfoNode'):
        print u'lightInfoNode 가 존재 하지 않습니다.'
        return
    
    if( pm.getAttr( 'defaultRenderGlobals.currentRenderer' ) != 'arnold' ):
        pm.setAttr('defaultRenderGlobals.currentRenderer', 'arnold')

    renderInfoNode = pm.PyNode('renderInfoNode')
    renderInfo = json.loads(renderInfoNode.renderInfo.get())
    
    for attr, value in renderInfo.items():
        try:
            attrNode = pm.PyNode(attr)
            attrNode.set(value)
        except:
            pass
            #print '{} failed set value {}.'.format(attr, value)
            
    renderInfoNode.unlock()
    pm.delete(renderInfoNode)
    
    print u'렌더 셋팅을 성공 적으로 로드 하였습니다.'
Ejemplo n.º 24
0
	def start(self, renderPass = None, blackHoleMembers = list(), blackHoleMembersReceiveShd = list(), giMembersGenerate = list(), giMembersReceive = list(), primaryMembersOff = list(), reflectionMembersOff = list(), refractionMembersOff = list(), shadowCastsMembersOff = list(), lightSelectNormalMembers = list(), lightSelectDiffuseMembers = list(), lightSelectRawMembers = list(), lightSelectSpecularMembers = list()):
		if renderPass is None:
			renderPass = pm.editRenderLayerGlobals(query=True, currentRenderLayer=True)
		arsenalPassName = str(renderPass) + '_arsenalPass'
		if not pm.objExists(arsenalPassName):
			OpenMaya.MGlobal.displayError('[Arsenal] ' + arsenalPassName + ' not found.')
			return 
		if not blackHoleMembers:
			myConnected = pm.listConnections(arsenalPassName + '.blackHoleMembers', destination=False, source=True)
			for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
				if not dag.intermediateObject.get():
					blackHoleMembers.append(dag)

		if not blackHoleMembersReceiveShd:
			myConnected = pm.listConnections(arsenalPassName + '.blackHoleMembersReceiveShd', destination=False, source=True)
			for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
				if not dag.intermediateObject.get():
					blackHoleMembersReceiveShd.append(dag)

		if not giMembersGenerate:
			myConnected = pm.listConnections(arsenalPassName + '.giMembersGenerate', destination=False, source=True)
			for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
				if not dag.intermediateObject.get():
					giMembersGenerate.append(dag)

		if not giMembersReceive:
			myConnected = pm.listConnections(arsenalPassName + '.giMembersReceive', destination=False, source=True)
			for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
				if not dag.intermediateObject.get():
					giMembersReceive.append(dag)

		if not primaryMembersOff:
			myConnected = pm.listConnections(arsenalPassName + '.primaryMembersOff', destination=False, source=True)
			for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
				if not dag.intermediateObject.get():
					primaryMembersOff.append(dag)

		if not reflectionMembersOff:
			myConnected = pm.listConnections(arsenalPassName + '.reflectionMembersOff', destination=False, source=True)
			for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
				if not dag.intermediateObject.get():
					reflectionMembersOff.append(dag)

		if not refractionMembersOff:
			myConnected = pm.listConnections(arsenalPassName + '.refractionMembersOff', destination=False, source=True)
			for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
				if not dag.intermediateObject.get():
					refractionMembersOff.append(dag)

		if not shadowCastsMembersOff:
			myConnected = pm.listConnections(arsenalPassName + '.shadowCastsMembersOff', destination=False, source=True)
			for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
				if not dag.intermediateObject.get():
					shadowCastsMembersOff.append(dag)

		allGroups = {}
		allGroups['blackHoleMembers'] = blackHoleMembers
		allGroups['blackHoleMembersReceiveShd'] = blackHoleMembersReceiveShd
		allGroups['giMembersGenerate'] = giMembersGenerate
		allGroups['giMembersReceive'] = giMembersReceive
		allGroups['primaryMembersOff'] = primaryMembersOff
		allGroups['reflectionMembersOff'] = reflectionMembersOff
		allGroups['refractionMembersOff'] = refractionMembersOff
		allGroups['shadowCastsMembersOff'] = shadowCastsMembersOff
		dicoInverse = {}
		for p in allGroups.keys():
			for o in allGroups[p]:
				if dicoInverse.has_key(o):
					dicoInverse[o].append(p)
				else:
					dicoInverse[o] = []
					dicoInverse[o].append(p)


		liste = {}
		for dk in dicoInverse.keys():
			if liste.has_key(str(dicoInverse[dk])):
				liste[str(dicoInverse[dk])].append(dk)
			else:
				liste[str(dicoInverse[dk])] = []
				liste[str(dicoInverse[dk])].append(dk)

		liste_finale = {}
		for lk in liste.keys():
			liste_finale[str(liste[lk])] = lk

		vrayLambertMtl = None
		vrayLambert = False
		if pm.getAttr(arsenalPassName + '.vrayLambert'):
			vrayLambert = True
			vrayLambertbrdfMtlName = 'vrayLambertBRDFMtl_arsenal@diffuse'
			if not vrUtils.findByName(vrayLambertbrdfMtlName):
				vrUtils.create('BRDFDiffuse', vrayLambertbrdfMtlName)
			vrayLambertbrdfMtl = vrUtils.findByName(vrayLambertbrdfMtlName)
			gamaValue = pm.getAttr('vraySettings.cmap_gamma')
			if float('%.2f' % gamaValue) == 2.2 and not pm.getAttr('vraySettings.cmap_linearworkflow'):
				vrayLambertCOlorCorrectMtlName = 'vrayLambertCOlorCorrect_arsenal'
				if not vrUtils.findByName(vrayLambertCOlorCorrectMtlName):
					vrUtils.create('ColorCorrect', vrayLambertCOlorCorrectMtlName)
				vrayLambertCOlorCorrect = vrUtils.findByName(vrayLambertCOlorCorrectMtlName)
				vrayLambertCOlorCorrect[0].set('texture_map', vrUtils.AColor(0.7, 0.7, 0.7, 1))
				vrayLambertCOlorCorrect[0].set('preprocess', 1)
				vrayLambertCOlorCorrect[0].set('pre_gamma', 2.2)
				vrayLambertbrdfMtl[0].set('color', vrUtils.Color(0, 0, 0))
				vrayLambertbrdfMtl[0].set('color_tex', vrayLambertCOlorCorrect[0])
			else:
				vrayLambertbrdfMtl[0].set('color', vrUtils.Color(0.7, 0.7, 0.7))
		if vrayLambert:
			allNodes = vrUtils.findByType('Node')
		i = 0
		for result in liste_finale:
			listObjects = eval(result.replace('nt', 'pm.nt'))
			i += 1
			for mySel in listObjects:
				strObj = str(mySel.name()).replace(':', '__')
				node = vrUtils.findByName(strObj + '@node')
				if len(node) == 0:
					continue
				baseMat = node[0].get('material')
				mode = 0
				if 'primaryMembersOff' in liste_finale[result] or 'reflectionMembersOff' in liste_finale[result] or 'refractionMembersOff' in liste_finale[result] or 'shadowCastsMembersOff' in liste_finale[result]:
					mode = 1
					mtlRenderStatsName = baseMat.name() + '_arsenal%d@renderStats' % i
					if not vrUtils.findByName(mtlRenderStatsName):
						vrUtils.create('MtlRenderStats', mtlRenderStatsName)
					mtlRenderStats = vrUtils.findByName(mtlRenderStatsName)
					if 'primaryMembersOff' in liste_finale[result]:
						mtlRenderStats[0].set('camera_visibility', 0)
					if 'reflectionMembersOff' in liste_finale[result]:
						mtlRenderStats[0].set('reflections_visibility', 0)
					if 'refractionMembersOff' in liste_finale[result]:
						mtlRenderStats[0].set('refractions_visibility', 0)
					if 'shadowCastsMembersOff' in liste_finale[result]:
						mtlRenderStats[0].set('shadows_visibility', 0)
				if 'blackHoleMembers' in liste_finale[result] or 'blackHoleMembersReceiveShd' in liste_finale[result] or 'giMembersGenerate' in liste_finale[result] or 'giMembersReceive' in liste_finale[result]:
					if mode == 1:
						mode = 3
					else:
						mode = 2
					wrapperName = baseMat.name() + '_arsenal%d@mtlwrapper' % i
					if not vrUtils.findByName(wrapperName):
						vrUtils.create('MtlWrapper', wrapperName)
					wrapper = vrUtils.findByName(wrapperName)
					if 'blackHoleMembers' in liste_finale[result]:
						wrapper[0].set('matte_surface', 1)
						wrapper[0].set('alpha_contribution', -1)
						wrapper[0].set('reflection_amount', 0)
						wrapper[0].set('refraction_amount', 0)
						if 'generate_render_elements' in vrUtils.getPluginParams(wrapper[0]):
							wrapper[0].set('generate_render_elements', 0)
						if 'blackHoleMembersReceiveShd' in liste_finale[result]:
							wrapper[0].set('shadows', 1)
							wrapper[0].set('affect_alpha', 1)
					if 'giMembersGenerate' in liste_finale[result]:
						wrapper[0].set('generate_gi', 0)
					if 'giMembersReceive' in liste_finale[result]:
						wrapper[0].set('receive_gi', 0)
				if mode == 1:
					mtlRenderStats[0].set('base_mtl', baseMat)
					node[0].set('material', mtlRenderStats)
				elif mode == 2:
					wrapper[0].set('base_material', baseMat)
					node[0].set('material', wrapper)
				elif mode == 3:
					wrapper[0].set('base_material', baseMat)
					mtlRenderStats[0].set('base_mtl', wrapper)
					node[0].set('material', mtlRenderStats)


		if vrayLambert:
			vrayBumpNodes = vrUtils.findByType('BRDFBump')
			for vrayBumpNode in vrayBumpNodes:
				vrayBumpNode.set('base_brdf', vrayLambertbrdfMtl[0])

			vrayBlendNodeNodes = vrUtils.findByType('BRDFLayered')
			for vrayBlendNodeNode in vrayBlendNodeNodes:
				goodListBrdf = list()
				listBrdfs = vrayBlendNodeNode.get('brdfs')
				for listBrdf in listBrdfs:
					if listBrdf in vrayBumpNodes:
						goodListBrdf.append(listBrdf)
					else:
						goodListBrdf.append(vrayLambertbrdfMtl[0])

				vrayBlendNodeNode.set('brdfs', goodListBrdf)

			vraySimpleBRDFNodes = vrUtils.findByType('MtlSingleBRDF')
			for vraySimpleBRDFNode in vraySimpleBRDFNodes:
				inBRDF = vraySimpleBRDFNode.get('brdf')
				if inBRDF not in vrayBumpNodes and inBRDF not in vrayBlendNodeNodes:
					vraySimpleBRDFNode.set('brdf', vrayLambertbrdfMtl[0])

		actualList = pm.getAttr(arsenalPassName + '.multimatteMaskName')
		if actualList not in ('', '{}'):
			actualList = eval(actualList)
			for matteNumber in actualList:
				extraTexName = arsenalPassName + '_VRayUserColorMultimatte_number' + str(matteNumber)
				vrUtils.create('TexUserColor', extraTexName)
				variableName = actualList[matteNumber] + '_' + arsenalPassName
				extraTex = vrUtils.findByName(extraTexName)
				extraTex[0].set('default_color', vrUtils.AColor(0, 0, 0, 1))
				extraTex[0].set('user_attribute', variableName)
				extraTexRenderElementName = arsenalPassName + '_RenderElementMultimatte_number' + str(matteNumber)
				vrUtils.create('RenderChannelExtraTex', extraTexRenderElementName)
				extraTexRenderElement = vrUtils.findByName(extraTexRenderElementName)
				extraTexRenderElement[0].set('name', actualList[matteNumber])
				extraTexRenderElement[0].set('consider_for_aa', 1)
				extraTexRenderElement[0].set('affect_matte_objects', 1)
				extraTexRenderElement[0].set('texmap', extraTex[0])
				extraTexRenderElement[0].set('filtering', 1)
				myConnected = pm.listConnections(arsenalPassName + '.multimatteMaskMembers[' + str(matteNumber) + '].multimatteMaskMembersRed', destination=False, source=True)
				for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
					if not dag.intermediateObject.get():
						strObj = str(dag.name()).replace(':', '__')
						node = vrUtils.findByName(strObj + '@node')
						if len(node) == 0:
							continue
						currentUserAttr = node[0].get('user_attributes')
						value = variableName + '=1,0,0;' + currentUserAttr
						node[0].set('user_attributes', value)
						pm.mel.warning(strObj + '@node')
						pm.mel.warning(variableName)

				myConnected = pm.listConnections(arsenalPassName + '.multimatteMaskMembers[' + str(matteNumber) + '].multimatteMaskMembersGreen', destination=False, source=True)
				for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
					if not dag.intermediateObject.get():
						strObj = str(dag.name()).replace(':', '__')
						node = vrUtils.findByName(strObj + '@node')
						if len(node) == 0:
							continue
						currentUserAttr = node[0].get('user_attributes')
						value = variableName + '=0,1,0;' + currentUserAttr
						node[0].set('user_attributes', value)

				myConnected = pm.listConnections(arsenalPassName + '.multimatteMaskMembers[' + str(matteNumber) + '].multimatteMaskMembersBlue', destination=False, source=True)
				for dag in self.getAllChildShapes(selection=myConnected, type=['mesh', 'VRayPlane']):
					if not dag.intermediateObject.get():
						strObj = str(dag.name()).replace(':', '__')
						node = vrUtils.findByName(strObj + '@node')
						if len(node) == 0:
							continue
						currentUserAttr = node[0].get('user_attributes')
						value = variableName + '=0,0,1;' + currentUserAttr
						node[0].set('user_attributes', value)


		if pm.getAttr(arsenalPassName + '.vrayMaterialID'):
			self.deeXMaterialIDGeneratorFunc()
		if pm.getAttr(arsenalPassName + '.vrayProxyObjectID'):
			self.deeXProxyObjectIDGeneratorFunc()
		if not lightSelectNormalMembers:
			if pm.getAttr(arsenalPassName + '.lightSelectAllNormal'):
				lightSelectNormalMembers = vrUtils.findByType('Light*') + vrUtils.findByType('MayaLight*')
			else:
				myConnected = pm.listConnections(arsenalPassName + '.lightSelectNormalMembers', destination=False, source=True)
				for dag in self.getAllChildShapes(selection=myConnected, type=pm.listNodeTypes('light')):
					if not dag.intermediateObject.get():
						strObj = str(dag.name()).replace(':', '__')
						node = vrUtils.findByName(strObj)
						lightSelectNormalMembers.append(node[0])

		if not lightSelectDiffuseMembers:
			if pm.getAttr(arsenalPassName + '.lightSelectAllDiffuse'):
				lightSelectDiffuseMembers = vrUtils.findByType('Light*') + vrUtils.findByType('MayaLight*')
			else:
				myConnected = pm.listConnections(arsenalPassName + '.lightSelectDiffuseMembers', destination=False, source=True)
				for dag in self.getAllChildShapes(selection=myConnected, type=pm.listNodeTypes('light')):
					if not dag.intermediateObject.get():
						strObj = str(dag.name()).replace(':', '__')
						node = vrUtils.findByName(strObj)
						lightSelectDiffuseMembers.append(node[0])

		if not lightSelectRawMembers:
			if pm.getAttr(arsenalPassName + '.lightSelectAllRaw'):
				lightSelectRawMembers = vrUtils.findByType('Light*') + vrUtils.findByType('MayaLight*')
			else:
				myConnected = pm.listConnections(arsenalPassName + '.lightSelectRawMembers', destination=False, source=True)
				for dag in self.getAllChildShapes(selection=myConnected, type=pm.listNodeTypes('light')):
					if not dag.intermediateObject.get():
						strObj = str(dag.name()).replace(':', '__')
						node = vrUtils.findByName(strObj)
						lightSelectRawMembers.append(node[0])

		if not lightSelectSpecularMembers:
			if pm.getAttr(arsenalPassName + '.lightSelectAllSpecular'):
				lightSelectSpecularMembers = vrUtils.findByType('Light*') + vrUtils.findByType('MayaLight*')
			else:
				myConnected = pm.listConnections(arsenalPassName + '.lightSelectSpecularMembers', destination=False, source=True)
				for dag in self.getAllChildShapes(selection=myConnected, type=pm.listNodeTypes('light')):
					if not dag.intermediateObject.get():
						strObj = str(dag.name()).replace(':', '__')
						node = vrUtils.findByName(strObj)
						lightSelectSpecularMembers.append(node[0])

		self.deeXLightSelectGeneratorFunc(lightNormal=lightSelectNormalMembers, lightDiffuse=lightSelectDiffuseMembers, lightRaw=lightSelectRawMembers, lightSpecular=lightSelectSpecularMembers)
Ejemplo n.º 25
0
def stretch_expression(**kwargs):
    sel_jnts = kwargs.get("joints", [])
    curve_info_node = kwargs.get("curve_info_node", None)
    global_scale_attribute = kwargs.get("scale_attribute", None)
    expression_name = kwargs.get("expression_name", "ik_sretch_expression")
    connect_scale = kwargs.get("connect_scale", False)
    control_attribute = kwargs.get("ctrl_attr", None)
    global_scale = kwargs.get("glbl_scl_stat", False)
    global_attr = kwargs.get("glbl_scl_attr", None)
    control_obj = kwargs.get("control_obj", None)
    scale_joints = kwargs.get("scale_joints", None)

    total_len = 0.0
    count = str(len(sel_jnts) - 1)
    curve_length = str(curve_info_node) + ".arcLength"
    main_expression_name = expression_name

    exp_scale_str = ""
    exp_def_scale_str = ""
    exp_init_str = ""
    exp_stretch_str = ""
    exp_def_stretch_str = ""
    arc_len_str = ""
    scale_val_str = ""
    c_comp_str = ""
    a_comp_str = ""
    vertical_cal_str = ""
    depth_cal_str = ""
    polynomial_fun_ip = ""
    polynomial_fun_str = ""
    if connect_scale:
        polynomial_fun_ip = "float $depth_ip ="+control_obj+".EndDepth*\
                            clamp(-1,1, $len_diff/10);\n"                                                          + \
                            "float $hpos_ip ="+control_obj+".ShiftScale*\
                            clamp(-1,1, $len_diff/10);\n"                                                           + \
                            "float $vpos_ip = "+control_obj+".Thickness*\
                            clamp(-1,1, $len_diff/10);\n"                                                          + \
                            "float $depth_val;\n" + \
                            "float $vertical_val;\n"

        polynomial_fun_str = "proc float poly(float $a, float $b,\
                                              float $c, float $x)\n"                                                                     + \
                             "{\n" + \
                             "float $y=($a*pow($x,2)) + ($b*$x) + $c;\n" + \
                             "return $y;\n" + \
                             "}\n"

    for jnt in sel_jnts:
        exp_init_str = exp_init_str + "float $joint" + str(
            sel_jnts.index(jnt)) + "_tx" + "=" + str(
                jnt.translateX.get()) + ";\n"
        exp_stretch_str = exp_stretch_str + str(
            jnt) + ".translateX = $joint" + str(
                sel_jnts.index(jnt)) + "_tx + $len_diff;\n"
        exp_def_stretch_str = exp_def_stretch_str + str(
            jnt) + ".translateX = $joint" + str(sel_jnts.index(jnt)) + "_tx;\n"

    if connect_scale:
        if scale_joints:
            scale_param_val, total_len = set_scale_param(
                joint_list=scale_joints)
            scale_count = str((len(sel_jnts) - 1) / (len(scale_joints) - 1))
            vertical_cal_str = "$vertical_val = (exp(-$len_diff*" + str(
                scale_count) + "))*($vpos_ip+1);\n"
        else:
            scale_param_val, total_len = set_scale_param(joint_list=sel_jnts)
            vertical_cal_str = "$vertical_val = (exp(-$len_diff))*\
                                ($vpos_ip+1);\n"

        for key in scale_param_val.keys():
            exp_scale_str += str(key) + ".scaleY=" + str(
                key
            ) + ".scaleZ = poly($depth_val, $hpos_ip, $vertical_val, " + str(
                scale_param_val[key]) + ");\n"
            exp_def_scale_str = exp_def_scale_str + str(
                key) + ".scaleZ =" + str(key) + ".scaleY = 1;\n"
        depth_cal_str = "float $depth_val = ((1-exp(-$len_diff))/(" + str(
            total_len * 10) + "))*$depth_ip;\n"

    init_arc_length = str(pm.getAttr(curve_length))
    if (global_scale):
        arc_len_str = "float $arc_len = " + curve_length + "/" + \
                       global_attr + ";\n"
    else:
        arc_len_str = "float $arc_len = " + curve_length + ";\n"
    string_exp_str = arc_len_str+exp_init_str+polynomial_fun_str + \
        "if ($arc_len != "+init_arc_length+" && "+control_attribute+")\n" + \
        "{\n" + \
        "float $len_diff =(" + control_attribute + "/10)*($arc_len - " + \
        init_arc_length+")/"+count+";\n"+polynomial_fun_ip + \
        exp_stretch_str+vertical_cal_str + \
        depth_cal_str + \
        "\nfloat $scale_val = (-($arc_len - "+init_arc_length + \
        ")/100)+1;\n"+exp_scale_str + \
        "}\n" + \
        "else\n" + \
        "{\n"+exp_def_stretch_str+exp_def_scale_str + \
        "}\n"
    pm.expression(name=main_expression_name, string=string_exp_str)

    return None
Ejemplo n.º 26
0
def stretch_expression(**kwargs):
    """
    create curve info node to get the length of the initial curve for reference
    edit the script to change the curveInfo node name as used in the scene
    select the joints connected to stretching curve and run the  below scrip
    add conditional statements in expression editor if the stretch is controlled by user attribute
    
    divide the "curve_length" variable with global scale value if used
    """

    #sel_jnts= pm.ls(selection=True)
    sel_jnts = kwargs.get("joints", [])
    curve_info_node = kwargs.get("curve_info_node", None)
    global_scale_attribute = kwargs.get("scale_attribute", None)
    expression_name = kwargs.get("expression_name", "ik_sretch_expression")
    connect_scale = kwargs.get("connect_scale", False)
    control_attribute = kwargs.get("ctrl_attr", None)
    global_scale = kwargs.get("glbl_scl_stat", False)
    global_attr = kwargs.get("glbl_scl_attr", None)

    count = str(len(sel_jnts) - 1)
    #curve_length = "spine_curve_info.arcLength"

    curve_length = str(curve_info_node) + ".arcLength"
    main_expression_name = expression_name

    exp_scale_str = ""
    exp_def_scale_str = ""
    exp_init_str = ""
    exp_stretch_str = ""
    exp_def_stretch_str = ""
    string_exp_str = ""
    arc_len_str = ""

    for jnt in sel_jnts:
        exp_init_str = exp_init_str + "float $joint" + str(
            sel_jnts.index(jnt)) + "_tx" + "=" + str(
                jnt.translateX.get()) + ";\n"
        exp_stretch_str = exp_stretch_str + str(
            jnt) + ".translateX = $joint" + str(
                sel_jnts.index(jnt)) + "_tx + $len_diff;\n"
        exp_def_stretch_str = exp_def_stretch_str + str(
            jnt) + ".translateX = $joint" + str(sel_jnts.index(jnt)) + "_tx;\n"

    #for index in range(len(sel_jnts)):
    #exp_stretch_str = exp_stretch_str + str(sel_jnts[index])+".translateX = $joint"+str(index)+"_tx + $len_diff;\n"
    #exp_def_stretch_str = exp_def_stretch_str + str(sel_jnts[index])+".translateX = $joint"+str(index)+"_tx;\n"

    if connect_scale:
        for jnt in sel_jnts:
            exp_scale_str = exp_scale_str + str(
                jnt) + ".scaleY = $scale_val;\n"
            exp_scale_str = exp_scale_str + str(
                jnt) + ".scaleZ = $scale_val;\n"
            exp_def_scale_str = exp_def_scale_str + str(jnt) + ".scaleY = 1;\n"
            exp_def_scale_str = exp_def_scale_str + str(jnt) + ".scaleZ = 1;\n"

    init_arc_length = str(pm.getAttr(curve_length))

    #string_exp_str = "if ("+control_attribute+" == 1)\n{\n"

    if (global_scale):
        arc_len_str = "float $arc_len = " + curve_length + "/" + global_attr + ";\n"
    else:
        arc_len_str = "float $arc_len = " + curve_length + ";\n"

    string_exp_str = arc_len_str+exp_init_str+\
    """if ($arc_len != """+init_arc_length+""" && """+control_attribute+"""==1)
    {
    float $len_diff = ($arc_len - """+init_arc_length+""")/"""+count+""";\n"""+exp_stretch_str+\
    """float $scale_val = (-($arc_len - """+init_arc_length+""")/100)+1;\n"""+exp_scale_str+\
    """}
    else
    {\n"""+exp_def_stretch_str+exp_def_scale_str+\
    """}"""
    #print string_exp_str
    print string_exp_str
    pm.expression(name=main_expression_name, string=string_exp_str)

    return None
Ejemplo n.º 27
0
def treadAtPoints(**kwargs):
    #get inputs
    tread_name = kwargs.get("tr_name", "Tread")
    crv = kwargs.get("path_crv", None)
    crv = str(pm.duplicate(crv, name=str(tread_name) + "PathCrv")[0])
    pm.xform(crv, centerPivots=True)
    #obtain curve length
    full_length = pm.arclen(crv)
    paramVal = []
    uVal = []
    # get param value on the curve at each position selected (locators)
    sel_obj = pm.ls(selection=True)
    for obj in sel_obj:
        pos = pm.xform(obj, query=True, translation=True, worldSpace=True)
        param = getuParamVal(pos, crv)
        paramVal.append(param)
    crv_shp = pm.listRelatives(crv, shapes=True)[0]
    # create arc length dimension tool
    arcLen = pm.arcLengthDimension(crv_shp + ".u[0]")
    # for each param value obtained set the arc length tool attribute and
    # store the length of curve at that param value
    # normalize the curve to obtain the motion path U value at each position
    for val in paramVal:
        pm.setAttr(str(arcLen) + ".uParamValue", val)
        len_at_pos = pm.getAttr(str(arcLen) + ".arcLength")
        uVal.append(len_at_pos / full_length)
    pm.delete(arcLen)
    mthPthLst = []
    jntLst = []
    # create joints, assign motion path and set U value obtained
    for u in uVal:
        pm.select(clear=True)
        jnt = pm.joint()
        jntLst.append(jnt)
        pathanim = pm.pathAnimation(jnt,
                                    curve=crv,
                                    fractionMode=True,
                                    follow=True,
                                    followAxis="x",
                                    worldUpType="vector",
                                    worldUpVector=(0, 1, 0))
        mthPthLst.append(pathanim)
        pm.setAttr(str(pathanim) + ".uValue", u)
        pm.disconnectAttr(str(pathanim) + ".u")
        # create up locator at mid point of all joints
    #loc_pos = midPos(selected_items = jntLst)
    #loc_pos = pm.xform(crv, query=True, translation=True, worldSpace=True)
    loc_pos = midPosVec(objects=jntLst)
    loc = pm.spaceLocator()
    pm.xform(loc, translation=loc_pos, worldSpace=True)
    for mtPth in mthPthLst:
        pm.pathAnimation(mtPth,
                         edit=True,
                         worldUpType="object",
                         worldUpObject=loc)
    # create control curve, add run and speed attributes
    control_crv = pm.circle(name=tread_name + "CTRL",
                            normalX=1,
                            normalY=0,
                            normalZ=0)
    pm.xform(control_crv, translation=loc_pos)
    pm.select(clear=True)
    pm.addAttr(control_crv,
               longName="run",
               attributeType="float",
               keyable=True)
    pm.addAttr(control_crv,
               longName="speed",
               attributeType="float",
               keyable=True,
               minValue=0.0,
               defaultValue=0.5)
    # group the tread setup
    pm.parent(crv, control_crv)
    pm.parent(loc, control_crv)
    pm.select(clear=True)
    gp = pm.group(name=tread_name + "GP")
    pm.select(clear=True)
    jnt_gp = pm.group(jntLst, name=tread_name + "JNTGP")
    pm.xform(gp, translation=loc_pos)
    pm.parent(control_crv, gp)
    pm.parent(jnt_gp, gp)
    createTreadExpression(mtnPth=mthPthLst,
                          runAttr=str(control_crv[0]) + ".run",
                          speedAttr=str(control_crv[0]) + ".speed",
                          exp_nm=tread_name)
    return None


#treadAtPoints(pathCrv = "nurbsCircle1", tr_name = "testTread")
Ejemplo n.º 28
0
    def start(self,
              renderPass=None,
              blackHoleMembers=list(),
              blackHoleMembersReceiveShd=list(),
              giMembersGenerate=list(),
              giMembersReceive=list(),
              primaryMembersOff=list(),
              reflectionMembersOff=list(),
              refractionMembersOff=list(),
              shadowCastsMembersOff=list(),
              lightSelectNormalMembers=list(),
              lightSelectDiffuseMembers=list(),
              lightSelectRawMembers=list(),
              lightSelectSpecularMembers=list()):
        if renderPass is None:
            renderPass = pm.editRenderLayerGlobals(query=True,
                                                   currentRenderLayer=True)
        arsenalPassName = str(renderPass) + '_arsenalPass'
        if not pm.objExists(arsenalPassName):
            OpenMaya.MGlobal.displayError('[Arsenal] ' + arsenalPassName +
                                          ' not found.')
            return
        if not blackHoleMembers:
            myConnected = pm.listConnections(arsenalPassName +
                                             '.blackHoleMembers',
                                             destination=False,
                                             source=True)
            for dag in self.getAllChildShapes(selection=myConnected,
                                              type=['mesh', 'VRayPlane']):
                if not dag.intermediateObject.get():
                    blackHoleMembers.append(dag)

        if not blackHoleMembersReceiveShd:
            myConnected = pm.listConnections(arsenalPassName +
                                             '.blackHoleMembersReceiveShd',
                                             destination=False,
                                             source=True)
            for dag in self.getAllChildShapes(selection=myConnected,
                                              type=['mesh', 'VRayPlane']):
                if not dag.intermediateObject.get():
                    blackHoleMembersReceiveShd.append(dag)

        if not giMembersGenerate:
            myConnected = pm.listConnections(arsenalPassName +
                                             '.giMembersGenerate',
                                             destination=False,
                                             source=True)
            for dag in self.getAllChildShapes(selection=myConnected,
                                              type=['mesh', 'VRayPlane']):
                if not dag.intermediateObject.get():
                    giMembersGenerate.append(dag)

        if not giMembersReceive:
            myConnected = pm.listConnections(arsenalPassName +
                                             '.giMembersReceive',
                                             destination=False,
                                             source=True)
            for dag in self.getAllChildShapes(selection=myConnected,
                                              type=['mesh', 'VRayPlane']):
                if not dag.intermediateObject.get():
                    giMembersReceive.append(dag)

        if not primaryMembersOff:
            myConnected = pm.listConnections(arsenalPassName +
                                             '.primaryMembersOff',
                                             destination=False,
                                             source=True)
            for dag in self.getAllChildShapes(selection=myConnected,
                                              type=['mesh', 'VRayPlane']):
                if not dag.intermediateObject.get():
                    primaryMembersOff.append(dag)

        if not reflectionMembersOff:
            myConnected = pm.listConnections(arsenalPassName +
                                             '.reflectionMembersOff',
                                             destination=False,
                                             source=True)
            for dag in self.getAllChildShapes(selection=myConnected,
                                              type=['mesh', 'VRayPlane']):
                if not dag.intermediateObject.get():
                    reflectionMembersOff.append(dag)

        if not refractionMembersOff:
            myConnected = pm.listConnections(arsenalPassName +
                                             '.refractionMembersOff',
                                             destination=False,
                                             source=True)
            for dag in self.getAllChildShapes(selection=myConnected,
                                              type=['mesh', 'VRayPlane']):
                if not dag.intermediateObject.get():
                    refractionMembersOff.append(dag)

        if not shadowCastsMembersOff:
            myConnected = pm.listConnections(arsenalPassName +
                                             '.shadowCastsMembersOff',
                                             destination=False,
                                             source=True)
            for dag in self.getAllChildShapes(selection=myConnected,
                                              type=['mesh', 'VRayPlane']):
                if not dag.intermediateObject.get():
                    shadowCastsMembersOff.append(dag)

        allGroups = {}
        allGroups['blackHoleMembers'] = blackHoleMembers
        allGroups['blackHoleMembersReceiveShd'] = blackHoleMembersReceiveShd
        allGroups['giMembersGenerate'] = giMembersGenerate
        allGroups['giMembersReceive'] = giMembersReceive
        allGroups['primaryMembersOff'] = primaryMembersOff
        allGroups['reflectionMembersOff'] = reflectionMembersOff
        allGroups['refractionMembersOff'] = refractionMembersOff
        allGroups['shadowCastsMembersOff'] = shadowCastsMembersOff
        dicoInverse = {}
        for p in allGroups.keys():
            for o in allGroups[p]:
                if dicoInverse.has_key(o):
                    dicoInverse[o].append(p)
                else:
                    dicoInverse[o] = []
                    dicoInverse[o].append(p)

        liste = {}
        for dk in dicoInverse.keys():
            if liste.has_key(str(dicoInverse[dk])):
                liste[str(dicoInverse[dk])].append(dk)
            else:
                liste[str(dicoInverse[dk])] = []
                liste[str(dicoInverse[dk])].append(dk)

        liste_finale = {}
        for lk in liste.keys():
            liste_finale[str(liste[lk])] = lk

        vrayLambertMtl = None
        vrayLambert = False
        if pm.getAttr(arsenalPassName + '.vrayLambert'):
            vrayLambert = True
            vrayLambertbrdfMtlName = 'vrayLambertBRDFMtl_arsenal@diffuse'
            if not vrUtils.findByName(vrayLambertbrdfMtlName):
                vrUtils.create('BRDFDiffuse', vrayLambertbrdfMtlName)
            vrayLambertbrdfMtl = vrUtils.findByName(vrayLambertbrdfMtlName)
            gamaValue = pm.getAttr('vraySettings.cmap_gamma')
            if float('%.2f' % gamaValue) == 2.2 and not pm.getAttr(
                    'vraySettings.cmap_linearworkflow'):
                vrayLambertCOlorCorrectMtlName = 'vrayLambertCOlorCorrect_arsenal'
                if not vrUtils.findByName(vrayLambertCOlorCorrectMtlName):
                    vrUtils.create('ColorCorrect',
                                   vrayLambertCOlorCorrectMtlName)
                vrayLambertCOlorCorrect = vrUtils.findByName(
                    vrayLambertCOlorCorrectMtlName)
                vrayLambertCOlorCorrect[0].set(
                    'texture_map', vrUtils.AColor(0.7, 0.7, 0.7, 1))
                vrayLambertCOlorCorrect[0].set('preprocess', 1)
                vrayLambertCOlorCorrect[0].set('pre_gamma', 2.2)
                vrayLambertbrdfMtl[0].set('color', vrUtils.Color(0, 0, 0))
                vrayLambertbrdfMtl[0].set('color_tex',
                                          vrayLambertCOlorCorrect[0])
            else:
                vrayLambertbrdfMtl[0].set('color',
                                          vrUtils.Color(0.7, 0.7, 0.7))
        if vrayLambert:
            allNodes = vrUtils.findByType('Node')
        i = 0
        for result in liste_finale:
            listObjects = eval(result.replace('nt', 'pm.nt'))
            i += 1
            for mySel in listObjects:
                strObj = str(mySel.name()).replace(':', '__')
                node = vrUtils.findByName(strObj + '@node')
                if len(node) == 0:
                    continue
                baseMat = node[0].get('material')
                mode = 0
                if 'primaryMembersOff' in liste_finale[
                        result] or 'reflectionMembersOff' in liste_finale[
                            result] or 'refractionMembersOff' in liste_finale[
                                result] or 'shadowCastsMembersOff' in liste_finale[
                                    result]:
                    mode = 1
                    mtlRenderStatsName = baseMat.name(
                    ) + '_arsenal%d@renderStats' % i
                    if not vrUtils.findByName(mtlRenderStatsName):
                        vrUtils.create('MtlRenderStats', mtlRenderStatsName)
                    mtlRenderStats = vrUtils.findByName(mtlRenderStatsName)
                    if 'primaryMembersOff' in liste_finale[result]:
                        mtlRenderStats[0].set('camera_visibility', 0)
                    if 'reflectionMembersOff' in liste_finale[result]:
                        mtlRenderStats[0].set('reflections_visibility', 0)
                    if 'refractionMembersOff' in liste_finale[result]:
                        mtlRenderStats[0].set('refractions_visibility', 0)
                    if 'shadowCastsMembersOff' in liste_finale[result]:
                        mtlRenderStats[0].set('shadows_visibility', 0)
                if 'blackHoleMembers' in liste_finale[
                        result] or 'blackHoleMembersReceiveShd' in liste_finale[
                            result] or 'giMembersGenerate' in liste_finale[
                                result] or 'giMembersReceive' in liste_finale[
                                    result]:
                    if mode == 1:
                        mode = 3
                    else:
                        mode = 2
                    wrapperName = baseMat.name() + '_arsenal%d@mtlwrapper' % i
                    if not vrUtils.findByName(wrapperName):
                        vrUtils.create('MtlWrapper', wrapperName)
                    wrapper = vrUtils.findByName(wrapperName)
                    if 'blackHoleMembers' in liste_finale[result]:
                        wrapper[0].set('matte_surface', 1)
                        wrapper[0].set('alpha_contribution', -1)
                        wrapper[0].set('reflection_amount', 0)
                        wrapper[0].set('refraction_amount', 0)
                        if 'generate_render_elements' in vrUtils.getPluginParams(
                                wrapper[0]):
                            wrapper[0].set('generate_render_elements', 0)
                        if 'blackHoleMembersReceiveShd' in liste_finale[
                                result]:
                            wrapper[0].set('shadows', 1)
                            wrapper[0].set('affect_alpha', 1)
                    if 'giMembersGenerate' in liste_finale[result]:
                        wrapper[0].set('generate_gi', 0)
                    if 'giMembersReceive' in liste_finale[result]:
                        wrapper[0].set('receive_gi', 0)
                if mode == 1:
                    mtlRenderStats[0].set('base_mtl', baseMat)
                    node[0].set('material', mtlRenderStats)
                elif mode == 2:
                    wrapper[0].set('base_material', baseMat)
                    node[0].set('material', wrapper)
                elif mode == 3:
                    wrapper[0].set('base_material', baseMat)
                    mtlRenderStats[0].set('base_mtl', wrapper)
                    node[0].set('material', mtlRenderStats)

        if vrayLambert:
            vrayBumpNodes = vrUtils.findByType('BRDFBump')
            for vrayBumpNode in vrayBumpNodes:
                vrayBumpNode.set('base_brdf', vrayLambertbrdfMtl[0])

            vrayBlendNodeNodes = vrUtils.findByType('BRDFLayered')
            for vrayBlendNodeNode in vrayBlendNodeNodes:
                goodListBrdf = list()
                listBrdfs = vrayBlendNodeNode.get('brdfs')
                for listBrdf in listBrdfs:
                    if listBrdf in vrayBumpNodes:
                        goodListBrdf.append(listBrdf)
                    else:
                        goodListBrdf.append(vrayLambertbrdfMtl[0])

                vrayBlendNodeNode.set('brdfs', goodListBrdf)

            vraySimpleBRDFNodes = vrUtils.findByType('MtlSingleBRDF')
            for vraySimpleBRDFNode in vraySimpleBRDFNodes:
                inBRDF = vraySimpleBRDFNode.get('brdf')
                if inBRDF not in vrayBumpNodes and inBRDF not in vrayBlendNodeNodes:
                    vraySimpleBRDFNode.set('brdf', vrayLambertbrdfMtl[0])

        actualList = pm.getAttr(arsenalPassName + '.multimatteMaskName')
        if actualList not in ('', '{}'):
            actualList = eval(actualList)
            for matteNumber in actualList:
                extraTexName = arsenalPassName + '_VRayUserColorMultimatte_number' + str(
                    matteNumber)
                vrUtils.create('TexUserColor', extraTexName)
                variableName = actualList[matteNumber] + '_' + arsenalPassName
                extraTex = vrUtils.findByName(extraTexName)
                extraTex[0].set('default_color', vrUtils.AColor(0, 0, 0, 1))
                extraTex[0].set('user_attribute', variableName)
                extraTexRenderElementName = arsenalPassName + '_RenderElementMultimatte_number' + str(
                    matteNumber)
                vrUtils.create('RenderChannelExtraTex',
                               extraTexRenderElementName)
                extraTexRenderElement = vrUtils.findByName(
                    extraTexRenderElementName)
                extraTexRenderElement[0].set('name', actualList[matteNumber])
                extraTexRenderElement[0].set('consider_for_aa', 1)
                extraTexRenderElement[0].set('affect_matte_objects', 1)
                extraTexRenderElement[0].set('texmap', extraTex[0])
                extraTexRenderElement[0].set('filtering', 1)
                myConnected = pm.listConnections(
                    arsenalPassName + '.multimatteMaskMembers[' +
                    str(matteNumber) + '].multimatteMaskMembersRed',
                    destination=False,
                    source=True)
                for dag in self.getAllChildShapes(selection=myConnected,
                                                  type=['mesh', 'VRayPlane']):
                    if not dag.intermediateObject.get():
                        strObj = str(dag.name()).replace(':', '__')
                        node = vrUtils.findByName(strObj + '@node')
                        if len(node) == 0:
                            continue
                        currentUserAttr = node[0].get('user_attributes')
                        value = variableName + '=1,0,0;' + currentUserAttr
                        node[0].set('user_attributes', value)
                        pm.mel.warning(strObj + '@node')
                        pm.mel.warning(variableName)

                myConnected = pm.listConnections(
                    arsenalPassName + '.multimatteMaskMembers[' +
                    str(matteNumber) + '].multimatteMaskMembersGreen',
                    destination=False,
                    source=True)
                for dag in self.getAllChildShapes(selection=myConnected,
                                                  type=['mesh', 'VRayPlane']):
                    if not dag.intermediateObject.get():
                        strObj = str(dag.name()).replace(':', '__')
                        node = vrUtils.findByName(strObj + '@node')
                        if len(node) == 0:
                            continue
                        currentUserAttr = node[0].get('user_attributes')
                        value = variableName + '=0,1,0;' + currentUserAttr
                        node[0].set('user_attributes', value)

                myConnected = pm.listConnections(
                    arsenalPassName + '.multimatteMaskMembers[' +
                    str(matteNumber) + '].multimatteMaskMembersBlue',
                    destination=False,
                    source=True)
                for dag in self.getAllChildShapes(selection=myConnected,
                                                  type=['mesh', 'VRayPlane']):
                    if not dag.intermediateObject.get():
                        strObj = str(dag.name()).replace(':', '__')
                        node = vrUtils.findByName(strObj + '@node')
                        if len(node) == 0:
                            continue
                        currentUserAttr = node[0].get('user_attributes')
                        value = variableName + '=0,0,1;' + currentUserAttr
                        node[0].set('user_attributes', value)

        if pm.getAttr(arsenalPassName + '.vrayMaterialID'):
            self.deeXMaterialIDGeneratorFunc()
        if pm.getAttr(arsenalPassName + '.vrayProxyObjectID'):
            self.deeXProxyObjectIDGeneratorFunc()
        if not lightSelectNormalMembers:
            if pm.getAttr(arsenalPassName + '.lightSelectAllNormal'):
                lightSelectNormalMembers = vrUtils.findByType(
                    'Light*') + vrUtils.findByType('MayaLight*')
            else:
                myConnected = pm.listConnections(arsenalPassName +
                                                 '.lightSelectNormalMembers',
                                                 destination=False,
                                                 source=True)
                for dag in self.getAllChildShapes(
                        selection=myConnected, type=pm.listNodeTypes('light')):
                    if not dag.intermediateObject.get():
                        strObj = str(dag.name()).replace(':', '__')
                        node = vrUtils.findByName(strObj)
                        lightSelectNormalMembers.append(node[0])

        if not lightSelectDiffuseMembers:
            if pm.getAttr(arsenalPassName + '.lightSelectAllDiffuse'):
                lightSelectDiffuseMembers = vrUtils.findByType(
                    'Light*') + vrUtils.findByType('MayaLight*')
            else:
                myConnected = pm.listConnections(arsenalPassName +
                                                 '.lightSelectDiffuseMembers',
                                                 destination=False,
                                                 source=True)
                for dag in self.getAllChildShapes(
                        selection=myConnected, type=pm.listNodeTypes('light')):
                    if not dag.intermediateObject.get():
                        strObj = str(dag.name()).replace(':', '__')
                        node = vrUtils.findByName(strObj)
                        lightSelectDiffuseMembers.append(node[0])

        if not lightSelectRawMembers:
            if pm.getAttr(arsenalPassName + '.lightSelectAllRaw'):
                lightSelectRawMembers = vrUtils.findByType(
                    'Light*') + vrUtils.findByType('MayaLight*')
            else:
                myConnected = pm.listConnections(arsenalPassName +
                                                 '.lightSelectRawMembers',
                                                 destination=False,
                                                 source=True)
                for dag in self.getAllChildShapes(
                        selection=myConnected, type=pm.listNodeTypes('light')):
                    if not dag.intermediateObject.get():
                        strObj = str(dag.name()).replace(':', '__')
                        node = vrUtils.findByName(strObj)
                        lightSelectRawMembers.append(node[0])

        if not lightSelectSpecularMembers:
            if pm.getAttr(arsenalPassName + '.lightSelectAllSpecular'):
                lightSelectSpecularMembers = vrUtils.findByType(
                    'Light*') + vrUtils.findByType('MayaLight*')
            else:
                myConnected = pm.listConnections(arsenalPassName +
                                                 '.lightSelectSpecularMembers',
                                                 destination=False,
                                                 source=True)
                for dag in self.getAllChildShapes(
                        selection=myConnected, type=pm.listNodeTypes('light')):
                    if not dag.intermediateObject.get():
                        strObj = str(dag.name()).replace(':', '__')
                        node = vrUtils.findByName(strObj)
                        lightSelectSpecularMembers.append(node[0])

        self.deeXLightSelectGeneratorFunc(
            lightNormal=lightSelectNormalMembers,
            lightDiffuse=lightSelectDiffuseMembers,
            lightRaw=lightSelectRawMembers,
            lightSpecular=lightSelectSpecularMembers)
Ejemplo n.º 29
0
    def __init__(self):
        
        # Initialize the object as a QWidget
        QWidget.__init__(self)
        
        # We have to set the size of the main window
        # ourselves, since we control the entire layout
        self.setMinimumSize(719, 768)
        self.setWindowTitle('Rig UI')
        
        self.combo_box_index = pm.getAttr("Global_control.controller_visibility_status")
        self.ikfk_status = uifun.read_initial_values()
        print self.ikfk_status
        
        self.switch_button_label = QLabel(self)
        self.switch_button_label.setGeometry(QRect(280, 40, 151, 20))
        self.switch_button_label.setText("Switch controllers")
        self.switch_button_label.setAlignment(Qt.AlignCenter)
        self.switch_font = QFont()
        self.switch_font.setPointSize(10)
        self.switch_font.setUnderline(True)
        self.switch_button_label.setFont(self.switch_font)
        
        self.l_frame = QFrame(self)
        self.l_frame.setGeometry(QRect(30, 50, 181, 81))
        self.l_frame.setFrameShape(QFrame.StyledPanel)
        self.l_frame.setFrameShadow(QFrame.Raised)
        
        self.l_arm_fk_push_button = QPushButton(self.l_frame)
        self.l_arm_fk_push_button.setGeometry(QRect(10, 10, 75, 23))
        self.l_arm_fk_push_button.setText("Left arm FK")
        self.l_arm_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.l_arm_slider, "FK"))
        self.l_arm_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_arm", mode = "fk"))
        
        
        self.l_leg_fk_push_button = QPushButton(self.l_frame)
        self.l_leg_fk_push_button.setGeometry(QRect(10, 50, 75, 23))
        self.l_leg_fk_push_button.setText("Left leg FK")
        self.l_leg_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.l_leg_slider, "FK"))
        self.l_leg_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_leg", mode = "fk"))
        
        self.l_arm_ik_push_button = QPushButton(self.l_frame)
        self.l_arm_ik_push_button.setGeometry(QRect(100, 10, 75, 23))
        self.l_arm_ik_push_button.setText("Left arm IK")
        self.l_arm_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.l_arm_slider, "IK"))
        self.l_arm_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_arm", mode = "ik"))
        
        self.l_leg_ik_push_button = QPushButton(self.l_frame)
        self.l_leg_ik_push_button.setGeometry(QRect(100, 50, 75, 23))
        self.l_leg_ik_push_button.setText("Left leg IK")
        self.l_leg_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.l_leg_slider, "IK"))
        self.l_leg_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_leg", mode = "ik"))
        

        self.r_frame = QFrame(self)
        self.r_frame.setGeometry(QRect(510, 50, 181, 81))
        self.r_frame.setFrameShape(QFrame.StyledPanel)
        self.r_frame.setFrameShadow(QFrame.Raised)
        
        self.r_arm_fk_push_button = QPushButton(self.r_frame)
        self.r_arm_fk_push_button.setGeometry(QRect(10, 10, 75, 23))
        self.r_arm_fk_push_button.setText("Right arm FK")
        self.r_arm_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.r_arm_slider, "FK"))
        self.r_arm_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_arm", mode = "fk"))
        
        self.r_leg_fk_push_button = QPushButton(self.r_frame)
        self.r_leg_fk_push_button.setGeometry(QRect(10, 50, 75, 23))
        self.r_leg_fk_push_button.setText("Right leg FK")
        self.r_leg_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.r_leg_slider, "FK"))
        self.r_leg_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_leg", mode = "fk"))
        
        self.r_arm_ik_push_button = QPushButton(self.r_frame)
        self.r_arm_ik_push_button.setGeometry(QRect(100, 10, 75, 23))
        self.r_arm_ik_push_button.setText("Right arm IK")
        self.r_arm_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.r_arm_slider, "IK"))
        self.r_arm_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_arm", mode = "ik"))
        
        self.r_leg_ik_push_button = QPushButton(self.r_frame)
        self.r_leg_ik_push_button.setGeometry(QRect(100, 50, 75, 23))
        self.r_leg_ik_push_button.setText("Right leg IK")
        self.r_leg_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.r_leg_slider, "IK"))
        self.r_leg_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_leg", mode = "ik"))
        
        self.arm_fk_push_button = QPushButton(self)
        self.arm_fk_push_button.setGeometry(QRect(280, 70, 75, 23))
        self.arm_fk_push_button.setText("Arm FK")
        self.arm_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.l_arm_slider, "FK"))
        self.arm_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.r_arm_slider, "FK"))
        self.arm_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_arm", mode = "fk"))
        self.arm_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_arm", mode = "fk"))
        
        self.arm_ik_push_button = QPushButton(self)
        self.arm_ik_push_button.setGeometry(QRect(360, 70, 75, 23))
        self.arm_ik_push_button.setText("Arm IK")
        self.arm_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.l_arm_slider, "IK"))
        self.arm_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.r_arm_slider, "IK"))
        self.arm_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_arm", mode = "ik"))
        self.arm_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_arm", mode = "ik"))
        
        self.leg_fk_push_button = QPushButton(self)
        self.leg_fk_push_button.setGeometry(QRect(280, 100, 75, 23))
        self.leg_fk_push_button.setText("Leg FK")
        self.leg_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.l_leg_slider, "FK"))
        self.leg_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.r_leg_slider, "FK"))
        self.leg_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_leg", mode = "fk"))
        self.leg_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_leg", mode = "fk"))
        
        self.leg_ik_push_button = QPushButton(self)
        self.leg_ik_push_button.setGeometry(QRect(360, 100, 75, 23))
        self.leg_ik_push_button.setText("Leg IK")
        self.leg_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.l_leg_slider, "IK"))
        self.leg_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.r_leg_slider, "IK"))
        self.leg_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_leg", mode = "ik"))
        self.leg_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_leg", mode = "ik"))
        
        self.list_label = QLabel(self)
        self.list_label.setGeometry(QRect(10, 170, 261, 20))
        self.list_label.setText("Controllers list")
        self.list_label.setAlignment(Qt.AlignCenter)
        self.list_font = QFont()
        self.list_font.setPointSize(10)
        self.list_font.setUnderline(True)
        self.list_label.setFont(self.list_font)
        
        self.list_widget = QListWidget(self)
        self.list_widget.setGeometry(QRect(10, 200, 256, 371))
        uifun.append_controller_list(self.list_widget)
        self.list_widget.itemClicked.connect(lambda: uifun.select_controller(self.list_widget))
        
        self.blend_label = QLabel(self)
        self.blend_label.setGeometry(QRect(280, 170, 191, 20))
        self.blend_label.setText("Blend controllers")
        self.blend_label.setAlignment(Qt.AlignCenter)
        self.blend_font = QFont()
        self.blend_font.setPointSize(10)
        self.blend_font.setUnderline(True)
        self.blend_label.setFont(self.blend_font)
        
        
        self.blend_frame = QFrame(self)
        self.blend_frame.setGeometry(QRect(280, 200, 191, 371))
        self.blend_frame.setFrameShape(QFrame.StyledPanel)
        self.blend_frame.setFrameShadow(QFrame.Raised)
        
        self.blend_fk_label = QLabel(self.blend_frame)
        self.blend_fk_label.setGeometry(QRect(10, 40, 16, 16))
        self.blend_fk_label.setText("FK")
        blend_fk_font = QFont()
        blend_fk_font.setPointSize(10)
        self.blend_fk_label.setFont(blend_fk_font)
        
        self.blend_ik_label = QLabel(self.blend_frame)
        self.blend_ik_label.setGeometry(QRect(160, 40, 16, 16))
        self.blend_ik_label.setText("IK")
        blend_ik_font = QFont()
        blend_ik_font.setPointSize(10)
        self.blend_ik_label.setFont(blend_ik_font)
        
        self.l_arm_slider_label = QLabel(self.blend_frame)
        self.l_arm_slider_label.setText("Left Arm")
        self.l_arm_slider_label.setGeometry(QRect(70, 40, 46, 16))
        self.l_arm_slider_label.setAlignment(Qt.AlignCenter)
        self.l_arm_slider = QSlider(self.blend_frame)
        self.l_arm_slider.setGeometry(QRect(10, 70, 171, 19))
        self.l_arm_slider.setOrientation(Qt.Horizontal)
        self.l_arm_slider.setMaximum(100)
        self.l_arm_slider_display = QLineEdit(self.blend_frame)
        self.l_arm_slider_display.setGeometry(QRect(80, 90, 30, 20))
        self.l_arm_slider_display.setText("0")
        self.l_arm_slider_display.setAlignment(Qt.AlignCenter)
        self.l_arm_slider.valueChanged.connect(lambda :uifun.slider_value_change(self.l_arm_slider, self.l_arm_slider_display, "l_arm_ikfk"))
        self.l_arm_slider_display.returnPressed.connect(lambda: uifun.slider_text_change(self.l_arm_slider_display, self.l_arm_slider))
        self.l_arm_slider.valueChanged.connect(lambda: uifun.set_controller(joints_list = "left_arm", slider_object = self.l_arm_slider))
        
        
        self.r_arm_slider_label = QLabel(self.blend_frame)
        self.r_arm_slider_label.setText("Right Arm")
        self.r_arm_slider_label.setGeometry(QRect(70, 130, 48, 16))
        self.r_arm_slider_label.setAlignment(Qt.AlignCenter)
        self.r_arm_slider = QSlider(self.blend_frame)
        self.r_arm_slider.setGeometry(QRect(10, 150, 171, 19))
        self.r_arm_slider.setOrientation(Qt.Horizontal)
        self.r_arm_slider.setMaximum(100)
        self.r_arm_slider_display = QLineEdit(self.blend_frame)
        self.r_arm_slider_display.setGeometry(QRect(80, 170, 30, 20))
        self.r_arm_slider_display.setText("0")
        self.r_arm_slider_display.setAlignment(Qt.AlignCenter)
        self.r_arm_slider.valueChanged.connect(lambda :uifun.slider_value_change(self.r_arm_slider, self.r_arm_slider_display, "r_arm_ikfk"))
        self.r_arm_slider_display.returnPressed.connect(lambda: uifun.slider_text_change(self.r_arm_slider_display, self.r_arm_slider))
        self.r_arm_slider.valueChanged.connect(lambda: uifun.set_controller(joints_list = "right_arm", slider_object = self.r_arm_slider))
        
        self.l_leg_slider_label = QLabel(self.blend_frame)
        self.l_leg_slider_label.setText("Left Leg")
        self.l_leg_slider_label.setGeometry(QRect(70, 210, 46, 16))
        self.l_leg_slider_label.setAlignment(Qt.AlignCenter)        
        self.l_leg_slider = QSlider(self.blend_frame)
        self.l_leg_slider.setGeometry(QRect(10, 230, 171, 19))
        self.l_leg_slider.setOrientation(Qt.Horizontal)
        self.l_leg_slider.setMaximum(100)
        self.l_leg_slider_display = QLineEdit(self.blend_frame)
        self.l_leg_slider_display.setGeometry(QRect(80, 250, 30, 20))
        self.l_leg_slider_display.setText("0")
        self.l_leg_slider_display.setAlignment(Qt.AlignCenter)
        self.l_leg_slider.valueChanged.connect(lambda :uifun.slider_value_change(self.l_leg_slider, self.l_leg_slider_display, "l_leg_ikfk"))
        self.l_leg_slider_display.returnPressed.connect(lambda: uifun.slider_text_change(self.l_leg_slider_display, self.l_leg_slider))
        self.l_leg_slider.valueChanged.connect(lambda: uifun.set_controller(joints_list = "left_leg", slider_object = self.l_leg_slider))
        
        self.r_leg_slider_label = QLabel(self.blend_frame)
        self.r_leg_slider_label.setText("Right Leg")
        self.r_leg_slider_label.setGeometry(QRect(70, 290, 46, 16))
        self.r_leg_slider_label.setAlignment(Qt.AlignCenter) 
        self.r_leg_slider = QSlider(self.blend_frame)
        self.r_leg_slider.setGeometry(QRect(10, 310, 171, 19))
        self.r_leg_slider.setOrientation(Qt.Horizontal)
        self.r_leg_slider.setMaximum(100)
        self.r_leg_slider_display = QLineEdit(self.blend_frame)
        self.r_leg_slider_display.setGeometry(QRect(80, 330, 30, 20))
        self.r_leg_slider_display.setText("0")
        self.r_leg_slider_display.setAlignment(Qt.AlignCenter)
        self.r_leg_slider.valueChanged.connect(lambda :uifun.slider_value_change(self.r_leg_slider, self.r_leg_slider_display, "r_leg_ikfk"))
        self.r_leg_slider_display.returnPressed.connect(lambda: uifun.slider_text_change(self.r_leg_slider_display, self.r_leg_slider))
        self.r_leg_slider.valueChanged.connect(lambda: uifun.set_controller(joints_list = "right_leg", slider_object = self.r_leg_slider))
        
        self.switch_all_fk_push_button = QPushButton(self)
        self.switch_all_fk_push_button.setGeometry(QRect(500, 170, 201, 23))
        self.switch_all_fk_push_button.setText("Switch all to FK")
        self.switch_all_fk_push_button.clicked.connect(lambda: uifun.switch_button(self.all_control_blend_slider, "FK"))
        self.switch_all_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_arm", mode = "fk"))
        self.switch_all_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_arm", mode = "fk"))
        self.switch_all_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_leg", mode = "fk"))
        self.switch_all_fk_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_leg", mode = "fk"))
        self.switch_all_fk_push_button.clicked.connect(lambda: uifun.set_controller(slider_object = self.all_control_blend_slider, controller = "FK", joints_list = "all"))

        self.switch_all_ik_push_button = QPushButton(self)
        self.switch_all_ik_push_button.setGeometry(QRect(500, 200, 201, 23))
        self.switch_all_ik_push_button.setText("Switch all to IK")
        self.switch_all_ik_push_button.clicked.connect(lambda: uifun.switch_button(self.all_control_blend_slider, "IK"))
        self.switch_all_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_arm", mode = "ik"))
        self.switch_all_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_arm", mode = "ik"))
        self.switch_all_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "left_leg", mode = "ik"))
        self.switch_all_ik_push_button.clicked.connect(lambda: uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part = "right_leg", mode = "ik"))
        self.switch_all_ik_push_button.clicked.connect(lambda: uifun.set_controller(slider_object = self.all_control_blend_slider, controller = "IK", joints_list = "all"))

        self.all_control_blend = QLabel(self)
        self.all_control_blend.setGeometry(QRect(550, 260, 111, 20))
        self.all_control_blend_font = QFont()
        self.all_control_blend_font.setPointSize(9)
        self.all_control_blend_font.setUnderline(True)
        self.all_control_blend.setFont(self.all_control_blend_font)
        self.all_control_blend.setText("All control blend")

        self.all_control_blend_fk = QLabel(self)
        self.all_control_blend_fk.setGeometry(QRect(520, 280, 16, 16))
        self.all_control_blend_fk_font = QFont()
        self.all_control_blend_fk_font.setPointSize(10)
        self.all_control_blend_fk.setFont(self.all_control_blend_fk_font)
        self.all_control_blend_fk.setText("FK")
        self.all_control_blend_ik = QLabel(self)
        self.all_control_blend_ik.setGeometry(QRect(680, 280, 16, 16))
        self.all_control_blend_ik_font = QFont()
        self.all_control_blend_ik_font.setPointSize(10)
        self.all_control_blend_ik.setFont(self.all_control_blend_ik_font)
        self.all_control_blend_ik.setText("IK")
        self.all_control_blend_slider = QSlider(self)
        self.all_control_blend_slider.setGeometry(QRect(520, 300, 171, 19))
        self.all_control_blend_slider.setOrientation(Qt.Horizontal)
        self.all_control_blend_slider.setMaximum(100)
        self.all_control_blend_slider_display = QLineEdit(self)
        self.all_control_blend_slider_display.setGeometry(QRect(590, 320, 30, 20))

        self.all_control_blend_slider_display.setAlignment(Qt.AlignCenter)
        self.all_control_blend_slider_display.setText("0")
        self.all_control_blend_slider.valueChanged.connect(lambda :uifun.full_blend_slider_change(self.all_control_blend_slider, self.l_arm_slider))
        self.all_control_blend_slider.valueChanged.connect(lambda :uifun.full_blend_slider_change(self.all_control_blend_slider, self.r_arm_slider))
        self.all_control_blend_slider.valueChanged.connect(lambda :uifun.full_blend_slider_change(self.all_control_blend_slider, self.l_leg_slider))
        self.all_control_blend_slider.valueChanged.connect(lambda :uifun.full_blend_slider_change(self.all_control_blend_slider, self.r_leg_slider))
        self.all_control_blend_slider.valueChanged.connect(lambda :uifun.slider_value_change(self.all_control_blend_slider, self.all_control_blend_slider_display, "all_blend_ikfk"))
        self.all_control_blend_slider_display.returnPressed.connect(lambda: uifun.slider_text_change(self.all_control_blend_slider_display, self.all_control_blend_slider))

        self.snap_fk_ik_label = QLabel(self)
        self.snap_fk_ik_label.setGeometry(QRect(515, 380, 161, 20))
        self.snap_fk_ik_label_font = QFont()
        self.snap_fk_ik_label_font.setPointSize(10)
        self.snap_fk_ik_label_font.setUnderline(True)
        self.snap_fk_ik_label.setFont(self.snap_fk_ik_label_font)
        self.snap_fk_ik_label.setAlignment(Qt.AlignCenter)
        self.snap_fk_ik_label.setText("Snap FK to IK position")
        
        self.l_arm_fk_ik_push_button = QPushButton(self)
        self.l_arm_fk_ik_push_button.setGeometry(QRect(500, 410, 95, 23))
        self.l_arm_fk_ik_push_button.setText("Left Arm Fk to IK")
        self.l_arm_fk_ik_push_button.clicked.connect(lambda: uifun.snap_controllers(joint_list = "left_arm", snap_control = "fk_to_ik"))
        
        self.r_arm_fk_ik_push_button = QPushButton(self)
        self.r_arm_fk_ik_push_button.setGeometry(QRect(600, 410, 95, 23))
        self.r_arm_fk_ik_push_button.setText("Right Arm Fk to IK")
        self.r_arm_fk_ik_push_button.clicked.connect(lambda: uifun.snap_controllers(joint_list = "right_arm", snap_control = "fk_to_ik"))
        
        self.l_leg_fk_ik_push_button = QPushButton(self)
        self.l_leg_fk_ik_push_button.setGeometry(QRect(500, 440, 95, 23))
        self.l_leg_fk_ik_push_button.setText("Left Leg Fk to IK")
        self.l_leg_fk_ik_push_button.clicked.connect(lambda: uifun.snap_controllers(joint_list = "left_leg", snap_control = "fk_to_ik"))
        
        self.r_leg_fk_ik_push_button = QPushButton(self)
        self.r_leg_fk_ik_push_button.setGeometry(QRect(600, 440, 95, 23))
        self.r_leg_fk_ik_push_button.setText("Right Leg Fk to IK")
        self.r_leg_fk_ik_push_button.clicked.connect(lambda: uifun.snap_controllers(joint_list = "right_leg", snap_control = "fk_to_ik"))

        self.snap_ik_fk_label = QLabel(self)
        self.snap_ik_fk_label.setGeometry(QRect(520, 470, 161, 20))
        self.snap_ik_fk_label_font = QFont()
        self.snap_ik_fk_label_font.setPointSize(10)
        self.snap_ik_fk_label_font.setUnderline(True)
        self.snap_ik_fk_label.setFont(self.snap_ik_fk_label_font)
        self.snap_ik_fk_label.setAlignment(Qt.AlignCenter)
        self.snap_ik_fk_label.setText("Snap IK to FK position")

        self.l_arm_ik_fk_push_button = QPushButton(self)
        self.l_arm_ik_fk_push_button.setGeometry(QRect(495, 500, 100, 23))
        self.l_arm_ik_fk_push_button.setText("Left Arm IK to FK")
        self.l_arm_ik_fk_push_button.clicked.connect(lambda: uifun.snap_controllers(joint_list = "left_arm", snap_control = "ik_to_fk"))

        self.r_arm_ik_fk_push_button = QPushButton(self)
        self.r_arm_ik_fk_push_button.setGeometry(QRect(600, 500, 100, 23))
        self.r_arm_ik_fk_push_button.setText("Right Arm IK to FK")
        self.r_arm_ik_fk_push_button.clicked.connect(lambda: uifun.snap_controllers(joint_list = "right_arm", snap_control = "ik_to_fk"))

        self.l_leg_ik_fk_push_button = QPushButton(self)
        self.l_leg_ik_fk_push_button.setGeometry(QRect(495, 530, 100, 23))
        self.l_leg_ik_fk_push_button.setText("Left Leg IK to FK")
        self.l_leg_ik_fk_push_button.clicked.connect(lambda: uifun.snap_controllers(joint_list = "left_leg", snap_control = "ik_to_fk"))

        self.r_leg_ik_fk_push_button = QPushButton(self)
        self.r_leg_ik_fk_push_button.setGeometry(QRect(600, 530, 100, 23))
        self.r_leg_ik_fk_push_button.setText("Right Leg IK to FK")
        self.r_leg_ik_fk_push_button.clicked.connect(lambda: uifun.snap_controllers(joint_list = "right_leg", snap_control = "ik_to_fk"))

        self.reveal_control_combo_box = QComboBox(self)
        self.reveal_control_combo_box.setGeometry(QRect(250, 10, 211, 22))
        self.reveal_control_combo_box.setObjectName("comboBox")
        self.reveal_control_combo_box.addItem("Reveal switched controllers")
        self.reveal_control_combo_box.addItem("Reveal all FK controllers")
        self.reveal_control_combo_box.addItem("Reveal all IK controllers")
        self.reveal_control_combo_box.addItem("Reveal all FK controllers only")
        self.reveal_control_combo_box.addItem("Reveal all IK controllers only")
        self.reveal_control_combo_box.addItem("Reveal all controllers")
        self.reveal_control_combo_box.addItem("Hide all controllers")
        self.reveal_control_combo_box.setCurrentIndex(self.combo_box_index)
        self.reveal_control_combo_box.currentIndexChanged.connect(lambda :uifun.reveal_controllers(combo_object = self.reveal_control_combo_box, part=None, mode=None))
        
        self.h_line = QFrame(self)
        self.h_line.setGeometry(QRect(-10, 580, 731, 16))
        self.h_line.setFrameShape(QFrame.HLine)
        self.h_line.setFrameShadow(QFrame.Sunken)
        
        self.v_line = QFrame(self)
        self.v_line.setGeometry(QRect(443, 620, 20, 151))
        self.v_line.setFrameShape(QFrame.VLine)
        self.v_line.setFrameShadow(QFrame.Sunken)
        
        self.key_controller_label = QLabel(self)
        self.key_controller_label.setGeometry(QRect(10, 590, 441, 31))
        self.key_controllers_font = QFont()
        self.key_controllers_font.setPointSize(13)
        self.key_controllers_font.setUnderline(True)
        self.key_controller_label.setFont(self.key_controllers_font)
        self.key_controller_label.setAlignment(Qt.AlignCenter)
        self.key_controller_label.setText("Key controllers")
        
        self.key_ikfk_label = QLabel(self)
        self.key_ikfk_label.setGeometry(QRect(460, 590, 261, 31))
        self.key_ikfk_label_font = QFont()
        self.key_ikfk_label_font.setPointSize(13)
        self.key_ikfk_label_font.setUnderline(True)
        self.key_ikfk_label.setFont(self.key_ikfk_label_font)
        self.key_ikfk_label.setAlignment(Qt.AlignCenter)
        self.key_ikfk_label.setText("Key IK/FK Blend/Switch")
        
        self.key_current_selection_push_button = QPushButton(self)
        self.key_current_selection_push_button.setGeometry(QRect(160, 630, 121, 31))
        self.key_current_selection_push_button.setText("Current selection")
        self.key_current_selection_push_button.clicked.connect(lambda: uifun.set_key(mode = "SELECTION"))
        
        self.key_l_arm_fk_push_button = QPushButton(self)
        self.key_l_arm_fk_push_button.setGeometry(QRect(10, 670, 91, 31))
        self.key_l_arm_fk_push_button.setText("L Arm FK")
        self.key_l_arm_fk_push_button.clicked.connect(lambda: uifun.set_key(mode = "FK", side = "left", part = "arm"))
        
        self.key_l_arm_ik_push_button = QPushButton(self)
        self.key_l_arm_ik_push_button.setGeometry(QRect(110, 670, 91, 31))
        self.key_l_arm_ik_push_button.setText("L Arm IK")
        self.key_l_arm_ik_push_button.clicked.connect(lambda: uifun.set_key(mode = "IK", side = "left", part = "arm"))
        
        self.key_l_leg_fk_push_button = QPushButton(self)
        self.key_l_leg_fk_push_button.setGeometry(QRect(10, 710, 91, 31))
        self.key_l_leg_fk_push_button.setText("L Leg FK")
        self.key_l_leg_fk_push_button.clicked.connect(lambda: uifun.set_key(mode = "FK", side = "left", part = "leg"))
        
        self.key_l_leg_ik_push_button = QPushButton(self)
        self.key_l_leg_ik_push_button.setGeometry(QRect(110, 710, 91, 31))
        self.key_l_leg_ik_push_button.setText("L Leg IK")
        self.key_l_leg_ik_push_button.clicked.connect(lambda: uifun.set_key(mode = "IK", side = "left", part = "leg"))
        
        self.key_r_arm_fk_push_button = QPushButton(self)
        self.key_r_arm_fk_push_button.setGeometry(QRect(230, 670, 91, 31))
        self.key_r_arm_fk_push_button.setText("R Arm FK")
        self.key_r_arm_fk_push_button.clicked.connect(lambda: uifun.set_key(mode = "FK", side = "right", part = "arm"))
        
        self.key_r_arm_ik_push_button = QPushButton(self)
        self.key_r_arm_ik_push_button.setGeometry(QRect(330, 670, 91, 31))
        self.key_r_arm_ik_push_button.setText("R Arm IK")
        self.key_r_arm_ik_push_button.clicked.connect(lambda: uifun.set_key(mode = "IK", side = "right", part = "arm"))
        
        self.key_r_leg_fk_push_button = QPushButton(self)
        self.key_r_leg_fk_push_button.setGeometry(QRect(230, 710, 91, 31))
        self.key_r_leg_fk_push_button.setText("R Leg FK")
        self.key_r_leg_fk_push_button.clicked.connect(lambda: uifun.set_key(mode = "FK", side = "right", part = "leg"))
        
        self.key_r_leg_ik_push_button = QPushButton(self)
        self.key_r_leg_ik_push_button.setGeometry(QRect(330, 710, 91, 31))
        self.key_r_leg_ik_push_button.setText("R Leg IK")
        self.key_r_leg_ik_push_button.clicked.connect(lambda: uifun.set_key(mode = "IK", side = "right", part = "leg"))
        
        
        self.key_l_arm_ikfk_blend_push_button = QPushButton(self)
        self.key_l_arm_ikfk_blend_push_button.setGeometry(QRect(500, 670, 91, 31))
        self.key_l_arm_ikfk_blend_push_button.setText("L Arm IK/FK")
        self.key_l_arm_ikfk_blend_push_button.clicked.connect(lambda: pm.setKeyframe("Global_control.l_arm_ikfk"))
        
        self.key_r_arm_ikfk_blend_push_button = QPushButton(self)
        self.key_r_arm_ikfk_blend_push_button.setGeometry(QRect(600, 670, 91, 31))
        self.key_r_arm_ikfk_blend_push_button.setText("R Arm IK/FK")
        self.key_r_arm_ikfk_blend_push_button.clicked.connect(lambda: pm.setKeyframe("Global_control.r_arm_ikfk"))
        
        self.key_l_leg_ikfk_blend_push_button = QPushButton(self)
        self.key_l_leg_ikfk_blend_push_button.setGeometry(QRect(500, 710, 91, 31))
        self.key_l_leg_ikfk_blend_push_button.setText("L Leg IK/FK")
        self.key_l_leg_ikfk_blend_push_button.clicked.connect(lambda: pm.setKeyframe("Global_control.l_leg_ikfk"))
        
        self.key_r_leg_ikfk_blend_push_button = QPushButton(self)
        self.key_r_leg_ikfk_blend_push_button.setGeometry(QRect(600, 710, 91, 31))
        self.key_r_leg_ikfk_blend_push_button.setText("R Leg IK/FK")
        self.key_r_leg_ikfk_blend_push_button.clicked.connect(lambda: pm.setKeyframe("Global_control.r_leg_ikfk"))
             
        self.key_all_ikfk_blend_push_button = QPushButton(self)
        self.key_all_ikfk_blend_push_button.setGeometry(QRect(500, 630, 191, 31))
        self.key_all_ikfk_blend_push_button.setText("All control IK/FK")
        self.key_all_ikfk_blend_push_button.clicked.connect(lambda: pm.setKeyframe("Global_control.all_blend_ikfk"))
        
        
        
        
        self.all_control_blend_slider.setValue(self.ikfk_status[0]*100)
        self.l_arm_slider.setValue(self.ikfk_status[1]*100)
        self.r_arm_slider.setValue(self.ikfk_status[2]*100)
        self.l_leg_slider.setValue(self.ikfk_status[3]*100)
        self.r_leg_slider.setValue(self.ikfk_status[4]*100)