Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for library when gathering image URI #2304

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading