From 3776246d70818f5614dd98c053dce0be40c6b0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 22 Jul 2016 12:56:37 +0200 Subject: [PATCH] Texture browser: load images with relative path if needed. If the local texture path of the current scene is relative, the image will also be stored in a relative path. --- blender_cloud/texture_browser.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/blender_cloud/texture_browser.py b/blender_cloud/texture_browser.py index 4759752..a0d3e1a 100644 --- a/blender_cloud/texture_browser.py +++ b/blender_cloud/texture_browser.py @@ -821,6 +821,11 @@ class BlenderCloudBrowser(pillar.PillarOperatorMixin, # We want to obtain the real node, not the fake one. node = self.menu_item_stack[-1].node + if context.scene.local_texture_dir.startswith('//'): + # If the local texture dir is blendfile-relative, + # so should the image's file path be. + file_path = bpy.path.relpath(file_path) + self.log.info('Texture downloaded to %r.', file_path) image_dblock = bpy.data.images.load(filepath=file_path) image_dblock['bcloud_file_uuid'] = file_desc['_id']