@classmethod
    def to_repr(cls, repr_name):
        # get apply to
        apply_to = \
            pm.radioButtonGrp('repr_apply_to_radio_button_grp', q=1, sl=1)

        if apply_to == 1:
            # work on every selected object
            selection = pm.ls(sl=1)

            # collect reference files first
            references = []
            for node in selection:
                ref = node.referenceFile()
                if ref is not None and ref not in references:
                    references.append(ref)

            from anima.env.mayaEnv.repr_tools import RepresentationGenerator

            # now go over each reference
            for ref in references:
                if not ref.is_repr(repr_name):
                    parent_ref = ref
                    while parent_ref is not None:
                        # check if it is a look dev node
                        v = parent_ref.version
                        if v:
                            task = v.task
                            if RepresentationGenerator.is_look_dev_task(task) \
                               or RepresentationGenerator.is_vegetation_task(task):
                                # convert it to repr
                                parent_ref.to_repr(repr_name)
                                break
                            else:
                                # go to parent ref
                                parent_ref = parent_ref.parent()
                        else:
                            parent_ref = parent_ref.parent()
        elif apply_to == 2:
            # apply to all references
            for ref in pm.listReferences():
                ref.to_repr(repr_name)
Stop accidental deletion.
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/toolbox.py/Reference.to_repr--crossover with--dataset/ETHPy150Open evennia/evennia/evennia/server/serversession.py/ServerSession.ndb_del