def checkoutLightingFile():
    print("checkoutLightingFile")
    shotPaths = glob.glob(os.path.join(os.environ['SHOTS_DIR'], '*'))
    selections = []
    for sp in shotPaths:
        selections.append(os.path.basename(sp))
    selections.sort()
    answer = hou.ui.selectFromList(selections, message='Select shot file to checkout:', exclusive=True)
    if answer:
        answer = answer[0]
        toCheckout = os.path.join(os.environ['SHOTS_DIR'], selections[answer], 'lighting')

        try:
            destpath = amu.checkout(toCheckout, True)
        except Exception as e:
            if not amu.checkedOutByMe(toCheckout):
                hou.ui.displayMessage('Can Not Checkout: '+str(e))
                return
            else:
                destpath = amu.getCheckoutDest(toCheckout)

        toOpen = os.path.join(destpath, ham.get_filename(toCheckout)+'.hipnc')

        if os.path.exists(toOpen):
            hou.hipFile.load(toOpen)
        else:
            hou.hipFile.clear()
            hou.hipFile.save(toOpen) 
def checkoutLightingFile():
    print("checkoutLightingFile")
    shotPaths = glob.glob(os.path.join(os.environ['SHOTS_DIR'], '*'))
    selections = []
    for sp in shotPaths:
        selections.append(os.path.basename(sp))
    selections.sort()
    answer = hou.ui.selectFromList(selections,
                                   message='Select shot file to checkout:',
                                   exclusive=True)
    if answer:
        answer = answer[0]
        toCheckout = os.path.join(os.environ['SHOTS_DIR'], selections[answer],
                                  'lighting')

        try:
            destpath = amu.checkout(toCheckout, True)
        except Exception as e:
            if not amu.checkedOutByMe(toCheckout):
                hou.ui.displayMessage('Can Not Checkout: ' + str(e))
                return
            else:
                destpath = amu.getCheckoutDest(toCheckout)

        toOpen = os.path.join(destpath,
                              ham.get_filename(toCheckout) + '.hipnc')

        if os.path.exists(toOpen):
            hou.hipFile.load(toOpen)
        else:
            hou.hipFile.clear()
            hou.hipFile.save(toOpen)
 def getFileToOpen(self, destpath):
     toCheckout = self.currentShot.workingDirectory
     toOpen = os.path.join(destpath, ham.get_filename(toCheckout)+'.hipnc')
     return toOpen
示例#4
0
 def getFileToOpen(self, destpath):
     toCheckout = self.currentShot.workingDirectory
     toOpen = os.path.join(destpath,
                           ham.get_filename(toCheckout) + '.hipnc')
     return toOpen