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 cameraOrientMoveManip():
    selection = cmds.ls(selection=True)
    if len(selection) == 0: return

    shotCamera = animMod.getShotCamera()
    if not shotCamera or not cmds.objExists(shotCamera):
        cmds.warning("No shot camera detected.")
        return

    cmds.refresh(suspend=True)

    sourceObjs = selection[0:-1]
    targetObj = selection[-1]
    locator = animMod.createNull("tempCameraOrient_locator")
    cameraNode = utilMod.getCamFromSelection([shotCamera])[0]

    G.aToolsBar.align.align([locator], targetObj, translate=True, rotate=False)
    with G.aToolsBar.createAToolsNode:
        constraint = cmds.aimConstraint(cameraNode,
                                        locator,
                                        name="tempCameraOrient_constraint",
                                        aimVector=[0, 0, 1],
                                        worldUpType="objectrotation",
                                        worldUpObject=cameraNode,
                                        maintainOffset=False)[0]

    cmds.select(selection)
    cmds.select(locator, add=True)
    orientMoveManip()

    if cmds.objExists(locator): cmds.delete(locator)
    if cmds.objExists(constraint): cmds.delete(constraint)

    cmds.refresh(suspend=False)
Exemplo n.º 3
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.º 4
0
def cameraOrientMoveManip():
    selection   = cmds.ls(selection=True)    
    if len(selection) == 0: return
    
    shotCamera = animMod.getShotCamera()    
    if not shotCamera or not cmds.objExists(shotCamera): 
        cmds.warning("No shot camera detected.")
        return
    
    cmds.refresh(suspend=True)
    
    sourceObjs      = selection[0:-1]
    targetObj       = selection[-1]    
    locator         = animMod.createNull("tempCameraOrient_locator")
    cameraNode      = utilMod.getCamFromSelection([shotCamera])[0]
        
    G.aToolsBar.align.align([locator], targetObj, translate=True, rotate=False)   
    with G.aToolsBar.createAToolsNode: constraint = cmds.aimConstraint(cameraNode, locator, name="tempCameraOrient_constraint", aimVector=[0, 0, 1], worldUpType="objectrotation", worldUpObject=cameraNode, maintainOffset=False)[0]

    cmds.select(selection)
    cmds.select(locator, add=True)
    orientMoveManip()
  
    if cmds.objExists(locator):         cmds.delete(locator)
    if cmds.objExists(constraint):      cmds.delete(constraint)
    
    cmds.refresh(suspend=False)
Exemplo n.º 5
0
 def populateMenu(self, menu, *args):
                 
     uiMod.clearMenuItems(menu)
     
     cmds.radioMenuItemCollection(parent=menu)
     
     #populate list
     for loopCamera in utilMod.getAllCameras():
         radioSelected = (animMod.getShotCamera() == loopCamera)
         cameraName = cmds.listRelatives(loopCamera, allParents=True)[0]
         cmds.menuItem("menu_%s"%loopCamera, label=str(cameraName), radioButton=radioSelected, parent=menu, command=lambda x, loopCamera=loopCamera, *args: aToolsMod.saveInfoWithScene(STORE_NODE, CAMERA_ATTR, loopCamera))
 
     # last playblast menu
     cmds.menuItem(divider=True, parent=menu)
     checkBoxSelected = aToolsMod.getUserPref("saveAfterPlayblasting", default=True)
     cmds.menuItem("saveAfterPlayblastingMenu", label='Save Maya File After Playblasting', checkBox=checkBoxSelected, command=self.setSaveAfterPlayblastingPref, parent=menu) 
     cmds.menuItem(divider=True, parent=menu)
     cmds.menuItem               (label="Duplicate Selected Camera", command=self.duplicateCamera,   parent=menu)
     cmds.menuItem               (label="Playblast Viewport",        command=self.playblastViewport, parent=menu)
     cmds.menuItem               (label="Play Last Playblast",       command=self.playLastPlayblast, parent=menu)
Exemplo n.º 6
0
    def populateMenu(self, menu, *args):

        uiMod.clearMenuItems(menu)

        cmds.radioMenuItemCollection(parent=menu)

        #populate list
        for loopCamera in utilMod.getAllCameras():
            radioSelected = (animMod.getShotCamera() == loopCamera)
            cameraName = cmds.listRelatives(loopCamera, allParents=True)[0]
            cmds.menuItem(
                "menu_%s" % loopCamera,
                label=str(cameraName),
                radioButton=radioSelected,
                parent=menu,
                command=lambda x, loopCamera=loopCamera, *args: aToolsMod.
                saveInfoWithScene(STORE_NODE, CAMERA_ATTR, loopCamera))

        # last playblast menu
        cmds.menuItem(divider=True, parent=menu)
        checkBoxSelected = aToolsMod.getUserPref("saveAfterPlayblasting",
                                                 default=True)
        cmds.menuItem("saveAfterPlayblastingMenu",
                      label='Save Maya File After Playblasting',
                      checkBox=checkBoxSelected,
                      command=self.setSaveAfterPlayblastingPref,
                      parent=menu)
        cmds.menuItem(divider=True, parent=menu)
        cmds.menuItem(label="Duplicate Selected Camera",
                      command=self.duplicateCamera,
                      parent=menu)
        cmds.menuItem(label="Playblast Viewport",
                      command=self.playblastViewport,
                      parent=menu)
        cmds.menuItem(label="Play Last Playblast",
                      command=self.playLastPlayblast,
                      parent=menu)
Exemplo n.º 7
0
 def playblastCamera(self, *args): 
     camera = animMod.getShotCamera()
     if camera: self.doPlayblast(camera)
Exemplo n.º 8
0
 def __init__(self):
     animMod.getShotCamera()        
     G.playBackSliderPython  = G.playBackSliderPython or mel.eval('$aTools_playBackSliderPython=$gPlayBackSlider')
Exemplo n.º 9
0
 def playblastCamera(self, *args):
     camera = animMod.getShotCamera()
     if camera: self.doPlayblast(camera)
Exemplo n.º 10
0
 def __init__(self):
     animMod.getShotCamera()
     G.playBackSliderPython = G.playBackSliderPython or mel.eval(
         '$aTools_playBackSliderPython=$gPlayBackSlider')