def __init__(self): super(ShotLoader, self).__init__(parent=QApplication.activeWindow()) self.setWindowTitle('Shot Loader') self.setMinimumSize(100, 400) # Set variables self.shot_dic = {} self.google_drive = bf.json_read_write() self.scene_location = self.google_drive + 'Comp/' # Load master Layer self.master() # if there is a recent file if self.google_drive in nuke.recentFile(1): self.shot_number.setText(nuke.recentFile(1).split('/')[-1][:-8]) self.load_shot(nuke.recentFile(1).split('/')[-1][:-8])
def get_version_from_recent_files(self): """It will try to create a :class:`~oyProjectManager.models.version.Version` instance by looking at the recent files list. It will return None if it can not find one. :return: :class:`~oyProjectManager.models.version.Version` """ # use the last file from the recent file list i = 1 while True: try: full_path = nuke.recentFile(i) except RuntimeError: # no recent file anymore just return None return None i += 1 version = self.get_version_from_full_path(full_path) if version is not None: return version