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

fixed gltf export when using paths instead of only file name #2035

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

dabeschte
Copy link
Contributor

When you store a GLTF file using a path instead of only a file name, this line effectively duplicated the path.

E.g., instead of writing all files into out when using scene.export("out/scene.gltf"), it saved all files in out except for the gltf file which is stored in out/out/mesh.gltf - raising an exception doing so.

@dabeschte dabeschte marked this pull request as ready for review September 14, 2023 15:32
@mikedh
Copy link
Owner

mikedh commented Sep 14, 2023

Thanks for the fix!! What's the combination of export args that hits this? I was trying to test with variants on this but couldn't quite get it:

    from tempfile import TemporaryDirectory
    with TemporaryDirectory() as d:
	trimesh.creation.box().export(d, file_type='gltf')
        r = trimesh.load(os.path.join(d, 'model.gltf'))

@dabeschte
Copy link
Contributor Author

dabeschte commented Sep 15, 2023

I can produce the error with this script (assuming that "fused" folder exists):

import trimesh
m = trimesh.load("example.glb", force="mesh")
m.export("fused/example.gltf")

error message:
[Errno 2] No such file or directory: C:\\Users\\dabeschte\\Desktop\\test_meshes\\fused\\fused/pbr_cubes_emissive_fused.gltf

the same happens when I use double backslashes or os.path.join

@mikedh mikedh changed the base branch from main to drop/py2 September 15, 2023 16:53
@mikedh mikedh merged commit d523c3b into mikedh:drop/py2 Sep 15, 2023
mikedh added a commit that referenced this pull request Sep 15, 2023
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