Exemplo n.º 1
0
    def accept(self):
        """
        Check the connection.
        """
        projectname = self.PROJECTNAME
        shotname = self.cmbShot.currentText()
        shot_data = self.cmbShot.itemData(self.cmbShot.currentIndex())

        if not self._gen.status():
            log.error("Generation not running", True)
            return

        log.info("Importing Comps from {0} - {1}".format(
            projectname, shotname))

        if shot_data == "*":
            shots = filesystem.shots(self.PROJECTROOT, projectname)
        else:
            shots = {shotname: ""}

        for cur_shotname, cur_shotdir in shots.items():
            comps = filesystem.comps(projectname, cur_shotname)
            for comp in comps:
                log.debug("Inserting {0}".format(comp))
                comp = str(comp)
                self._gen.insert_media(cur_shotname, comp,
                                       self.chkShotLike.isChecked())

        super(UpdateShotDialog, self).accept()
Exemplo n.º 2
0
    def accept(self):
        """
        Check the connection.
        """
        projectname = self.PROJECTNAME
        shotname = self.cmbShot.currentText()
        shot_data = self.cmbShot.itemData(self.cmbShot.currentIndex())

        if not self._gen.status():
            log.error("Generation not running", True)
            return

        log.info("Importing Comps from {0} - {1}".format(projectname, shotname))

        if shot_data == "*":
            shots = filesystem.shots(self.PROJECTROOT, projectname)
        else:
            shots = {shotname:""}
        
        for cur_shotname, cur_shotdir in shots.items():
            comps = filesystem.comps(projectname, cur_shotname)
            for comp in comps:
                log.debug("Inserting {0}".format(comp))
                comp = str(comp)
                self._gen.insert_media(cur_shotname, comp, self.chkShotLike.isChecked())

        super(UpdateShotDialog, self).accept()
Exemplo n.º 3
0
def generate_meta(gen, pattern):
    """Generate metadata from name and insert into the clip"""

    if not gen.status(True):
        return (False, "Generation not running.")


    if not os.path.isdir(epp_root):
        return (False, "Could not find EPP ROOT directory. Set the EPP_ROOT env variable first.", )

    PAT_FILEBASENAME = re.compile(pattern)
    selected_versions = gen.selected_versions()

    if len(selected_versions) < 1:
        return (False, "No versions selected.")

    for version in selected_versions:
        meta = version.Metadata(gen.frame())
        path = meta['Data']['File']['Path']

        mat = PAT_FILEBASENAME.findall(path)
        if len(mat):
            shotname = mat[0]
            gen.add_meta(version, shotname)
            log.info("Setting metadata of {0} to {1}".format(version.Name, shotname))
        else:
            log.warning("Skipping " + os.path.basename(path))

    return (True, "")
Exemplo n.º 4
0
def main():
    """docstring for main"""

    fu_con = fu_controller()   
    gen_con = gen_controller()
    
    apps = {}
    apps["add_project"] = add_project.main
    apps["add_shot"] = add_shot.main
    apps["add_shot_from_media"] = add_shot_from_media.main
    apps["create_saver"] = create_saver.main
    apps["save_as"] = save_as.main
    apps["set_shot"] = set_shot.main
    apps["update_shot"] = update_shot.main
    apps["save_new_version"] = fu_con.save_new_version
    apps["meta_from_standins"] = gen_con.meta_from_standins

    parser = argparse.ArgumentParser(description='Process some integers.')
    parser.add_argument('module', metavar='module', type=str, nargs='+',
                       help='Which module to launch.')

    args = parser.parse_args()
    
    for module in args.module:
        if not module in apps:
            log.error("Module not found: " + module)
        else:
            log.info("Launching " + module)
            apps[module]()
Exemplo n.º 5
0
def generate_meta(gen, pattern):
    """Generate metadata from name and insert into the clip"""

    if not gen.status(True):
        return (False, "Generation not running.")

    if not os.path.isdir(epp_root):
        return (
            False,
            "Could not find EPP ROOT directory. Set the EPP_ROOT env variable first.",
        )

    PAT_FILEBASENAME = re.compile(pattern)
    selected_versions = gen.selected_versions()

    if len(selected_versions) < 1:
        return (False, "No versions selected.")

    for version in selected_versions:
        meta = version.Metadata(gen.frame())
        path = meta['Data']['File']['Path']

        mat = PAT_FILEBASENAME.findall(path)
        if len(mat):
            shotname = mat[0]
            gen.add_meta(version, shotname)
            log.info("Setting metadata of {0} to {1}".format(
                version.Name, shotname))
        else:
            log.warning("Skipping " + os.path.basename(path))

    return (True, "")
Exemplo n.º 6
0
    def accept(self):
        """
        Check the connection.
        """

        _fu = fu_controller()

        if not _fu.status(True):
            log.error("Fusion not running.", True)
            return

        if os.path.isfile(self.COMP_FILEPATH):
            ret = QMessageBox.information(
                self, "Question",
                "Composition does already exist.\nOverwrite '{0}'".format(
                    os.path.basename(self.COMP_FILEPATH)),
                QMessageBox.Yes | QMessageBox.No)
            if ret == QMessageBox.No:
                return

        cur_project = self.cmbProject.currentText()
        cur_shot = self.cmbShot.currentText()

        ret = _fu.save_comp(self.COMP_FILEPATH, {
            "project": str(cur_project),
            "shot": str(cur_shot)
        })

        if not ret[0]:
            log.error(ret[1], True)
            return

        log.info("Saved Comp to {0}".format(self.COMP_FILEPATH))
        self.hide()

        if self.chkUpdateSavers.isChecked():
            ret = _fu.update_savers(self.spnVersion.value())

        if self.chkFormat.isChecked():
            _fu.set_format(project_format_object(cur_project))

        osplus.set_env("EPP_CURPROJECT", self.cmbProject.currentText())
        osplus.set_env("EPP_CURSHOT", self.cmbShot.currentText())

        COMP_ROOT_DIR = os.path.dirname(self.COMP_FILEPATH)
        if os.path.isdir(COMP_ROOT_DIR):
            res = _fu.set_pathmap("Comps:", COMP_ROOT_DIR)
            log.info("Setting Comps: PathMap to {0} ({1})".format(
                COMP_ROOT_DIR, res[1]))

        super(SaveAsDialog, self).accept()
Exemplo n.º 7
0
    def accept(self):
        """
        Check the connection.
        """
        if not self._gen.status(True):
            log.error(
                "Could not establish connection with Generation. Make sure it is running.",
                True)
            return

        # Need edit rights for this one!
        if not self._gen.allow_changes(True):
            return

        selected_versions = self._gen.selected_versions()
        if len(selected_versions) < 1:
            msg = "No versions selected."
            log.error(msg, True)
            return

        ignore = False
        for version in selected_versions:

            meta = version.Metadata(version.InPoint)
            path = meta['Data']['File']['Path']

            shotname = self.get_shotname(path)
            ret, msg = control.add_shot_from_media(
                self.PROJECTNAME, shotname,
                self.cmbDirStructure.currentText() + ".xml", self._gen,
                self.cmbInsertPosition.currentIndex() + 3,
                version.GetSlotClip())
            if not ret:
                log.error(msg)
                if not ignore:
                    ret = QMessageBox.critical(
                        self, "Error", msg + "\nIgnore?", QMessageBox.Yes
                        | QMessageBox.YesToAll | QMessageBox.Cancel)
                    if ret == QMessageBox.Cancel:
                        return
                    elif ret == QMessageBox.YesToAll:
                        ignore = True
            else:
                log.info(msg)

        super(AddShotFromMediaDialog, self).accept()
Exemplo n.º 8
0
    def accept(self):
        """
        Check the connection.
        """

        _fu = fu_controller()

        if not _fu.status(True):
            log.error("Fusion not running.", True)
            return

        if os.path.isfile(self.COMP_FILEPATH):
            ret = QMessageBox.information(self, "Question", "Composition does already exist.\nOverwrite '{0}'".format(os.path.basename(self.COMP_FILEPATH)), QMessageBox.Yes | QMessageBox.No)
            if ret == QMessageBox.No:
                return

        cur_project = self.cmbProject.currentText()
        cur_shot = self.cmbShot.currentText()

        ret = _fu.save_comp(self.COMP_FILEPATH, {"project": str(cur_project), "shot": str(cur_shot)})

        if not ret[0]:
            log.error(ret[1], True)
            return

        log.info("Saved Comp to {0}".format(self.COMP_FILEPATH))
        self.hide()

        if self.chkUpdateSavers.isChecked():
            ret = _fu.update_savers(self.spnVersion.value())

        if self.chkFormat.isChecked():
            _fu.set_format(project_format_object(cur_project))

        osplus.set_env("EPP_CURPROJECT", self.cmbProject.currentText())
        osplus.set_env("EPP_CURSHOT", self.cmbShot.currentText())

        COMP_ROOT_DIR = os.path.dirname(self.COMP_FILEPATH)
        if os.path.isdir(COMP_ROOT_DIR):
            res = _fu.set_pathmap("Comps:", COMP_ROOT_DIR)
            log.info("Setting Comps: PathMap to {0} ({1})".format(COMP_ROOT_DIR, res[1]))

        super(SaveAsDialog, self).accept()
Exemplo n.º 9
0
    def accept(self):
        """
        Check the connection.
        """
        cur_project = self.cmbProject.currentText()
        cur_shot = self.cmbShot.currentText()

        log.info("Setting project to " + cur_project)
        log.info("Setting shot to " + cur_shot)

        osplus.set_env("EPP_CURPROJECT", cur_project)
        osplus.set_env("EPP_CURSHOT", cur_shot)

        _fu = fu_controller()

        if not _fu.status(True):
            # No need for a dialog
            log.error("Fusion not running.", False)
        else:
            COMP_ROOT_DIR = shot_id_path(cur_project, cur_shot, "compositions")
            if os.path.isdir(COMP_ROOT_DIR):
                res = _fu.set_pathmap("Comps:", COMP_ROOT_DIR)
                log.info("Setting Comps: PathMap to {0} ({1})".format(
                    COMP_ROOT_DIR, res[1]))

        super(SetShotDialog, self).accept()
Exemplo n.º 10
0
    def accept(self):
        """
        Check the connection.
        """
        if not self._gen.status(True):
            log.error("Could not establish connection with Generation. Make sure it is running.", True)
            return

        # Need edit rights for this one!
        if not self._gen.allow_changes(True):
            return 
        
        selected_versions = self._gen.selected_versions()
        if len(selected_versions) < 1:
            msg = "No versions selected."
            log.error(msg, True)
            return

        ignore = False
        for version in selected_versions:

            meta = version.Metadata(version.InPoint)
            path = meta['Data']['File']['Path']

            shotname = self.get_shotname(path)
            ret, msg = control.add_shot_from_media(self.PROJECTNAME, shotname, self.cmbDirStructure.currentText()+".xml", self._gen, self.cmbInsertPosition.currentIndex()+3, version.GetSlotClip())
            if not ret:
                log.error(msg)
                if not ignore:
                    ret = QMessageBox.critical(self, "Error", msg+"\nIgnore?", QMessageBox.Yes | QMessageBox.YesToAll | QMessageBox.Cancel)
                    if ret == QMessageBox.Cancel:
                        return
                    elif ret == QMessageBox.YesToAll:
                        ignore = True
            else:
                log.info(msg)

        super(AddShotFromMediaDialog, self).accept()