Blender 5.x support and Linux/macOS texture path fixes - #33
Open
racerx2 wants to merge 3 commits into
Open
Conversation
Blender 5.0 rejects the manifest at install time because the extension
validator requires the tagline to end with an alphanumeric character:
key "tagline" invalid: alphanumeric suffix expected
Also addresses two smaller issues surfaced while testing on 5.x:
- Material.use_nodes is deprecated in 5.0 (slated for removal in 6.0),
and new materials already carry a node tree, so only set it when the
node tree is genuinely absent. Keeps 4.5 working unchanged.
- The exporter derived its log path from os.path.dirname(bpy.data.filepath),
which is empty for an unsaved .blend, so a verbose export wrote the log
to Blender's working directory or silently failed to open it. Use
get_log_folder(), matching what the importer already did.
Verified against Blender 4.5 LTS, 5.0.1 and 5.2.0 LTS.
Importing a mesh on Linux failed in two ways, both because Orbiter
add-ons are authored on Windows.
1. Meshes not under a folder literally named 'Meshes' raised:
msh_index = up.index('meshes')
ValueError: 'meshes' is not in list
which aborted the import entirely. Root detection now uses the last
'Meshes' component in the path, falls back to walking up for a folder
containing Textures/Textures2, and as a last resort imports the
geometry with a warning rather than raising. Resolving the path first
also fixes a latent TypeError on relative paths, where the old code
would call os.path.join() with no arguments.
2. Mesh files reference textures with Windows separators, for example
'MyVessel\hull.dds'. A backslash is not a separator on Linux/macOS,
so os.path.join() produced a path that could never exist and every
texture in such a mesh silently came up missing. References are now
normalized before being joined, and each path component is matched
case-insensitively, since Windows-authored add-ons are inconsistent
about case and it is not significant there.
Material names built from a texture reference now use only the file
stem, so a texture sub-folder no longer ends up inside the name.
No behaviour change on Windows: os.path.exists() matches on the first
attempt, so the case-insensitive scan never runs, and joining the split
components reproduces the original path exactly.
A texture named in the mesh file but absent from disk left src_tex_file
empty, and the material branch went on to call bpy.data.images.load("")
regardless. That raised and aborted the whole import, so one missing or
unreadable texture cost the entire mesh, geometry included.
Materials whose texture cannot be found are now created untextured and
the mesh still imports, with the missing reference reported. Loading is
also wrapped so an unreadable or unsupported image file is reported and
skipped rather than propagating.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent fixes, one per commit, so they can be taken separately.
1. Blender 5.x support — 5.0's extension validator rejects the manifest
outright because
taglineends in a period:key "tagline" invalid: alphanumeric suffix expected. Also guards the now-deprecatedMaterial.use_nodes(new materials already carry a node tree in 5.x), andfixes the exporter's verbose log path, which was empty for an unsaved
.blend and wrote to Blender's working directory.
2. Texture path resolution on Linux/macOS — importing raised
ValueError: 'meshes' is not in listfor any mesh not under a folder namedMeshes. Separately, mesh files reference textures with Windows separators(
MyVessel\hull.dds); a backslash isn't a separator on Linux, so everytexture in such a mesh silently came up missing. References are now
normalized and matched case-insensitively.
3. Missing textures no longer abort the import — one absent texture file
cost the whole mesh, geometry included. Those materials are now created
untextured and the import continues.
Testing — verified on Blender 4.5 LTS, 5.0.1 and 5.2.0 LTS on Linux,
importing a 133-object / 32k-vertex vessel mesh with 21 textures; all
resolve and the result is identical across versions. Windows behaviour is
unchanged by design (
os.path.exists()matches on the first attempt, sothe case-insensitive scan never runs), but I have not been able to run
it on Windows — worth a check before merging.
blender_version_minis left at 4.5.0, since this runs on both active LTSlines. The version bump to 2.3.3 is included one per commit — happy to drop
it if you'd rather set versions at release time.