Skip to content

Blender 5.x support and Linux/macOS texture path fixes - #33

Open
racerx2 wants to merge 3 commits into
BMCDad:masterfrom
racerx2:blender-5x-and-linux-paths
Open

Blender 5.x support and Linux/macOS texture path fixes#33
racerx2 wants to merge 3 commits into
BMCDad:masterfrom
racerx2:blender-5x-and-linux-paths

Conversation

@racerx2

@racerx2 racerx2 commented Aug 1, 2026

Copy link
Copy Markdown

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 tagline ends in a period: key "tagline" invalid: alphanumeric suffix expected. Also guards the now-deprecated
Material.use_nodes (new materials already carry a node tree in 5.x), and
fixes 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 list for any mesh not under a folder named
Meshes. Separately, mesh files reference textures with Windows separators
(MyVessel\hull.dds); a backslash isn't a separator on Linux, so every
texture 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, so
the case-insensitive scan never runs), but I have not been able to run
it on Windows — worth a check before merging.

blender_version_min is left at 4.5.0, since this runs on both active LTS
lines. 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.

racerx2 added 3 commits August 1, 2026 14:26
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.
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.

1 participant