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

Conversation

etacarinaea
Copy link
Contributor

When exporting a scene that has linked objects with materials that have relative paths to images, the absolute path of those images was being determined by taking that path relative to the current scene's path, instead of relative to the original path of the library, which would result in the images not being found if the current scene and the library weren't in the same directory. This PR fixes that.

@julienduroure
Copy link
Collaborator

Thanks for the PR
I will have a look soon

@julienduroure julienduroure added this to the Blender 4.3 milestone Aug 15, 2024
@julienduroure
Copy link
Collaborator

Some files are now renamed in main branch.
Can you please rebase your PR?
Thanks :)

When a material with a relative path to an image is linked from another
.blend file, that path should be relative to that .blend file instead of
relative to the current file.
@julienduroure
Copy link
Collaborator

Hello,
With this setup (photo.blend is linked into scene.blend), exporting scene.blend to scene.glb or scene.gltf => I am not able to reproduce the issue on main branch.

image

Can you please create a zip with right setup of directory that shows the issue?

@etacarinaea
Copy link
Contributor Author

Here's the zip: gltf-blender-io_library-uri_test.zip

.
├── assets
│   ├── asset.bin
│   ├── asset.blend
│   └── asset.gltf
├── img
│   └── test.png
├── test.bin
├── test.blend
└── test.gltf

I think I forgot to mention that this only seems to happen when "keep original" is checked while exporting as a gltf. The zip includes the resulting gltf files from exporting the original scene (asset.blend) and the scene with the object linked (test.blend). The gltf of the original one correctly includes the image path, the one with the linked object doesn't.

Output from git diff -- test.gltf assets/asset.gltf:

@@ -44,6 +47,19 @@
                        ]
                }
        ],
+       "textures":[
+               {
+                       "sampler":0,
+                       "source":0
+               }
+       ],
+       "images":[
+               {
+                       "mimeType":"image/png",
+                       "name":"test.png",
+                       "uri":"../img/test.png"
+               }
+       ],
        "accessors":[
                {
                        "bufferView":0,

@julienduroure
Copy link
Collaborator

when "keep original" is checked

It was the missing part! Thanks :)

@julienduroure julienduroure merged commit 62999ff into KhronosGroup:main Sep 12, 2024
2 checks passed
@julienduroure
Copy link
Collaborator

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants