Exemplo n.º 1
0
def stretch_arm_l():
    window = cmds.window(title='Creating...')
    cmds.columnLayout()
    progressControl = cmds.progressBar(maxValue=1, width=300)
    cmds.showWindow(window)
    #Stretch_Arm_L
    import stretch_arm_l
    reload(stretch_arm_l)
    stretch_arm_l.Stretch_Arm_L()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #Stretch_Arm_R
    import stretch_arm_r
    reload(stretch_arm_r)
    stretch_arm_r.Stretch_Arm_R()

    #Scale_Arms
    MDS = ['MD_Scale_MS_Arm_L', 'MD_Scale_MS_Arm_R']

    for MD in MDS:
        Name = MD.split('MS_')[1]
        Mult(MD)
        Distancia = cmds.getAttr('distanceDimension_Stretch_Master_' + Name +
                                 '.distance')
        cmds.setAttr(Node + '.input2X', Distancia)
        Connect('C_mainA_ctl_0.scaleX', Node + '.input1X')
        Connect(Node + '.outputX', 'MD_Stretch_' + Name + '.input2X')
        Connect(Node + '.outputX', 'C_Stretch_' + Name + '.secondTerm')
    cmds.select(cl=True)
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    cmds.deleteUI(window, control=True)
Exemplo n.º 2
0
    def animExport(self, *_):
        cmds.namespace(set=":")
        try:
            startTime = int(self.motionLibLEExportStart.text())
        except:
            cmds.confirmDialog(message=u"无效数值", icon="information")
            return
        try:
            endTime = int(self.motionLibLEExportEnd.text())
        except:
            cmds.confirmDialog(message=u"无效数值", icon="information")
            return
        outFile = self.motionLibLEExportFile.text()
        if not outFile: return
        filePath = self.path + "\\" + outFile + ".anim"

        self.constructProxy()
        self.copyToProxy(startTime, endTime)
        cmds.select(self.grp)

        motionExport = getattr(cmds, "motionExport")
        motionExport(f=filePath, st=startTime, et=endTime)

        self.destructProxy()
        cmds.pause(sec=1)
        self.refreshData()
Exemplo n.º 3
0
def J_killPTTQ():
    envPath=mel.eval('getenv MAYA_LOCATION')+"/resources/l10n/"
    for item in os.walk(envPath):
        for item2 in item[2]:
            if item2.find("animImportExport1.pres.mel")>-1:
                fileO=open((item[0]+"/"+item2),'r')
                fileData=fileO.read().replace('autoUpdatcAttrEnd;','')
                fileO.close()
                fileO=open((item[0]+"/"+item2),'w')
                fileO.writelines(fileData)
                fileO.close()
    selectPath=cmds.internalVar(userWorkspaceDir=True)
    if cmds.optionVar( query= "RecentFilesList")!=0:
        selectPath='/'.join(cmds.optionVar( query= "RecentFilesList")[0].split('/')[0:-1])
    mayaFilePath = cmds.fileDialog2(fileMode=3, caption="open maya file without script",startingDirectory=selectPath)
    if mayaFilePath==None:return
    res=''
    if cmds.confirmDialog( title='做好备份了吗?', message='开始干?', button=['干','待会干'], dismissString='No' ) !=u'\u5e72':
        return
        
    count = 0
    cmds.progressWindow(	title='Doing Nothing',
					progress=count,
					status='running: 0%',
					isInterruptable=True )
    fileCount=0
    for item in os.walk(mayaFilePath[0]):
        fileCount+=len(item[2])
    for item in os.walk(mayaFilePath[0]):
        for i in item[2]:
            count=count+1
            if cmds.progressWindow( query=True, isCancelled=True ) :
                break
            print count
            print '............\n'
            cmds.progressWindow( edit=True, progress=(count*100/fileCount), status=('running: ' + str(count*100/fileCount) + '%' ) )
            cmds.pause( seconds=1 )
            if i.lower().endswith(".mb") or i.lower().endswith(".ma"):    
                mayaFile=(item[0].replace('\\','/')+'/'+i)
                cmds.file(mayaFile,open=True , force=True,ignoreVersion=True,executeScriptNodes=False)    
                allsc=cmds.ls(type ='script')
                pttqExists=False
                for item1 in allsc:
                    if item1.find("MayaMelUIConfigurationFile")>-1:
                        scStr=cmds.getAttr(item1+'.before')       
                        if scStr.find('autoUpdatcAttrEnd;')>-1:pttqExists=True                             
                        cmds.setAttr(item1+'.before',scStr.replace('autoUpdatcAttrEnd;',''),type ='string')
                J_kick_dajiangjun()
                if pttqExists:
                    cmds.file(rename=mayaFile)
                    cmds.file(save=True )  
                    res+=mayaFile+u"——->被感染,已进行清理\n"
                    print (mayaFile+u"——->被感染,已进行清理")
    cmds.progressWindow(endProgress=1)   
    cmds.confirmDialog( title='执行结果', message=res, button=['好'], dismissString='No' ) 
Exemplo n.º 4
0
	def GainTarget_All_for(self):
		tragetBlendShapeIndex=cmds.listAttr(self.BlendShape[0]+'.weight',multi=True)
		amount = 0

		multiple =len(tragetBlendShapeIndex) / 100.0
		x = 0
		if multiple == 0:
			multiple = 1 
		cmds.progressWindow(title= "RevertTarget...",progress= amount,status ="Completed: 0%",isInterruptable =False)
		for i in tragetBlendShapeIndex:
			x += 1
			self.GainTarget_All(i)
			print x
			amount = (x / multiple )
			cmds.progressWindow(edit=True,progress =amount,status =('Complete: ' + str(amount) + '%') )
			cmds.pause( seconds=1 )
		cmds.progressWindow(endProgress=1)
Exemplo n.º 5
0
def Do_QuantituRender_zwz():
    listNum = len(fixFrameList_zwz)
    if listNum:
        inFiles = []
        FileTypeNum = []
        for i in range(listNum):
            inFiles.append(fixFrameList_zwz[i][0])
        for tmp in set(inFiles):
            temp = []
            for j in range(listNum):
                if fixFrameList_zwz[j][0] == tmp:
                    temp.append(j)
            FileTypeNum.append(temp)
        if len(FileTypeNum) != 1:
            mc.confirmDialog(title=u'温馨提示:',
                             message=u'目前只支持单个文件补帧渲染',
                             button=['OK'],
                             defaultButton='Yes',
                             dismissString='No')
            return
        if not mc.pluginInfo('Mayatomr.mll', query=True, loaded=True):
            mc.loadPlugin('Mayatomr.mll')
        for each in FileTypeNum:
            inAddress = fixFrameList_zwz[each[0]][0]
            mc.file(f=True, new=True)
            myaddress = inAddress
            myScenesAddress = '/'.join(inAddress.split('\\')[:-2])
            mm.eval('setProject "%s";' % myScenesAddress)
            mc.file(r"%s" % myaddress, force=True, open=True)
            mc.pause(sec=3)
            for eachL in each:
                mc.textScrollList('allMyAddress', e=True, sii=eachL + 2)
                lsRenderlist_zwz('allMyAddress')
                RenderV = QuantituRender_zwz(eachL)
                if RenderV is False:
                    return
                else:
                    pass
    else:
        mc.confirmDialog(title=u'温馨提示:',
                         message=u'空列表!',
                         button=['OK'],
                         defaultButton='Yes',
                         dismissString='No')
Exemplo n.º 6
0
 def creatPropGeoCacheSelect(self, *args):
     num = self.selectProp()
     try:
         count = len(num)
         j = 0
         amount = 0
         # self.core.progressBarWin( count )
         mc.progressWindow(title="Export caches", progress=amount, status="Starting", isInterruptable=1)
         for i in num:
             if mc.progressWindow(q=1, isCancelled=1):
                 break
             amount = (j + 1) * 100 / count
             mc.progressWindow(e=1, progress=amount, status=("Exporting: " + ` amount ` + "%"))
             mc.pause(seconds=0)
             # mc.progressBar(self.core.progressControl, edit=True, step=1.0)
             self.doCreateGeoCache(int(i))
             j += 1
         # self.core.close()
         mc.progressWindow(endProgress=1)
     except:
         pass
Exemplo n.º 7
0
def Twists_Arms():
    window = cmds.window(title='Creating...')
    cmds.columnLayout()
    progressControl = cmds.progressBar(maxValue=1, width=300)
    cmds.showWindow(window)
    #TWIST_ARM_L
    import Twist_Arm_L
    reload(Twist_Arm_L)
    Twist_Arm_L.Twist_Arm_L()
    #TWIST_ARM_R
    import Twist_Arm_R
    reload(Twist_Arm_R)
    Twist_Arm_R.Twist_Arm_R()
    cmds.group(n='Twist_Arms', em=True)
    cmds.parent('Twists_Arm_L', 'Twist_Arms')
    cmds.parent('Twists_Arm_R', 'Twist_Arms')
    cmds.parent('Twist_Arms', 'hidden')
    cmds.select(cl=True)
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    cmds.deleteUI(window, control=True)
Exemplo n.º 8
0
def RemoveNamespace():
    nameSpaces = cmds.namespaceInfo(lon=True)

    for name in ['UI', 'shared']:
        nameSpaces.remove(name)

    cmds.progressWindow(title=u"进度", status=u"清理中...")

    while nameSpaces:
        cmds.progressWindow(e=True, progress=0, max=len(nameSpaces))
        for name in nameSpaces:
            cmds.namespace(mergeNamespaceWithRoot=True, removeNamespace=name)
            cmds.progressWindow(e=True, step=1)
        cmds.namespace(setNamespace=":")
        nameSpaces = cmds.namespaceInfo(lon=True)
        for name in ['UI', 'shared']:
            nameSpaces.remove(name)

    cmds.pause(sec=1)
    cmds.progressWindow(endProgress=1)
    cmds.confirmDialog(title=u'完成',
                       message=u'NameSpace已清理完毕',
                       button=['OK'],
                       defaultButton='OK')
Exemplo n.º 9
0
def J_exportCamera(outType='fbx'):
    selectPath=cmds.internalVar(userWorkspaceDir=True)
    if cmds.optionVar( query= "RecentFilesList")!=0:
        selectPath='/'.join(cmds.optionVar( query= "RecentFilesList")[0].split('/')[0:-1])
    mayaFilePath = cmds.fileDialog2(fileMode=3, caption="open maya file without script",startingDirectory=selectPath)
    if mayaFilePath==None:return
    res=''
    message=''
    bakeFrame=False
    if cmds.confirmDialog( title='到摄像机要烘焙关键帧么?', message='到摄像机要烘焙关键帧么?', button=['要','雅蠛蝶'], dismissString='No' ) ==u'\u8981':
        bakeFrame=True
        
    count = 0
    cmds.progressWindow(title='Doing Nothing',
                    progress=count,
                    status='running: 0%',
                    isInterruptable=True )
    fileCount=0
    for item in os.walk(mayaFilePath[0]):
        for i in item[2]:
            if i.lower().endswith(".mb") or i.lower().endswith(".ma"):
                fileCount+=1
    for item in os.walk(mayaFilePath[0]):
        for i in item[2]:
            count=count+1
            if cmds.progressWindow( query=True, isCancelled=True ) :
                break
            cmds.progressWindow( edit=True, progress=(count*100/fileCount), status=('running: ' + str(count*100/fileCount) + '%' ) )
            cmds.pause( seconds=3 )
            if i.lower().endswith(".mb") or i.lower().endswith(".ma"):    
                mayaFile=(item[0].replace('\\','/')+'/'+i)
                cmds.file(mayaFile,open=True , force=True,ignoreVersion=True,executeScriptNodes=True,o=1, prompt=0)    
                J_excuteExport(mayaFile,outType,bakeFrame)

    cmds.progressWindow(endProgress=1)   
    cmds.confirmDialog( title='执行结果', message="导出完成", button=['好'], dismissString='No' )
Exemplo n.º 10
0
def Bendys():
    window = cmds.window(title='Creating...')
    cmds.columnLayout()
    progressControl = cmds.progressBar(maxValue=1, width=300)
    cmds.showWindow(window)
    #RIBBON_LEG_L
    import ribbon_leg_l
    reload(ribbon_leg_l)
    ribbon_leg_l.Ribbon_Leg_L()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #RIBBON_LEG_R
    import ribbon_leg_r
    reload(ribbon_leg_r)
    ribbon_leg_r.Ribbon_Leg_R()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #Herarchy_Bendys#
    import herarchy_Bendy_Leg
    reload(herarchy_Bendy_Leg)
    herarchy_Bendy_Leg.Herarchy()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    cmds.deleteUI(window, control=True)
        #make sure the deleted file doesn't already exist
        if os.path.isfile(deletedShelfName):
            os.remove(shelfName)
            continue
        os.rename(shelfName,deletedShelfName)

#get environment file
envFile = os.path.join(envDir, 'Maya.env')
#find template environment file
thisFile = inspect.getframeinfo(inspect.currentframe()).filename
templateDir = os.path.dirname(os.path.abspath(thisFile))
templateFile = os.path.join(templateDir, 'Maya.env')
#copy and replace file
shutil.copy(templateFile, envFile)
cmds.headsUpMessage( '    MAYA EXPLOSION IN...    ')
cmds.pause(sec=3)
cmds.headsUpMessage( '    5    ')
cmds.pause(sec=1) 
cmds.headsUpMessage( '    4    ')
cmds.pause(sec=1) 
cmds.headsUpMessage( '    3    ')
cmds.pause(sec=1) 
cmds.headsUpMessage( '    2    ')
cmds.pause(sec=1) 
cmds.headsUpMessage( '    farewell world...    ')
cmds.pause(sec=1) 
#exit maya
cmds.quit(f=True)
#restarting right away doesn't work

Exemplo n.º 12
0
def QuantituRender_zwz(eachL):
    try:
        mc.deleteUI("hyperShadePanel1Window")
    except:
        pass
    #for eachL in fileLists:
    #读取工程目录名字
    inPlayoption = fixFrameList_zwz[eachL][4]
    inshowoption = fixFrameList_zwz[eachL][5]
    mayaversions = mc.about(v=True)
    if mayaversions.find('2009') >= 0:
        tmp = mc.workspace("images", query=True, renderTypeEntry=True)
    else:
        tmp = mc.workspace("images", query=True, fileRuleEntry=True)
    fullPath = mc.workspace(expandName=tmp)
    FramePadding = mc.getAttr("defaultRenderGlobals.extensionPadding")
    try:
        mm.eval("RenderViewWindow;")
    except:
        pass
    mm.eval('setNamedPanelLayout "Single Perspective View"; updateToolbox();')
    myactivePlane = ''
    i = 1
    while (i):
        try:
            tmp = mc.modelEditor('modelPanel%d' % i, q=True, av=True)
        except:
            pass
        else:
            if tmp:
                myactivePlane = 'modelPanel%d' % i
                break
        i += 1
    if inshowoption == 1:
        mc.modelEditor(myactivePlane, e=True, allObjects=False)

    mc.setAttr("defaultRenderGlobals.imageFilePrefix",
               "<Scene>/<RenderLayer>/<Camera>/<Camera>",
               type="string")
    #读取渲染层,摄像机
    myAllCameras = []
    myOkCameras = []
    AllCameras = mc.listCameras(p=True)
    temp = fixFrameList_zwz[eachL][2]
    tempG = temp.split(' ')
    for tmp in tempG:
        if tmp:
            myAllCameras.append(tmp)
    for each in myAllCameras:
        if each in AllCameras:
            myOkCameras.append(each)

    myOkLayer = ''
    myLayer = u'%s' % fixFrameList_zwz[eachL][1]
    myLayer = myLayer.strip()
    if myLayer == 'masterLayer':
        myOkLayer = 'defaultRenderLayer'
    else:
        allLayers = mc.listConnections('renderLayerManager.renderLayerId')
        if myLayer in allLayers:
            myOkLayer = myLayer
    #读取渲染帧数组:

    temp = mc.getAttr('defaultRenderGlobals.currentRenderer')
    mc.setAttr('defaultRenderGlobals.currentRenderer', temp, type='string')

    #设置渲染为当前层
    currentRenderLayer = mc.editRenderLayerGlobals(query=True,
                                                   currentRenderLayer=True)
    if currentRenderLayer != myOkLayer:
        mc.editRenderLayerGlobals(currentRenderLayer=myLayer)
    StartFrame = EndFrame = 0
    StartFrame = int(mc.getAttr("defaultRenderGlobals.startFrame"))
    EndFrame = int(mc.getAttr("defaultRenderGlobals.endFrame"))
    mc.currentTime(StartFrame, update=True)
    mc.pause(sec=3)

    LayerType = mc.getAttr('defaultRenderGlobals.currentRenderer')
    if LayerType.find('vray') >= 0 or LayerType.find('arnold') >= 0:
        sys.stdout.write('%s can`t Render;\n' % LayerType)
        return

    imagePath = mc.renderSettings(firstImageName=True)[0]
    Layerpath = imagePath.split('/')
    myLayerName = '/'.join(Layerpath[:2])
    mytypeName = imagePath.split('.')[-1]
    mytypeV = 0
    if mytypeName.find('iff') >= 0:
        mytypeV = 1
    elif mytypeName.find('tif') >= 0:
        mytypeV = 2
    elif mytypeName.find('png') >= 0:
        mytypeV = 3

    myOkFrames = fixFrameList_zwz[eachL][3]
    lenOkFreames = len(myOkFrames)
    mc.progressWindow(title=u'渲染层:%s' % myOkLayer,
                      progress=0,
                      status=u'即将开始',
                      min=0,
                      max=lenOkFreames,
                      isInterruptable=True)
    i = 0
    for myFrames in myOkFrames:
        i += 1
        if str(type(myFrames)).find('int') >= 0:
            StartFrame = myFrames
            EndFrame = myFrames
        else:
            myListFrames = myFrames.split('-')
            StartFrame = int(myListFrames[0])
            EndFrame = int(myListFrames[1])
        while (StartFrame < EndFrame + 1):
            mc.currentTime(StartFrame, update=True)
            for myCamera in myOkCameras:
                finallyPath = (fullPath + '/' + myLayerName + '/%s/%s.' %
                               (myCamera, myCamera) +
                               str(StartFrame).zfill(FramePadding) + '.' +
                               mytypeName)
                if inPlayoption == 1:
                    mc.lookThru(myCamera, myactivePlane)
                    mc.currentTime(StartFrame, update=True)
                mm.eval('updateModelPanelBar %s;' % myactivePlane)
                mm.eval('renderWindowRenderCamera render renderView "%s";' %
                        myCamera)
                mc.progressWindow(edit=True,
                                  progress=i,
                                  status=u"帧数包:\" %s \"  第  %s  帧  \n摄像机:%s" %
                                  (myFrames, StartFrame, myCamera))
                if mc.progressWindow(q=True,
                                     isCancelled=True) or mc.progressWindow(
                                         q=True, progress=True) > EndFrame + 1:
                    mc.progressWindow(endProgress=True)
                    return False
                mc.setAttr('defaultRenderGlobals.imfkey', "", type="string")
                if mc.file(finallyPath, q=True, exists=True):
                    mc.sysFile(finallyPath, delete=True)
                if mytypeV == 1:
                    mm.eval(
                        'renderWindowSaveImageCallback "renderView" "%s" "Maya IFF";'
                        % finallyPath)
                elif mytypeV == 2:
                    mm.eval(
                        'renderWindowSaveImageCallback "renderView" "%s" "Tiff";'
                        % finallyPath)
                elif mytypeV == 3:
                    mm.eval(
                        'renderWindowSaveImageCallback "renderView" "%s" "PNG";'
                        % finallyPath)
                sys.stdout.write(
                    "RenerLayer: %s  / Camera: %s  / Frame: %s\n" %
                    (myOkLayer, myCamera, StartFrame))
            StartFrame += 1
    mc.progressWindow(endProgress=True)
    return True
Exemplo n.º 13
0
def QuantituRender_zwz():
    inPlayoption = int(
        mc.textScrollList('myplayoptions', q=True, selectItem=True)[0])
    inshowoption = int(
        mc.textScrollList('myshowoptions', q=True, selectItem=True)[0])
    mc.setAttr("defaultRenderGlobals.imageFilePrefix",
               "<Scene>/<RenderLayer>/<Camera>/<Camera>",
               type="string")
    allLayers = mc.listConnections('renderLayerManager.renderLayerId')
    myAllLayers = []
    AllCameras = []
    if allLayers:
        for Layer in allLayers:
            if mc.getAttr('%s.renderable' % Layer):
                myAllLayers.append(Layer)
    AllCameras = mc.listCameras(p=True)
    tmp = mc.workspace("images", query=True, renderTypeEntry=True)
    fullPath = mc.workspace(expandName=tmp)
    FramePadding = mc.getAttr("defaultRenderGlobals.extensionPadding")
    try:
        mm.eval("RenderViewWindow;")
    except:
        pass
    mm.eval('setNamedPanelLayout "Single Perspective View"; updateToolbox();')
    activePlane = ''
    i = 1
    while (i):
        try:
            tmp = mc.modelEditor('modelPanel%d' % i, q=True, av=True)
        except:
            pass
        else:
            if tmp:
                activePlane = 'modelPanel%d' % i
                break
        i += 1
    if inshowoption == 1:
        mc.modelEditor(activePlane, e=True, allObjects=0)
    temp = mc.getAttr('defaultRenderGlobals.currentRenderer')
    mc.setAttr('defaultRenderGlobals.currentRenderer', temp, type='string')
    for myLayer in myAllLayers:
        mc.editRenderLayerGlobals(currentRenderLayer=myLayer)
        StartFrame = EndFrame = 0
        StartFrame = int(mc.getAttr("defaultRenderGlobals.startFrame"))
        EndFrame = int(mc.getAttr("defaultRenderGlobals.endFrame"))
        mc.currentTime(StartFrame, update=True)
        mc.pause(sec=3)
        LayerType = mc.getAttr('defaultRenderGlobals.currentRenderer')
        if LayerType.find('vray') >= 0 or LayerType.find('arnold') >= 0:
            sys.stdout.write('%s can`t Render;\n' % LayerType)
            continue
        currentRenderLayer = mc.editRenderLayerGlobals(query=True,
                                                       currentRenderLayer=True)
        if currentRenderLayer != myLayer:
            mc.editRenderLayerGlobals(currentRenderLayer=myLayer)
        myAllCameras = []
        CameraShape = ''
        if AllCameras:
            for Camera in AllCameras:
                try:
                    CameraShape = mc.listRelatives(Camera, s=True)[0]
                except:
                    pass
                else:
                    if mc.getAttr('%s.renderable' % CameraShape):
                        myAllCameras.append(Camera)
        mc.progressWindow(title=u'批渲染器',
                          progress=0,
                          status=u'即将开始',
                          min=StartFrame,
                          max=EndFrame,
                          isInterruptable=True)
        imagePath = mc.renderSettings(firstImageName=True)[0]
        Layerpath = imagePath.split('/')
        myLayerName = '/'.join(Layerpath[:2])
        mytypeName = imagePath.split('.')[-1]
        mytypeV = 0
        if mytypeName.find('iff') >= 0:
            mytypeV = 1
        elif mytypeName.find('tif') >= 0:
            mytypeV = 2
        elif mytypeName.find('png') >= 0:
            mytypeV = 3
        for i in xrange(StartFrame, EndFrame + 1):
            mc.currentTime(StartFrame, update=True)
            mc.progressWindow(edit=True,
                              progress=i,
                              status="RenerLayer: %s  / Frame: %s" %
                              (myLayer, i))
            for myCamera in myAllCameras:
                finallyPath = (fullPath + '/' + myLayerName + '/%s/%s.' %
                               (myCamera, myCamera) +
                               str(i).zfill(FramePadding) + '.' + mytypeName)
                if inPlayoption == 1:
                    mc.lookThru(myCamera, myactivePlane)
                    mc.currentTime(StartFrame, update=True)
                mm.eval('updateModelPanelBar %s;' % activePlane)
                #mm.eval('RenderIntoNewWindow;')
                mm.eval('renderWindowRenderCamera render renderView "%s";' %
                        myCamera)
                if mc.progressWindow(q=True,
                                     isCancelled=True) or mc.progressWindow(
                                         q=True, progress=True) > EndFrame + 1:
                    mc.progressWindow(endProgress=True)
                    return False
                mc.setAttr('defaultRenderGlobals.imfkey', "", type="string")
                if mc.file(finallyPath, q=True, exists=True):
                    mc.sysFile(finallyPath, delete=True)
                if mytypeV == 1:
                    mm.eval(
                        'renderWindowSaveImageCallback "renderView" "%s" "Maya IFF";'
                        % finallyPath)
                elif mytypeV == 2:
                    mm.eval(
                        'renderWindowSaveImageCallback "renderView" "%s" "Tiff";'
                        % finallyPath)
                elif mytypeV == 3:
                    mm.eval(
                        'renderWindowSaveImageCallback "renderView" "%s" "PNG";'
                        % finallyPath)
                print "RenerLayer: %s  / Frame: %s" % (myLayer, i)
        mc.progressWindow(endProgress=True)
    return True
Exemplo n.º 14
0
def doPlayBlast():
    format = mc.optionMenu('formatOM', q=True, v=True)
    _coding = mc.optionMenu('coding', q=True, v=True)
    _quality = mc.intSliderGrp('qualityIS', q=True, v=True)
    sizeMode = mc.optionMenu('sizeOM', q=True, sl=True)
    scale = mc.floatSliderGrp('scaleFS', q=True, v=True)
    sizeX = mc.intField('sizeX', q=True, v=True)
    sizeY = mc.intField('sizeY', q=True, v=True)
    fPadding = mc.intSliderGrp('framePaddingIS', q=True, v=True)
    oPath = mc.textFieldButtonGrp('outputDir', q=True, fileName=True)

    allCam = mc.listCameras(p=True)
    playCam = []
    del playCam[:]
    for eachCam in allCam:
        if mc.checkBox(eachCam, q=True, v=True):
            playCam.append(eachCam)

    if oPath == '' and not os.path.isdir(oPath):
        mc.confirmDialog(m='Please input Save Dir.')
        return

    if len(playCam) == 0:
        mc.confirmDialog(m='Please select least one camera')
        return

    gMainPane = mm.eval('global string $gMainPane;\n$temp = $gMainPane;')
    activePanel = ''
    allPanel = mc.paneLayout(gMainPane, q=True, ca=True)
    for eachPanel in allPanel:
        panelName = mc.getPanel(containing=eachPanel)
        if not panelName == '':
            if mc.getPanel(to=panelName) == 'modelPanel':
                if not mc.control(eachPanel, q=True, io=True):
                    if mc.modelEditor(panelName, q=True, av=True):
                        activePanel = panelName
                        break

    if activePanel == '':
        mc.confirmDialog(
            m='Please active one ModelPanel \nthen re-click PlayBlast Button')
        return

    if sizeMode == 2:
        sizeX = mc.getAttr('defaultResolution.width')
        sizeY = mc.getAttr('defaultResolution.height')
    elif sizeMode == 3:
        sizeX = 0
        sizeY = 0

    _widthHeight = [sizeX, sizeY]

    _percent = scale * 100
    amount = 0
    count = len(playCam)
    per = 100 / count
    finish = 0

    mc.progressWindow(t='PlayBlast Status',
                      progress=amount,
                      status=('Finished:0/%d' % count),
                      isInterruptable=True)
    for num, eachCam in enumerate(playCam):
        mc.lookThru(eachCam, activePanel)
        # camName = string.replace(eachCam, ':', '_')
        eachFinalCam = eachCam.split(':')[-1]
        fullName = os.path.join(oPath, eachFinalCam)
        if num == 0:
            mm.eval('source buildDisplayMenu.mel')
            v1 = mc.optionVar(q='selectDetailsVisibility')
            v2 = mc.optionVar(q='objectDetailsVisibility')
            v3 = mc.optionVar(q='particleCountVisibility')
            v4 = mc.optionVar(q='polyCountVisibility')
            v5 = mc.optionVar(q='subdDetailsVisibility')
            v6 = mc.optionVar(q='animationDetailsVisibility')
            v7 = mc.optionVar(q='hikDetailsVisibility')
            v8 = mc.optionVar(q='frameRateVisibility')
            v9 = mc.optionVar(q='currentFrameVisibility')
            v10 = mc.optionVar(q='sceneTimecodeVisibility')
            v11 = mc.optionVar(q='currentContainerVisibility')
            v12 = mc.optionVar(q='cameraNamesVisibility')
            v13 = mc.optionVar(q='focalLengthVisibility')
            v14 = mc.optionVar(q='viewAxisVisibility')
            v15 = mc.optionVar(q='userNameVisibility')
            mm.eval("setObjectDetailsVisibility 0;")
            mm.eval("setParticleCountVisibility 0;")
            mm.eval("setPolyCountVisibility 0;")
            if mc.isTrue("SubdivUIExists"):
                mm.eval("setSubdDetailsVisibility 0;")
            #mm.eval("setSubdDetailsVisibility 0;")
            mm.eval("setAnimationDetailsVisibility 0;")
            mm.eval("setHikDetailsVisibility 0;")
            mm.eval("setFrameRateVisibility 0;")
            mm.eval("setCurrentFrameVisibility 1;")
            mm.eval("setSceneTimecodeVisibility 1;")
            mm.eval("setCurrentContainerVisibility 0;")
            mm.eval("setCameraNamesVisibility 0;")
            mm.eval("setFocalLengthVisibility 1;")
            mm.eval("setViewAxisVisibility 0;")
            mm.eval("setUserNameVisibility 1;")
            if format == 'avi':
                mc.playblast(format='movie',
                             filename=fullName + '.avi',
                             csd=True,
                             clearCache=False,
                             viewer=False,
                             showOrnaments=True,
                             percent=_percent,
                             quality=_quality,
                             widthHeight=_widthHeight,
                             compression=_coding,
                             fo=True)
            else:
                mc.playblast(format='iff',
                             filename=fullName,
                             clearCache=False,
                             viewer=False,
                             showOrnaments=True,
                             percent=_percent,
                             quality=_quality,
                             widthHeight=_widthHeight,
                             compression='jpg',
                             fp=fPadding,
                             fo=True)
            mm.eval("setSelectDetailsVisibility %s;" % v1)
            mm.eval("setObjectDetailsVisibility %s;" % v2)
            mm.eval("setParticleCountVisibility %s;" % v3)
            mm.eval("setPolyCountVisibility %s;" % v4)
            if mc.isTrue("SubdivUIExists"):
                mm.eval("setSubdDetailsVisibility %s;" % v5)
            #mm.eval("setSubdDetailsVisibility %s;" % v5)
            mm.eval("setAnimationDetailsVisibility %s;" % v6)
            mm.eval("setHikDetailsVisibility %s;" % v7)
            mm.eval("setFrameRateVisibility %s;" % v8)
            mm.eval("setCurrentFrameVisibility %s;" % v9)
            mm.eval("setSceneTimecodeVisibility %s;" % v10)
            mm.eval("setCurrentContainerVisibility %s;" % v11)
            mm.eval("setCameraNamesVisibility %s;" % v12)
            mm.eval("setFocalLengthVisibility %s;" % v13)
            mm.eval("setViewAxisVisibility %s;" % v14)
            mm.eval("setUserNameVisibility %s;" % v15)
        else:
            if format == 'avi':
                mc.playblast(format='movie',
                             filename=fullName + '.avi',
                             clearCache=False,
                             viewer=False,
                             showOrnaments=False,
                             percent=_percent,
                             quality=_quality,
                             widthHeight=_widthHeight,
                             compression=_coding,
                             fo=True)
            else:
                mc.playblast(format='iff',
                             filename=fullName,
                             clearCache=False,
                             viewer=False,
                             showOrnaments=False,
                             percent=_percent,
                             quality=_quality,
                             widthHeight=_widthHeight,
                             compression='jpg',
                             fp=fPadding,
                             fo=True)
        if mc.progressWindow(q=True, ic=True):
            break
        if mc.progressWindow(q=True, progress=True) >= 100:
            break

        amount += per
        finish += 1

        mc.progressWindow(e=True,
                          progress=amount,
                          status=('Finished:%d/%d' % (finish, count)))
        mc.pause(seconds=0.2)

    mc.progressWindow(e=True, progress=100)
    mc.progressWindow(endProgress=1)
Exemplo n.º 15
0
def Base_Rig():
    window = cmds.window(title='Creating...')
    cmds.columnLayout()
    progressControl = cmds.progressBar(maxValue=8, width=300)
    cmds.showWindow(window)
    #ARM_L
    import arm_l
    reload(arm_l)
    arm_l.Arm_L()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #ARM_R
    import arm_r
    reload(arm_r)
    arm_r.Arm_R()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #HAND_L
    import hand_l
    reload(hand_l)
    hand_l.Hand_L()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #Attrs_Hand_L
    import Attr_Hand_L
    reload(Attr_Hand_L)
    Attr_Hand_L.Attrs_Hand_L()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #HAND_R
    import hand_r
    reload(hand_r)
    hand_r.Hand_R()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #Attrs_Hand_R
    import Attr_Hand_R
    reload(Attr_Hand_R)
    Attr_Hand_R.Attrs_Hand_R()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #LEG_L
    import leg_l
    reload(leg_l)
    leg_l.Leg_L()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #FOOT_L
    import foot_l
    reload(foot_l)
    foot_l.Foot_L()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #LEG_R
    import leg_r
    reload(leg_r)
    leg_r.Leg_R()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #FOOT_R
    import foot_r
    reload(foot_r)
    foot_r.Foot_R()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    #SPINE
    import spine
    reload(spine)
    spine.Spine_Create()
    cmds.progressBar(progressControl, edit=True, step=1)
    #HERARCHY
    import herarchy
    reload(herarchy)
    herarchy.HERARCHY()
    cmds.progressBar(progressControl, edit=True, step=1)
    cmds.pause(sec=0)
    cmds.deleteUI(window, control=True)
Exemplo n.º 16
0
def creativeTarget_Clone(TargetGeo,SourceGeo):
	listConnect=[]
	listConnect_target=[]
	listConnect_get=[]
	SourceOrigList=[]

	blendShapeGrp = cmds.createNode('transform',name=SourceGeo+'_blendShape')
	SourceBlendShape=blendShapeNode(TargetGeo)[0]

	listTargetBlendShape=cmds.listAttr(SourceBlendShape+'.weight',multi=True)
	listShpae  = cmds.listHistory(SourceGeo) 

	for i in listTargetBlendShape:
		targetConnect = cmds.listConnections(SourceBlendShape+'.'+i,p=True,s=True,d=False)
		if targetConnect != None:	
			for m in targetConnect:				
				cmds.disconnectAttr(m,SourceBlendShape+'.'+i)
			listConnect.append(m)
			listConnect_target.append(i)
		else:
			get =i + '>' +str(cmds.getAttr(SourceBlendShape+"."+i))
			listConnect_get.append(get)
		cmds.setAttr(SourceBlendShape+"."+i,0)


	cmds.blendShape(SourceGeo,exclusive = 'deformPartition#',frontOfChain=True,name=SourceGeo+'BlendShape')

	cmds.select(SourceGeo)
	cmds.select(TargetGeo,add=True)	
	CreateWrap = "CreateWrap;"
	mel.eval(CreateWrap)

	SourceOrigList = meshOrig(SourceGeo)
	amount = 0
	multiple =len(listTargetBlendShape) / 100.0
	xi = 0
	if multiple == 0:
		multiple = 1 

	cmds.progressWindow(title= "Clone...",progress= amount,status ="Completed: 0%",isInterruptable =False)

	for x in listTargetBlendShape:
		if listTargetBlendShape.__contains__(x) != 1 or  'weight[' in x:		
			continue
		xi +=1
		tragetIndexItem = InputTargetGroup(SourceBlendShape,x) 
		inputTargetItem = cmds.getAttr(SourceBlendShape+'.inputTarget[0].inputTargetGroup[%d].inputTargetItem' %tragetIndexItem,mi=True)
		for c in inputTargetItem:
			indexInt = (int(c)-5000)/1000.0

			Mesh = cmds.createNode('mesh',name = x+'_Shape')
			MeshMian = cmds.createNode('mesh',name = x+'_MianShape')

			cmds.sets(Mesh,edit=True,forceElement='initialShadingGroup')	
			listRel = cmds.listRelatives(Mesh,p=True)
			MianlistRel = cmds.listRelatives(MeshMian,p=True)

			cmds.setAttr(SourceBlendShape+'.'+x,indexInt)
			cmds.connectAttr(listShpae[0]+'.outMesh',MeshMian+''+'.inMesh')

			cmds.connectAttr(SourceOrigList[0]+'.outMesh',Mesh+''+'.inMesh')
			copyMesh=cmds.duplicate(Mesh)

			vertex = cmds.polyEvaluate(MeshMian,vertex=True)
			int(vertex)
			for v in range(vertex) :
				ployPosition=cmds.pointPosition(MeshMian +'.vtx[%d]' %v,w =True)
				cmds.move(ployPosition[0],ployPosition[1],ployPosition[2],copyMesh[0]+'.vtx[%d]' %v)

			count=str(indexInt).split(".")
			if count[0] == '-0':
				ne = 'm'
			else:
				ne = 'p'

			if float(indexInt) == 1:
				targetName = x 
			else:
				targetName = x+'_'+ str(tragetIndexItem) + '_' + ne + count[1]
			cmds.parent(copyMesh,blendShapeGrp)
			ToName = cmds.rename(copyMesh,targetName)
			cmds.addAttr(ToName, longName =x,at ='double')
			cmds.setAttr(ToName+'.'+x ,float(indexInt))

			cmds.setAttr(SourceBlendShape+'.'+x,0)
			cmds.delete(listRel,MianlistRel)
			if float(indexInt) == 1:

				cmds.blendShape(SourceGeo+'BlendShape',edit=True,tc = False,target= (SourceGeo,xi,ToName,1.0))
			else:

				cmds.blendShape(SourceGeo+'BlendShape',edit=True,ib = True,tc = False, target= (SourceGeo,xi,ToName,float(indexInt)))
			print xi
		amount = (xi / multiple )
		cmds.progressWindow(edit=True,progress =amount,status =('Complete: ' + str(amount) + '%') )
		cmds.pause( seconds=1 )
	cmds.progressWindow(endProgress=1)
		
	SourceGeoHistory =cmds.listHistory(SourceGeo)
	for i in SourceGeoHistory:
		try:
			if cmds.nodeType(i) == 'wrap' :	
				cmds.delete(i)
		except RuntimeError: 
			print 'No wrap deformable .'

	for i in range(len(listConnect)):
		cmds.connectAttr(listConnect[i],SourceBlendShape+'.'+listConnect_target[i])
		cmds.connectAttr(listConnect[i],SourceGeo+'BlendShape'+'.'+listConnect_target[i])

	for i in listConnect_get:
		listConnect_wt = i.split('>')
		cmds.setAttr(SourceBlendShape+'.'+listConnect_wt[0],float(listConnect_wt[1]))
		cmds.setAttr(SourceGeo+'BlendShape'+'.'+listConnect_wt[0],float(listConnect_wt[1]))
Exemplo n.º 17
0
def vp_w2sConvert(selVex,selCtr):

	Base_GeoNm = selVex[0].split('.')
	
	Base_GeoSkn = vp_SknFrmGeo(Base_GeoNm[0])
	#print Base_GeoSkn
	
	if(Base_GeoSkn == None):
		if cmds.objExists('vp_hold'):
			cmds.delete('vp_hold')
		cmds.select(cl=1)
		cmds.joint(n='vp_hold')
		cmds.select(Base_GeoNm[0],add=1)
		cmds.SmoothBindSkin()
		Base_GeoSkn = vp_SknFrmGeo(Base_GeoNm[0])
		
	vp_holdAllJnt(Base_GeoSkn, onOff=0)
	jntNam = []
	
	for i in range (0,len(selCtr)):
		cmds.select (cl=1)
		jntNam.append (cmds.joint(n=selCtr[i]+'_jnt'))
		tmp_grp = cmds.group (n=selCtr[i]+'_jnt_Grp')
		cmds.delete(cmds.parentConstraint(selCtr[i],tmp_grp))
		cmds.select(Base_GeoNm[0])
		cmds.skinCluster(e=1,dr=4,lw=0,wt=0,ai=jntNam[i])
		
	amount = 0
	amountPlus = 100/len(selCtr)
	
	cmds.progressWindow (title = 'Converting 2 Skin',
				progress = amount,
				status = 'Converting : 0%',
				isInterruptable = True)
				
	for i in range (0,len(selCtr)):
		for j in range (0,len(selVex)):
		
			if cmds.progressWindow(query=True, isCancelled=True):
				break
				
			originalPos = cmds.xform(selVex[j], q=1, wd=1, t=1)
			cmds.setAttr(selCtr[i] + '.tz', -1)
			
			deformPos = cmds.xform(selVex[j], q=1, wd=1, t=1)
			cmds.setAttr(selCtr[i] + '.tz', 0)
			
			difference = [ deformPos[0]-originalPos[0], deformPos[1]-originalPos[1], deformPos[2]-originalPos[2] ]
			wtValue = math.sqrt (pow(difference[0] ,2) + pow(difference[1] ,2) + pow(difference[2] ,2))
			
			cmds.skinPercent (Base_GeoSkn,selVex[j], nrm=1, tv=[jntNam[i],wtValue])
		
		if cmds.progressWindow(query=1, progress = 1) == len(selCtr):
			break
			
		amount += amountPlus
		cmds.progressWindow ( edit=1, progress=amount, status=('converted : ' + `amount` + '%'))
		cmds.pause(seconds=1)
		
	cmds.progressWindow(endProgress=1)
	mel.eval('print "--------------> Converted";')