@classmethod
    def generate_repr_of_all_references(cls,
                                        generate_gpu=True,
                                        generate_ass=True,
                                        skip_existing=False):
        from anima.ui.progress_dialog import ProgressDialogManager
        from anima.env.mayaEnv import Maya, repr_tools, auxiliary
        reload(auxiliary)
        reload(repr_tools)

        paths_visited = []
        versions_to_visit = []
        versions_cannot_be_published = []

        # generate a sorted version list
        # and visit each reference only once
        pdm = ProgressDialogManager()

        use_progress_window = False
        if not pm.general.about(batch=1):
            use_progress_window = True

        all_refs = pm.listReferences(recursive=True)

        pdm.use_ui = use_progress_window
        caller = pdm.register(len(all_refs), 'List References')

        for ref in reversed(all_refs):
            ref_path = str(ref.path)
            caller.step(message=ref_path)
            if ref_path not in paths_visited:
                v = ref.version
                if v is not None:
                    paths_visited.append(ref_path)
                    versions_to_visit.append(v)

        response = pm.confirmDialog(
            title='Do Create Representations?',
            message='Create all Repr. for all %s FileReferences?'
                    % len(versions_to_visit),
            button=['Yes', 'No'],
            defaultButton='No',
            cancelButton='No',
            dismissString='No'
        )
        if response == 'No':
            return

        # register a new caller
        caller = pdm.register(max_iteration=len(versions_to_visit),
                              title='Generate Reprs')

        m_env = Maya()
        source_version = m_env.get_current_version()
        gen = repr_tools.RepresentationGenerator()

        # open each version
        from stalker import Version
        for v in versions_to_visit:
            local_generate_gpu = generate_gpu
            local_generate_ass = generate_ass

            # check if this is a repr
            if '@' in v.take_name:
                # use the parent
                v = v.parent
                if not v:
                    continue

            if skip_existing:
                # check if there is a GPU or ASS repr
                # generated from this version
                child_versions = Version.query.filter(Version.parent == v).all()
                for cv in child_versions:
                    if local_generate_gpu is True and '@GPU' in cv.take_name:
                        local_generate_gpu = False

                    if local_generate_ass is True and '@ASS' in cv.take_name:
                        local_generate_ass = False

            gen.version = v
            # generate representations
            if local_generate_gpu:
                try:
                    gen.generate_gpu()
                except RuntimeError:
                    if v not in versions_cannot_be_published:
                        versions_cannot_be_published.append(v)

            if local_generate_ass:
                try:
                    gen.generate_ass()
                except RuntimeError:
                    if v not in versions_cannot_be_published:
                        versions_cannot_be_published.append(v)

            caller.step()

        # now open the source version again
        m_env.open(source_version, force=True, skip_update_check=True)

        # and generate representation for the source
        gen.version = source_version

        # generate representations
        if not versions_cannot_be_published:
            if generate_gpu:
                gen.generate_gpu()
            if generate_ass:
                gen.generate_ass()
        else:
            pm.confirmDialog(
                title='Error',
                message='The following versions can not be published '
                        '(check script editor):\n\n%s' % (
                            '\n'.join(
                                map(lambda x: x.nice_name,
                                    versions_cannot_be_published)
                            )
                        ),
                button=['OK'],
                defaultButton='OK',
                cancelButton='OK',
                dismissString='OK'
            )

            pm.error(
                '\n'.join(
                    map(lambda x: x.absolute_full_path,
                        versions_cannot_be_published)
                )
            )
generates all representations of all references of this scene
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/toolbox.py/Reference.generate_repr_of_all_references