Example #1
0
    def has_valid_id(self):
        """
        Whether ReaScript ID is still valid.

        For instance, if track has been deleted, ID will not be valid
        anymore.

        :type: bool
        """
        pointer, name = self._get_pointer_and_name()
        if self._project is None:
            return any(
                RPR.ValidatePtr2(p.id, pointer, name)
                for p in reapy.get_projects()
            )
        return bool(RPR.ValidatePtr2(self.project.id, pointer, name))
Example #2
0
    def has_valid_id(self):
        """
        Whether ReaScript ID is still valid.

        For instance, if take has been deleted, ID will not be valid
        anymore.

        :type: bool
        """
        try:
            project_id = self.track.project.id
        except (OSError, AttributeError):
            return False
        pointer, name = self._get_pointer_and_name()
        return bool(RPR.ValidatePtr2(project_id, pointer, name))