コード例 #1
0
    def __init__(self, parent=None):
        super(CheckoutShotDialog, self).__init__(parent)
        self.ui = Ui_CheckoutShotDialog()
        self.ui.setupUi(self)

        # setup events
        self.ui.rdbFxFile.clicked.connect(self.fxButton_Click)
        self.ui.rdbLightingFile.clicked.connect(self.lightingButton_Click)
        self.ui.btnUnlock.clicked.connect(self.unlock_Click)
        self.ui.lwShots.currentItemChanged.connect(
            self.shotList_ItemSelectionChange)

        # intialize member variables
        self.currentShotType = 'lighting'
        self.currentShot = None

        # populate shots
        self.populateShots()
        item = self.ui.lwShots.currentItem()
        if item != None:
            name = str(item.text())
            self.setShot(name)
コード例 #2
0
    def __init__(self,parent=None):
        super(CheckoutShotDialog, self).__init__(parent)
        self.ui = Ui_CheckoutShotDialog()
        self.ui.setupUi(self)

        # setup events
        self.ui.rdbFxFile.clicked.connect(self.fxButton_Click)
        self.ui.rdbLightingFile.clicked.connect(self.lightingButton_Click)
        self.ui.btnUnlock.clicked.connect(self.unlock_Click)
        self.ui.lwShots.currentItemChanged.connect(self.shotList_ItemSelectionChange)
        
        # intialize member variables
        self.currentShotType = 'lighting'
        self.currentShot = None

        # populate shots
        self.populateShots()
        item = self.ui.lwShots.currentItem()
        if item != None:
            name = str(item.text())
            self.setShot(name)
コード例 #3
0
class CheckoutShotDialog(QDialog):
    def __init__(self,parent=None):
        super(CheckoutShotDialog, self).__init__(parent)
        self.ui = Ui_CheckoutShotDialog()
        self.ui.setupUi(self)

        # setup events
        self.ui.rdbFxFile.clicked.connect(self.fxButton_Click)
        self.ui.rdbLightingFile.clicked.connect(self.lightingButton_Click)
        self.ui.btnUnlock.clicked.connect(self.unlock_Click)
        self.ui.lwShots.currentItemChanged.connect(self.shotList_ItemSelectionChange)
        
        # intialize member variables
        self.currentShotType = 'lighting'
        self.currentShot = None

        # populate shots
        self.populateShots()
        item = self.ui.lwShots.currentItem()
        if item != None:
            name = str(item.text())
            self.setShot(name)
    
    def populateShots(self):
        shotPaths = glob.glob(os.path.join(os.environ['SHOTS_DIR'], '*'))
        for sp in shotPaths:
            bn = os.path.basename(sp)
            item = QListWidgetItem("lwi" + bn)
            item.setText(bn)
            self.ui.lwShots.addItem(item)
        self.ui.lwShots.sortItems(0)
        self.ui.lwShots.setSortingEnabled(True)
    
    def fxButton_Click(self):
        self.currentShotType = 'sfx'
        self.refreshShot()
    
    def lightingButton_Click(self):
        self.currentShotType = 'lighting'
        self.refreshShot()

    def accept(self):
        if self.currentShot != None:

            if not self.currentShot.isLocked():
                destpath = self.currentShot.checkout()
                print destpath                
                toOpen = self.getFileToOpen(destpath)
                print toOpen
                if os.path.exists(toOpen):
                    # hou.hipFile.load(toOpen)
                    self.openShotFile(toOpen, self.currentShot.name)
                    self.done(0)
                else:
                    hou.hipFile.clear()
                    hou.hipFile.save(toOpen) 
                    self.done(0)
            elif self.currentShot.checkedOutByMe():
                destpath = self.currentShot.getCheckoutDest()
                toOpen = self.getFileToOpen(destpath)
                # hou.hipFile.load(toOpen)
                self.openShotFile(toOpen, self.currentShot.name)
                self.done(0)

    def openShotFile(self, toOpen, shotName):
        hou.hipFile.load(toOpen)
        obj = hou.node('/obj')
        for child in obj.children():
            # if child.isLocked():
            shotParm = child.parm('anim')
            if shotParm:
                shotParm.set(shotName)
    
    def getFileToOpen(self, destpath):
        toCheckout = self.currentShot.workingDirectory
        toOpen = os.path.join(destpath, ham.get_filename(toCheckout)+'.hipnc')
        return toOpen

    def reject(self):
        self.done(0)    

    def unlock_Click(self):
        reply = hou.ui.displayMessage(  text             = 'Unlocking may corrupt the scene file. '
                                                           + 'Are you sure you want to unlock this scene?'
                                      , buttons          = ('Yes', 'No')
                                      , severity         = hou.severityType.Message
                                      , default_choice   = 1
                                      , close_choice     = 1
                                      , help             = 'This feature is currently experimental.'
                                      , title            = 'Confirm ' + self.currentShot.name + ' Unlock'
                                      , details          = None
                                      , details_expanded = False
                                      )
        if reply == 0:
            self.currentShot.unlock()
            self.refreshShot()
        

    def shotList_ItemSelectionChange(self, item=None):
        if item != None:
            name = str(item.text())
            self.setShot(name)

    def refreshShot(self):
        self.setShot(self.currentShot.name)

    def setShot(self, name):
        self.currentShot = Shot(name, self.currentShotType)
        self.ui.lblShot.setText( "Shot: " + self.currentShot.name)
        self.ui.txtDescription.setText(self.currentShot.description)
        isLocked = self.currentShot.isLocked()
        self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(not isLocked or self.currentShot.checkedOutByMe())
        self.ui.btnUnlock.setEnabled(isLocked)
コード例 #4
0
class CheckoutShotDialog(QDialog):
    def __init__(self, parent=None):
        super(CheckoutShotDialog, self).__init__(parent)
        self.ui = Ui_CheckoutShotDialog()
        self.ui.setupUi(self)

        # setup events
        self.ui.rdbFxFile.clicked.connect(self.fxButton_Click)
        self.ui.rdbLightingFile.clicked.connect(self.lightingButton_Click)
        self.ui.btnUnlock.clicked.connect(self.unlock_Click)
        self.ui.lwShots.currentItemChanged.connect(
            self.shotList_ItemSelectionChange)

        # intialize member variables
        self.currentShotType = 'lighting'
        self.currentShot = None

        # populate shots
        self.populateShots()
        item = self.ui.lwShots.currentItem()
        if item != None:
            name = str(item.text())
            self.setShot(name)

    def populateShots(self):
        shotPaths = glob.glob(os.path.join(os.environ['SHOTS_DIR'], '*'))
        for sp in shotPaths:
            bn = os.path.basename(sp)
            item = QListWidgetItem("lwi" + bn)
            item.setText(bn)
            self.ui.lwShots.addItem(item)
        self.ui.lwShots.sortItems(0)
        self.ui.lwShots.setSortingEnabled(True)

    def fxButton_Click(self):
        self.currentShotType = 'sfx'
        self.refreshShot()

    def lightingButton_Click(self):
        self.currentShotType = 'lighting'
        self.refreshShot()

    def accept(self):
        if self.currentShot != None:

            if not self.currentShot.isLocked():
                destpath = self.currentShot.checkout()
                print destpath
                toOpen = self.getFileToOpen(destpath)
                print toOpen
                if os.path.exists(toOpen):
                    # hou.hipFile.load(toOpen)
                    self.openShotFile(toOpen, self.currentShot.name)
                    self.done(0)
                else:
                    hou.hipFile.clear()
                    hou.hipFile.save(toOpen)
                    self.done(0)
            elif self.currentShot.checkedOutByMe():
                destpath = self.currentShot.getCheckoutDest()
                toOpen = self.getFileToOpen(destpath)
                # hou.hipFile.load(toOpen)
                self.openShotFile(toOpen, self.currentShot.name)
                self.done(0)

    def openShotFile(self, toOpen, shotName):
        hou.hipFile.load(toOpen)
        obj = hou.node('/obj')
        for child in obj.children():
            # if child.isLocked():
            shotParm = child.parm('anim')
            if shotParm:
                shotParm.set(shotName)

    def getFileToOpen(self, destpath):
        toCheckout = self.currentShot.workingDirectory
        toOpen = os.path.join(destpath,
                              ham.get_filename(toCheckout) + '.hipnc')
        return toOpen

    def reject(self):
        self.done(0)

    def unlock_Click(self):
        reply = hou.ui.displayMessage(
            text='Unlocking may corrupt the scene file. ' +
            'Are you sure you want to unlock this scene?',
            buttons=('Yes', 'No'),
            severity=hou.severityType.Message,
            default_choice=1,
            close_choice=1,
            help='This feature is currently experimental.',
            title='Confirm ' + self.currentShot.name + ' Unlock',
            details=None,
            details_expanded=False)
        if reply == 0:
            self.currentShot.unlock()
            self.refreshShot()

    def shotList_ItemSelectionChange(self, item=None):
        if item != None:
            name = str(item.text())
            self.setShot(name)

    def refreshShot(self):
        self.setShot(self.currentShot.name)

    def setShot(self, name):
        self.currentShot = Shot(name, self.currentShotType)
        self.ui.lblShot.setText("Shot: " + self.currentShot.name)
        self.ui.txtDescription.setText(self.currentShot.description)
        isLocked = self.currentShot.isLocked()
        self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
            not isLocked or self.currentShot.checkedOutByMe())
        self.ui.btnUnlock.setEnabled(isLocked)