Exemplo n.º 1
1
def setThreePanelLayout():     
    shotCamera = animMod.getShotCamera()
    if not shotCamera: shotCamera = "persp"
    mel.eval("toolboxChangeQuickLayoutButton \"Persp/Graph/Hypergraph\" 2;"+\
             #"ThreeTopSplitViewArrangement;"+\
             "lookThroughModelPanel %s hyperGraphPanel2;"%shotCamera+\
             "lookThroughModelPanel persp modelPanel4;")
             #"scriptedPanel -e -rp modelPanel2 graphEditor1;")
    viewports = [view for view in cmds.getPanel(type='modelPanel') if view in cmds.getPanel(visiblePanels=True)]
    defaultCameras = [u'front', u'persp', u'side', u'top']
    
    for view in viewports:
        camera          = utilMod.getCamFromSelection([cmds.modelEditor(view, query=True, camera=True)])
        cameraTransform = camera[0]
        cameraShape     = camera[1]
    
        if cameraTransform in defaultCameras:
            utilMod.animViewportViewMode(view)
            
            if cameraTransform == "persp":
                cmds.camera(cameraTransform, edit=True, orthographic=False)
                cmds.setAttr("%s.nearClipPlane"%cameraShape, 1000)
                cmds.setAttr("%s.farClipPlane"%cameraShape, 10000000)
                cmds.setAttr("%s.focalLength"%cameraShape, 3500)
        else:
            utilMod.cameraViewMode(view)
            cmds.setAttr("%s.displayFilmGate"%cameraShape, 1)
            cmds.setAttr("%s.overscan"%cameraShape, 1)
Exemplo n.º 2
0
def setThreePanelLayout():
    shotCamera = animMod.getShotCamera()
    if not shotCamera: shotCamera = "persp"
    mel.eval("toolboxChangeQuickLayoutButton \"Persp/Graph/Hypergraph\" 2;"+\
             #"ThreeTopSplitViewArrangement;"+\
             "lookThroughModelPanel %s hyperGraphPanel2;"%shotCamera+\
             "lookThroughModelPanel persp modelPanel4;")
    #"scriptedPanel -e -rp modelPanel2 graphEditor1;")
    viewports = [
        view for view in cmds.getPanel(type='modelPanel')
        if view in cmds.getPanel(visiblePanels=True)
    ]
    defaultCameras = [u'front', u'persp', u'side', u'top']

    for view in viewports:
        camera = utilMod.getCamFromSelection(
            [cmds.modelEditor(view, query=True, camera=True)])
        cameraTransform = camera[0]
        cameraShape = camera[1]

        if cameraTransform in defaultCameras:
            utilMod.animViewportViewMode(view)

            if cameraTransform == "persp":
                cmds.camera(cameraTransform, edit=True, orthographic=False)
                cmds.setAttr("%s.nearClipPlane" % cameraShape, 1000)
                cmds.setAttr("%s.farClipPlane" % cameraShape, 10000000)
                cmds.setAttr("%s.focalLength" % cameraShape, 3500)
        else:
            utilMod.cameraViewMode(view)
            cmds.setAttr("%s.displayFilmGate" % cameraShape, 1)
            cmds.setAttr("%s.overscan" % cameraShape, 1)
Exemplo n.º 3
0
    def doPlayblast(self, camera):
        
        G.TU_movie              = None
        G.TU_audioFile          = None
        G.TU_audioOffsetSec     = None        
        winName                 = 'playblastWindow'
        overscan                = cmds.getAttr("%s.overscan"%camera)   
        audioTrack              = cmds.timeControl(G.playBackSliderPython, query=True, sound=True)
        rangeVisible            = cmds.timeControl(G.playBackSliderPython, query=True, rangeVisible=True )  
        widthHeight             = utilMod.getRenderResolution()  
        
        if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName)
        
        window                  = cmds.window(winName, widthHeight=widthHeight)
        form                    = cmds.formLayout()
        editor                  = cmds.modelEditor()
        column                  = cmds.columnLayout('true')
        
        cmds.formLayout( form, edit=True, attachForm=[(column, 'top', 0), (column, 'left', 0), (editor, 'top', 0), (editor, 'bottom', 0), (editor, 'right', 0)], attachNone=[(column, 'bottom'), (column, 'right')], attachControl=(editor, 'left', 0, column))
        cmds.modelEditor(editor, edit=True, camera=camera, activeView=True)
        cmds.showWindow( window )
        cmds.window( winName, edit=True, topLeftCorner=(0, 0), widthHeight=[200,200])        
        utilMod.cameraViewMode(editor)        
        cmds.setAttr("%s.overscan"%camera, 1)
        
        
        if rangeVisible:
            range = animMod.getTimelineRange(float=False)
            rFrom   = range[0]
            rTo     = range[1]-1
        else:
            rFrom = cmds.playbackOptions(query=True, minTime=True)
            rTo   = cmds.playbackOptions(query=True, maxTime=True)
        

        if G.currentStudio == None:
            G.TU_movie = cmds.playblast(format="qt", sound=audioTrack, startTime=rFrom ,endTime=rTo , viewer=1, showOrnaments=0, offScreen=True, fp=4, percent=50, compression="png", quality=70, widthHeight=widthHeight, clearCache=True)
            
        else:
            
            fps             = mel.eval("currentTimeUnitToFPS") 
            if audioTrack:
                G.TU_audioFile      = cmds.sound(audioTrack, query=True, file=True)
                audioOffset         = cmds.sound(audioTrack, query=True, offset=True)
                G.TU_audioOffsetSec = str((rFrom - audioOffset)/-fps)
                
            movieName       = cmds.playblast(format="image", startTime=rFrom ,endTime=rTo , viewer=0, showOrnaments=0, offScreen=True, fp=4, percent=50, compression="jpg", quality=70, widthHeight=widthHeight, clearCache=True)
            if movieName: 
                G.TU_movie           = "%s.%s-%s#.jpg"%(movieName.split(".")[0], int(rFrom), int(rTo))
                if audioTrack:  G.TU_audioOffsetSec = audioOffset
                self.playMovie(G.TU_movie, G.TU_audioFile, G.TU_audioOffsetSec)
            
        if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName)
        
        cmds.setAttr("%s.overscan"%camera, overscan)
        
        if not G.TU_movie: return
        save = aToolsMod.getUserPref("saveAfterPlayblasting", default=True)
        if save and not rangeVisible: cmds.file(save=True)
Exemplo n.º 4
0
    def doPlayblast(self, camera):

        G.TU_movie = None
        G.TU_audioFile = None
        G.TU_audioOffsetSec = None
        winName = 'playblastWindow'
        overscan = cmds.getAttr("%s.overscan" % camera)
        audioTrack = cmds.timeControl(G.playBackSliderPython,
                                      query=True,
                                      sound=True)
        rangeVisible = cmds.timeControl(G.playBackSliderPython,
                                        query=True,
                                        rangeVisible=True)
        widthHeight = utilMod.getRenderResolution()

        if cmds.window(winName, query=True, exists=True):
            cmds.deleteUI(winName)

        window = cmds.window(winName, widthHeight=widthHeight)
        form = cmds.formLayout()
        editor = cmds.modelEditor()
        column = cmds.columnLayout('true')

        cmds.formLayout(form,
                        edit=True,
                        attachForm=[(column, 'top', 0), (column, 'left', 0),
                                    (editor, 'top', 0), (editor, 'bottom', 0),
                                    (editor, 'right', 0)],
                        attachNone=[(column, 'bottom'), (column, 'right')],
                        attachControl=(editor, 'left', 0, column))
        cmds.modelEditor(editor, edit=True, camera=camera, activeView=True)
        cmds.showWindow(window)
        cmds.window(winName,
                    edit=True,
                    topLeftCorner=(0, 0),
                    widthHeight=[200, 200])
        utilMod.cameraViewMode(editor)
        cmds.setAttr("%s.overscan" % camera, 1)

        if rangeVisible:
            range = animMod.getTimelineRange(float=False)
            rFrom = range[0]
            rTo = range[1] - 1
        else:
            rFrom = cmds.playbackOptions(query=True, minTime=True)
            rTo = cmds.playbackOptions(query=True, maxTime=True)

        if G.currentStudio == None:
            G.TU_movie = cmds.playblast(format="qt",
                                        sound=audioTrack,
                                        startTime=rFrom,
                                        endTime=rTo,
                                        viewer=1,
                                        showOrnaments=0,
                                        offScreen=True,
                                        fp=4,
                                        percent=50,
                                        compression="png",
                                        quality=70,
                                        widthHeight=widthHeight,
                                        clearCache=True)

        else:

            fps = mel.eval("currentTimeUnitToFPS")
            if audioTrack:
                G.TU_audioFile = cmds.sound(audioTrack, query=True, file=True)
                audioOffset = cmds.sound(audioTrack, query=True, offset=True)
                G.TU_audioOffsetSec = str((rFrom - audioOffset) / -fps)

            movieName = cmds.playblast(format="image",
                                       startTime=rFrom,
                                       endTime=rTo,
                                       viewer=0,
                                       showOrnaments=0,
                                       offScreen=True,
                                       fp=4,
                                       percent=50,
                                       compression="jpg",
                                       quality=70,
                                       widthHeight=widthHeight,
                                       clearCache=True)
            if movieName:
                G.TU_movie = "%s.%s-%s#.jpg" % (movieName.split(".")[0],
                                                int(rFrom), int(rTo))
                if audioTrack: G.TU_audioOffsetSec = audioOffset
                self.playMovie(G.TU_movie, G.TU_audioFile, G.TU_audioOffsetSec)

        if cmds.window(winName, query=True, exists=True):
            cmds.deleteUI(winName)

        cmds.setAttr("%s.overscan" % camera, overscan)

        if not G.TU_movie: return
        save = aToolsMod.getUserPref("saveAfterPlayblasting", default=True)
        if save and not rangeVisible: cmds.file(save=True)