1

I am looking for a way to list every external file existing in my scene(already open) without the use of a reader. I've invastigate the pymel doc and could'nt find what i was looking for.

I want the list to be complete, to list even files that doesn't exist but are referenced in the scene. For now i can only list the files that are imported correctly

Here is what i still have as exemple of what i tried (i tried them with many parameters)

    list_in_scene = cmds.file(q=True, list=True,rer=True)
    list_path = pm.filePathEditor(query=True,listDirectories="")
    pm.listReferences(recursive=True)
    pm.listNamespaces(recursive=True)

Thanks for your help and advices

Aurele Collinet
  • 138
  • 1
  • 16

1 Answers1

1

here is the resolution i found

  list_dir = pm.filePathEditor(query=True, listDirectories="")
    list_files = []
    for directory in list_dir:
        list_file_elem = pm.filePathEditor(query=True, listFiles=directory)
        for fil in list_file_elem:
                list_files.append(elem + "/" + fil)

i created a more python version:

    list_dir = pm.filePathEditor(
        query=True, listDirectories="", unresolved=True)
    list_files = []
    for directory in list_dir:
        list_file_elem = pm.filePathEditor(
            query=True, listFiles=directory, withAttribute=True)
        it = iter(list_file_elem)
        list_tuple_file = zip(it, it)
        for (x, y) in list_tuple_file:
            list_files.append((os.path.normpath(
                os.path.join(directory, x)), y))
    return list_files

which seems better to me

Aurele Collinet
  • 138
  • 1
  • 16
  • I'm not sure when it what version it introduced in Maya, but there's a handy script called the filePathEditorWin.mel. It can be called from the UI as well (Windows->General Editors->File Path Editor). This does pretty much what you're looking for and can be a source of info/inspiration. – Klaudikus Nov 29 '19 at 11:01
  • yes, it has an UI option but i am creating a maya python lib – Aurele Collinet Nov 29 '19 at 14:41