# (c) J.Y.Amihud 2023
# GPL-3 or any later version

# This file runs inside blender and outputs all linked filepaths.

import bpy
print("!START_DATA!")

l = []

for i in bpy.data.libraries:
    n = i.filepath
    if n not in l:
        l.append(n)
    
for i in bpy.data.images:
    n = i.filepath
    if n not in l:
        l.append(n)
    

for i in bpy.data.sounds:
    n = i.filepath
    if n not in l:
        l.append(n)
    

for i in bpy.data.movieclips:
    n = i.filepath
    if n not in l:
        l.append(n)

for i in bpy.data.texts:
    n = i.filepath
    if n not in l:
        l.append(n)


for i in bpy.context.sequences:
    try:
        for b in i.elements:
        
            n = str(i.directory+b.filename)
            if n not in l:
                l.append(n)
        
    except:
        try:
            n = str(i.sound.filepath)
            if n not in l:
                l.append(n)
        except:
            try:
                n = str(i.filepath)
                if n not in l:
                    l.append(n) 
            except:
                pass
for i in l:
    print(i)

    
print("!END_DATA!")
