Skip to content

Instantly share code, notes, and snippets.

@Pullusb
Created July 19, 2016 12:46
Show Gist options
  • Save Pullusb/ff0526d65a47f675ab77a01e6b72519c to your computer and use it in GitHub Desktop.
Save Pullusb/ff0526d65a47f675ab77a01e6b72519c to your computer and use it in GitHub Desktop.
blender script to replace images datapath to current blender folder and subfolder
import bpy
import os
corrected = []
print ("--------")
loc = bpy.path.abspath('//')
for i in bpy.data.images:
for root, folders, files in os.walk(loc):
for f in files:
if i.name == f:
corrected.append(f)
i.filepath = bpy.path.relpath(os.path.join(root,f))
break
print ("corrected:", corrected)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment