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

Blenvy for Blender: Using multiple materials with the same name and different casing is a footgun #209

Open
janhohenheim opened this issue Jul 29, 2024 · 0 comments

Comments

@janhohenheim
Copy link
Contributor

Reproduction

  • Use a Windows or macOS machine to work on Blender. Create and use both a material called "white" and one called "White". Export using Blenvy.
  • Build and run the Bevy app on a Linux machine.
  • The game will now crash with "Expected white.glb to be loaded" or "Expected White.glb to be loaded"

Problem

Blenvy stores a file for every material based on its name. In this case, it will try to store the following two files:

  • white.glb
  • White.glb

This is no issue on Linux, but on other OSes, this will silently overwrite whatever was stored first because of case-insensitiveness., This results in only one material being written. The truly insidious issue now is that a Blenvy user won't notice or care, since when loading the materials white.glb and White.glb, it will again be case-insensitive and just read the one existing file both times, resulting in the game running normally (assuming both white and White look similar enough that you won't notice).
But! When distributing binaries to other OSes, Linux users will have the game crash, as their Blenvy will try to find both white.glb and White.glb, which won't work since only one of these exists!

Why is this relevant?

This happened to me because I use Windows to develop and uploaded my game jam entry to itch.io, which triggered this on Web for players (thankfully before the submission deadline). I had these naming "clashes" because I imported a lot of third party assets, which often bring in generic material names like "orange", "grey", "gray", "DarkGrey" or "Dark_grey". As you see, it's only a question of time until these imported materials have the same name with a different capitalization.

Workaround

Simply rename your materials. If you have two variants of "white", chances are you can just remove one and use the other for all models.

Solution

I can think of the following solutions:

  • Append a hash of the material name to the exported material file. That way, macOS and Windows will not run into naming conflicts.
  • Print an error or warning in Blender when exporting materials that run into this.
  • Print an error or warning in Bevy while analyzing the exported stuff to catch this before it can crash the game without a good message.
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

No branches or pull requests

1 participant