Exemplo n.º 1
0
def glBlast(name, startFrame, endFrame):
    mc.setAttr('defaultHardwareRenderGlobals.filename', name, type="string")
    #image settings
    mc.setAttr('defaultHardwareRenderGlobals.startFrame', startFrame)
    mc.setAttr('defaultHardwareRenderGlobals.endFrame', endFrame)
    mc.setAttr('defaultHardwareRenderGlobals.extension', 4)
    mc.setAttr('defaultHardwareRenderGlobals.imageFormat', 8)
    mc.setAttr('defaultHardwareRenderGlobals.fullImageResolution', 1)
    mc.setAttr('defaultHardwareRenderGlobals.resolution',
               'HD576 1024 576 1.778',
               type='string')
    mc.setAttr('defaultHardwareRenderGlobals.backgroundColor',
               0.5,
               0.5,
               0.5,
               type='double3')
    #motion blur
    mc.setAttr('defaultHardwareRenderGlobals.edgeSmoothing', 1)
    mc.setAttr('defaultHardwareRenderGlobals.lineSmoothing', 1)
    mc.setAttr('defaultHardwareRenderGlobals.multiPassRendering', 1)
    mc.setAttr('defaultHardwareRenderGlobals.renderPasses', 5)
    mc.setAttr('defaultHardwareRenderGlobals.antiAliasPolygons', 1)
    mc.setAttr('defaultHardwareRenderGlobals.motionBlur', 0.5)
    mc.setAttr('defaultHardwareRenderGlobals.backgroundColor',
               0.5,
               0.5,
               0.5,
               type='double3')
    #lighting
    mc.setAttr('defaultHardwareRenderGlobals.lightingMode', 1)
    mc.setAttr('defaultHardwareRenderGlobals.drawStyle', 3)
    mc.setAttr('defaultHardwareRenderGlobals.texturing', 1)

    currentPanel = mc.getPanel(wf=True)
    currentCamera = mc.modelEditor(currentPanel, q=True, camera=True)

    #=========================BROKEN RIGHT NOW=========================
    glWindow = mc.window()
    mc.paneLayout()
    mc.glRenderEditor(lookThru=currentCamera)
    mc.showWindow(glWindow)
    # mc.glRender(glWindow, renderSequence=True)
    #=========================BROKEN RIGHT NOW=========================

    print "playblast saved here: " + name + ".mov"

    mc.confirmDialog(title='Error',
                     message='Doesn\'t work yet!',
                     button=['Ok'],
                     defaultButton='Ok',
                     cancelButton='Ok',
                     dismissString='Ok')
def AnimposeCreateWindow(sel_obj):
    alltab  = mc.tabLayout('tabs',q=1,st=1)
    if mc.window ('AnimposeCreateWindow',q=True,exists =1):
        mc.deleteUI ('AnimposeCreateWindow')
        
    AnimposeCreateWindow=mc.window('AnimposeCreateWindow',menuBar=True, title="AnimPoseCreate",width=302,h=100)
    poseLibCaptureCamera='poseLibCaptureCamera'
    
    mc.columnLayout ()   
    mc.rowLayout('iconCaptureRL',nc=4,cw4=[150,1,1,150])
    captureCamFrame=mc.frameLayout(borderStyle="etchedOut" ,cl=False,cll=False,labelVisible=False,m=True,w=150,h=100) 
    
    if not mc.modelPanel('plCaptureMP',q=1,ex=1):
        mc.modelPanel('plCaptureMP',parent=captureCamFrame,mbv=0,cam=poseLibCaptureCamera)
    else:
        mc.modelPanel('plCaptureMP',e=1,parent=captureCamFrame,mbv=0,cam=poseLibCaptureCamera)
        
    barLayout = mc.modelPanel('plCaptureMP',q=1,barLayout=1)
    if ("" != barLayout and mc.frameLayout(barLayout,q=1,exists=1)):
        mc.frameLayout(barLayout,e=1,collapse=1) 
        mc.control(barLayout,e=1,m=0) 
    modelEditor = mc.modelPanel('plCaptureMP',q=1,me=1)
    mc.modelEditor(modelEditor,e=1,da="smoothShaded",grid=False,hud=False,manipulators=False,displayTextures=True ,ha=0,j=0,dim=0,nc=0,wos=0,dl="default" )
    mc.setParent('..')
    mc.setParent('..')
    mc.frameLayout('glRenderFrame',borderStyle="etchedOut",cl=False,cll=False,m=0,labelVisible=False)
    mc.glRenderEditor('hardwareRenderViewBis')
    mc.setParent ('..')
    mc.frameLayout(borderStyle="etchedIn" ,cl=False,cll=False,labelVisible=False,m=True,w=200,h=100)
    mc.rowLayout(nc=2,cw2=[50,100])
    mc.text(l='   Name :',)
    Anim_name=mc.textField('Anim_name',w=140)
    mc.setParent('..')
    mc.button(l='Create '+alltab[:4],al='center',w=150,c=creation)
    mc.button(l='Cancel',c=partial(animposewinclose))
    mc.setParent('..')
    mc.modelEditor(modelEditor,e=1,camera=poseLibCaptureCamera) 
    mc.setAttr("poseLibCaptureCameraShape.displayFilmGate", 1)
    mc.setAttr("poseLibCaptureCameraShape.verticalFilmAperture",1.1)

    mc.glRenderEditor('hardwareRenderViewBis',e=1,lt=poseLibCaptureCamera) 
    #if not mc.objExists(poseLibCaptureCamera):
       #poseLibCaptureCamera='persp'
        
    mc.showWindow(AnimposeCreateWindow)
    mc.window(AnimposeCreateWindow,e=1,w=300,h=100)
    mc.select(sel_obj)
Exemplo n.º 3
0
def glBlast(name, startFrame, endFrame):
    mc.setAttr("defaultHardwareRenderGlobals.filename", name, type="string")
    # image settings
    mc.setAttr("defaultHardwareRenderGlobals.startFrame", startFrame)
    mc.setAttr("defaultHardwareRenderGlobals.endFrame", endFrame)
    mc.setAttr("defaultHardwareRenderGlobals.extension", 4)
    mc.setAttr("defaultHardwareRenderGlobals.imageFormat", 8)
    mc.setAttr("defaultHardwareRenderGlobals.fullImageResolution", 1)
    mc.setAttr("defaultHardwareRenderGlobals.resolution", "HD576 1024 576 1.778", type="string")
    mc.setAttr("defaultHardwareRenderGlobals.backgroundColor", 0.5, 0.5, 0.5, type="double3")
    # motion blur
    mc.setAttr("defaultHardwareRenderGlobals.edgeSmoothing", 1)
    mc.setAttr("defaultHardwareRenderGlobals.lineSmoothing", 1)
    mc.setAttr("defaultHardwareRenderGlobals.multiPassRendering", 1)
    mc.setAttr("defaultHardwareRenderGlobals.renderPasses", 5)
    mc.setAttr("defaultHardwareRenderGlobals.antiAliasPolygons", 1)
    mc.setAttr("defaultHardwareRenderGlobals.motionBlur", 0.5)
    mc.setAttr("defaultHardwareRenderGlobals.backgroundColor", 0.5, 0.5, 0.5, type="double3")
    # lighting
    mc.setAttr("defaultHardwareRenderGlobals.lightingMode", 1)
    mc.setAttr("defaultHardwareRenderGlobals.drawStyle", 3)
    mc.setAttr("defaultHardwareRenderGlobals.texturing", 1)

    currentPanel = mc.getPanel(wf=True)
    currentCamera = mc.modelEditor(currentPanel, q=True, camera=True)

    # =========================BROKEN RIGHT NOW=========================
    glWindow = mc.window()
    mc.paneLayout()
    mc.glRenderEditor(lookThru=currentCamera)
    mc.showWindow(glWindow)
    # mc.glRender(glWindow, renderSequence=True)
    # =========================BROKEN RIGHT NOW=========================

    print "playblast saved here: " + name + ".mov"

    mc.confirmDialog(
        title="Error",
        message="Doesn't work yet!",
        button=["Ok"],
        defaultButton="Ok",
        cancelButton="Ok",
        dismissString="Ok",
    )
def createIcon():
    frameNumber = mc.currentTime (q=1)
    mc.setAttr("defaultHardwareRenderGlobals.startFrame",l=False)
    mc.setAttr("defaultHardwareRenderGlobals.endFrame",l=False)
    mc.setAttr("defaultHardwareRenderGlobals.byFrame",l=False)

    mc.setAttr("defaultHardwareRenderGlobals.startFrame",frameNumber)
    mc.setAttr("defaultHardwareRenderGlobals.endFrame" ,frameNumber)
    mc.setAttr("defaultHardwareRenderGlobals.extension",1)      
    mc.setAttr("defaultHardwareRenderGlobals.backgroundColor", 0.75 ,0.75 ,0.75,type='double3')
    mc.setAttr("defaultHardwareRenderGlobals.imageFormat",20)

    poseLibCaptureCameraBGColor = ( 0.75,0.75,0.75 )
    poseLibIconsSize = ( 104, 82 )
    poseLibIconsBGColor = (.4, .4, .5)
    
    currentBGColor = mc.displayRGBColor('background',q=1)
    mc.displayRGBColor('background',poseLibCaptureCameraBGColor[0],poseLibCaptureCameraBGColor[1],poseLibCaptureCameraBGColor[2])

    # Here we set the default hardware render globals resolution and aspect ratio.
    mc.setAttr('defaultHardwareRenderGlobals.filename',"iconTmp",type="string")
    mc.setAttr('defaultHardwareRenderGlobals.resolution','104x82 104 82 0',type="string")

    # Do the render.
    

    # Here we resize the gl frame to match the correct render resolution.
    mc.frameLayout('glRenderFrame',e=1,m=1,width=(poseLibIconsSize[0]+2),height=(poseLibIconsSize[1]+2))
    #mc.rowLayout(iconCaptureRL,e=1,cw=[2,106])

    # Look through the poseLib camera we just created.
    mc.glRenderEditor('hardwareRenderViewBis',e=1,lt='poseLibCaptureCamera')

    # Warning: This crashes Maya in certain scenes: 2600/4, or 1402/25, or 702/68.
    #mc.glRender(e=1,cf=frameNumber,accumBufferPasses=4,transformIcons= 0,edgeSmoothness=1.0,aam="gaussian")
    mc.glRender(rs='hardwareRenderViewBis')

    # Put back the background color the way it was.
    mc.displayRGBColor ("background",currentBGColor[0],currentBGColor[1],currentBGColor[2])
    print 'Icon Creation Done...'