Skip to content

Commit

Permalink
Merge pull request #2304 from etacarinaea/library_uri
Browse files Browse the repository at this point in the history
Account for library when gathering image URI
  • Loading branch information
julienduroure committed Sep 12, 2024
2 parents 77857d6 + 136d910 commit 62999ff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions addons/io_scene_gltf2/blender/exp/material/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def gather_image(
uri, factor_uri = __gather_uri(image_data, mime_type, name, export_settings)
else:
# Retrieve URI relative to exported glTF files
uri = __gather_original_uri(image_data.original.filepath, export_settings)
uri = __gather_original_uri(
image_data.original.filepath,
blender_shader_sockets[0].socket.id_data.library,
export_settings
)
# In case we can't retrieve image (for example packed images, with original moved)
# We don't create invalid image without uri
factor_uri = None
Expand All @@ -81,9 +85,9 @@ def gather_image(
# We also return image_data, as it can be used to generate same file with another extension for WebP management
return image, image_data, factor, None

def __gather_original_uri(original_uri, export_settings):
def __gather_original_uri(original_uri, library, export_settings):
path_to_image = bpy.path.abspath(original_uri, library=library)

path_to_image = bpy.path.abspath(original_uri)
if not os.path.exists(path_to_image): return None
try:
rel_path = os.path.relpath(
Expand Down

0 comments on commit 62999ff

Please sign in to comment.