GLB/GLTF export on mac to external drives won't export images

Discuss Moho bugs (or suspected bugs) with other users. To report bugs to Smith Micro, please visit support.smithmicro.com

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
heyvern
Posts: 7120
Joined: Thu Sep 01, 2005 8:49 pm

GLB/GLTF export on mac to external drives won't export images

Post by heyvern »

I isolated the failure to external volumes on macOS. The same Moho file and glTF export settings produce a complete GLB with textures when exported to the internal drive. When I export to my external drive, Moho creates the GLB/GLTF, but the rendered texture images are missing. Normal Moho Save, Render, and Export Animation operations can write to that external drive without issue, and Moho on Windows can export the complete GLB to that same external drive over the network. Full Disk Access for Moho on macOS does not change the behavior. Your LM_RenderLayerImage test succeeds, but its RenderLayerImage() output is automatically written to the Desktop/internal drive, so it doesn’t exercise the failing external-volume issue.
User avatar
SimplSam
Posts: 1364
Joined: Thu Mar 13, 2014 9:09 am
Location: London, UK
Contact:

Re: GLB/GLTF export on mac to external drives won't export images

Post by SimplSam »

Looks like this issues occurs because some low-level file system protections.

The images are generated to the OS temp folder area, and then moved to the glTF output folder. That move is performed with the os.rename function, and unfortunately - certain systems block os.rename from performing "Cross-device linking" - when the new and old file references are on different file system devices.
Moho 14.5 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.5 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
heyvern
Posts: 7120
Joined: Thu Sep 01, 2005 8:49 pm

Re: GLB/GLTF export on mac to external drives won't export images

Post by heyvern »

I looked into this and apparently there is a fix for it in the program level? It has something to with using a different method instead of the os.rename. That is always blocked when accessing external drives. I can't change my system but the exporter could use a different method to copy or move those files that won't cause the failure. Just passing on what I found and you may already know about this. For now will have to export only to the internal drive. hopefully it can get fixed in future.
User avatar
SimplSam
Posts: 1364
Joined: Thu Mar 13, 2014 9:09 am
Location: London, UK
Contact:

Re: GLB/GLTF export on mac to external drives won't export images

Post by SimplSam »

For now you can 'hack' the ss_gltf_export code and replace the relevant os.rename function with an os.execute process -- which then executes a system move function. Note: Not suitable for Windows systems as it would cause popups.

To edit: ss_gltf_export

Find: <Moho Install>/Resources/Support/Scripts/Tool/ss_gltf_export.lua
Copy to: <Custom Content Folder>/Scripts/Tool/ss_gltf_export.lua
TextEdit the copy...

Replace:

Code: Select all

local ok, err, code = os.rename(imgPath, imgPathNR)
with:

Code: Select all

os.execute(("mv '%s' '%s'"):format(imgPath, imgPathNR))
Save the file (copy)
Reload (CTRL+ALT+SHIFT+L) or Restart Moho
Moho 14.5 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.5 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
heyvern
Posts: 7120
Joined: Thu Sep 01, 2005 8:49 pm

Re: GLB/GLTF export on mac to external drives won't export images

Post by heyvern »

OH WOW! Thanks. I had NO IDEA the script for the plugin was in the application script folder. AWESOMENESS. WORKS PERFECTLY NOW. WOOOOHOOOOO.
I mean I don't hate my windows machine and I'm sure its very sad and jealous I bought the mac but I hate switching back and forth. ;)
Post Reply