Example #1
0
    def _framerange_of_sequence(self, item):
        """
        Since users have the option to render only a subset of frames,
        adding validation to check if the full frame range is being published.

        :param item: Item to process
        :return: True if yes false otherwise
        """
        lss_path = item.properties['path']
        lss_data = frangetools.getSequence(lss_path)

        info_by_path = self._build_dict(lss_data, key="path")
        missing_frames = info_by_path.get(lss_path)['missing_frames']

        if missing_frames:
            self.logger.error("Incomplete playblast! All the frames are not the playblast.")
            return False
        else:
            # If there are no missing frames, checking if the start and end frames match with playblast settings.
            # This is being directly checked with playblast settings in the scene since
            # _sync_frame_range_with_shotgun() will ensure playblast frame range is synced with shotgun
            import pymel.core as pm
            playback_start = pm.playbackOptions(q=True, minTime=True)
            playback_end = pm.playbackOptions(q=True, maxTime=True)
            collected_playblast_firstframe = info_by_path.get(lss_path)['frame_range'][0]
            collected_playblast_lastframe = info_by_path.get(lss_path)['frame_range'][1]
            if (collected_playblast_firstframe != playback_start) or (collected_playblast_lastframe != playback_end):
                self.logger.error("Incomplete playblast! All the frames are not in the playblast.")
                return False
        return True
    def _framerange_to_be_published(self, item):
        """
        Since users have the option to render only a subset of frames,
        adding validation to check if the full frame range is being published.

        :param item: Item to process
        :return: True if yes false otherwise
        """
        lss_path = item.properties['path']
        lss_data = frangetools.getSequence(lss_path)

        # Since lss_data will be a list of dictionaries,
        # building a dictionary from key value for the ease of fetching data.
        info_by_path = self._build_dict(lss_data, key="path")
        missing_frames = info_by_path.get(lss_path)['missing_frames']
        root = nuke.Root()

        # If there are no missing frames, then checking if the first and last frames match with root first and last
        # Checking with root because _sync_frame_range() will ensure root is up to date with shotgun
        if missing_frames:
            self.logger.error("Renders Mismatch! Incomplete renders on disk.")
            return False
        else:
            first_rendered_frame = info_by_path.get(lss_path)['frame_range'][0]
            last_rendered_frame = info_by_path.get(lss_path)['frame_range'][1]
            if (first_rendered_frame != root.firstFrame()) or (
                    last_rendered_frame != root.lastFrame()):
                self.logger.error(
                    "Renders Mismatch! Incomplete renders on disk.")
                return False
            elif (first_rendered_frame > root.firstFrame()) or (
                    last_rendered_frame > root.lastFrame()):
                self.logger.error("Renders Mismatch! Extra renders on disk.")
                return False
            return True
    def _framerange_matches_playback(self, item):
        """
        Validate whether the framerange of the sequence matches the
        current Maya session playback framerange.

        :param item: Item to process
        :return:     True if item files on disk match Maya playback frame range, False otherwise
        """
        lss_path = item.properties['path']
        lss_data = frangetools.getSequence(lss_path)

        info_by_path = self._build_dict(lss_data, key="path")
        missing_frames = info_by_path.get(lss_path)['missing_frames']

        if missing_frames:
            self.logger.error(
                "Incomplete playblast! All the frames are not the playblast.")
            return False
        else:
            # If there are no missing frames, checking if the start and end frames match with playblast settings.
            # This is being directly checked with playblast settings in the scene since
            # _sync_frame_range_with_shotgun() will ensure playblast frame range is synced with shotgun
            playback_start = pm.playbackOptions(q=True, minTime=True)
            playback_end = pm.playbackOptions(q=True, maxTime=True)

            collected_playblast_firstframe = info_by_path.get(
                lss_path)['frame_range'][0]
            collected_playblast_lastframe = info_by_path.get(
                lss_path)['frame_range'][1]

            if (collected_playblast_firstframe > playback_start) or (
                    collected_playblast_lastframe < playback_end):
                self.logger.error(
                    "Incomplete playblast! "
                    "Complete Maya scene frame range not in the playblast.")
                return False
            elif (collected_playblast_firstframe < playback_start) or (
                    collected_playblast_lastframe > playback_end):
                self.logger.warning("Playblast exceeds Shotgun frame range.")
                QtGui.QMessageBox.warning(
                    None, "PLayblast frame range mismatch!",
                    "WARNING! Playblast exceeds Maya frame range.")
                return True
        return True