get_linked_files.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # (c) J.Y.Amihud 2023
  2. # GPL-3 or any later version
  3. # This file runs inside blender and outputs all linked filepaths.
  4. import bpy
  5. print("!START_DATA!")
  6. l = []
  7. for i in bpy.data.libraries:
  8. n = i.filepath
  9. if n not in l:
  10. l.append(n)
  11. for i in bpy.data.images:
  12. n = i.filepath
  13. if n not in l:
  14. l.append(n)
  15. for i in bpy.data.sounds:
  16. n = i.filepath
  17. if n not in l:
  18. l.append(n)
  19. for i in bpy.data.movieclips:
  20. n = i.filepath
  21. if n not in l:
  22. l.append(n)
  23. for i in bpy.data.texts:
  24. n = i.filepath
  25. if n not in l:
  26. l.append(n)
  27. for i in bpy.context.sequences:
  28. try:
  29. for b in i.elements:
  30. n = str(i.directory+b.filename)
  31. if n not in l:
  32. l.append(n)
  33. except:
  34. try:
  35. n = str(i.sound.filepath)
  36. if n not in l:
  37. l.append(n)
  38. except:
  39. try:
  40. n = str(i.filepath)
  41. if n not in l:
  42. l.append(n)
  43. except:
  44. pass
  45. for i in l:
  46. print(i)
  47. print("!END_DATA!")