diff options
author | Eugenio Pignataro <info@oscurart.com.ar> | 2017-08-03 19:13:34 +0300 |
---|---|---|
committer | Eugenio Pignataro <info@oscurart.com.ar> | 2017-08-03 19:13:34 +0300 |
commit | 83e5b12b75643ea5f71a5de40533d82d9179ab2a (patch) | |
tree | 1bdc5154c717db75d2fa08f7398079cfdd0e7471 | |
parent | 0023a36b40d2df9b05c45a4634f76ba4a179f349 (diff) |
bugfix Collect, missing paths
-rw-r--r-- | oscurart_tools/oscurart_files.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/oscurart_tools/oscurart_files.py b/oscurart_tools/oscurart_files.py index ac08907b..870508bd 100644 --- a/oscurart_tools/oscurart_files.py +++ b/oscurart_tools/oscurart_files.py @@ -123,11 +123,19 @@ class collectImagesOsc(Operator): bpy.ops.file.make_paths_absolute() for image in bpy.data.images: - if not os.path.exists(os.path.join(imagespath,os.path.basename(image.filepath))): - shutil.copy(image.filepath, os.path.join(imagespath,os.path.basename(image.filepath))) - image.filepath = os.path.join(imagespath,os.path.basename(image.filepath)) - else: - print("%s exists." % (image.name)) + try: + image.update() + + if image.has_data: + if not os.path.exists(os.path.join(imagespath,os.path.basename(image.filepath))): + shutil.copy(image.filepath, os.path.join(imagespath,os.path.basename(image.filepath))) + image.filepath = os.path.join(imagespath,os.path.basename(image.filepath)) + else: + print("%s exists." % (image.name)) + else: + print("%s missing path." % (image.name)) + except: + print("%s missing path." % (image.name)) bpy.ops.file.make_paths_relative() |