raganmd / touchdesigner-save-external

a simple save external tox and text helper
MIT License
61 stars 11 forks source link

Colors DATs without External File par #29

Open chrsmlls333 opened 4 months ago

chrsmlls333 commented 4 months ago

This Tox is a lifesaver, but the current version is a bit overzealous with coloring DATs. I found that it looks for if any DAT's 'file' parameter doesn't equal an empty string, then its added to the collection of "externalized" DATs. But all DATs without a file parameter at all would fail that test.

I adjusted to the following and it worked for me. Was the exclude list to prevent this from happening?

def find_all_dats(self):
        external_dats = []
        exclude_list = [
            'eval', 
            'keyboardin', 
            'opfind', 
            'folder', 
            'examine', 
            'select',
            'udpout',
            'udpin',
            'script',
            'null',
            'info']
        for eachOp in root.findChildren(type=DAT):
            if eachOp.type in exclude_list:
                pass

            else:
                filepar = eachOp.par['file']
                if filepar is not None and filepar.valid:
                    if filepar != '':
                        external_dats.append(eachOp)
                else:
                    pass
        return external_dats